EventDrivenInternalEventTest.cc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Generated by YAKINDU Statechart Tools code generator. */
  2. #include "gtest/gtest.h"
  3. #include "EventDrivenInternalEvent.h"
  4. #include "sc_timer_service.h"
  5. //! The timers are managed by a timer service. */
  6. static sc_unit_timer_service_t timer_service;
  7. static EventDrivenInternalEvent statechart;
  8. class EventDrivenInternalEventTest : public ::testing::Test{
  9. protected:
  10. virtual void SetUp() {
  11. eventDrivenInternalEvent_init(&statechart);
  12. sc_timer_service_init(
  13. &timer_service,
  14. 0,
  15. (sc_run_cycle_fp) &eventDrivenInternalEvent_runCycle,
  16. true,
  17. 200,
  18. &statechart
  19. );
  20. }
  21. };
  22. TEST_F(EventDrivenInternalEventTest, checkInternlEventQueueing) {
  23. eventDrivenInternalEvent_enter(&statechart);
  24. EXPECT_TRUE(eventDrivenInternalEvent_isStateActive(&statechart, EventDrivenInternalEvent_EventDrivenInternalEvent_r1_A));
  25. EXPECT_TRUE(eventDrivenInternalEvent_isStateActive(&statechart, EventDrivenInternalEvent_EventDrivenInternalEvent_r2_C));
  26. EXPECT_TRUE(eventDrivenInternalEvent_isStateActive(&statechart, EventDrivenInternalEvent_EventDrivenInternalEvent_check_VALID));
  27. eventDrivenInternalEventIface_raise_start(&statechart);
  28. EXPECT_TRUE(eventDrivenInternalEvent_isStateActive(&statechart, EventDrivenInternalEvent_EventDrivenInternalEvent_r1_B));
  29. EXPECT_TRUE(eventDrivenInternalEvent_isStateActive(&statechart, EventDrivenInternalEvent_EventDrivenInternalEvent_r2_D));
  30. EXPECT_TRUE(eventDrivenInternalEvent_isStateActive(&statechart, EventDrivenInternalEvent_EventDrivenInternalEvent_check_VALID));
  31. EXPECT_TRUE(eventDrivenInternalEventIface_get_i1_sequence(&statechart)== 2l);
  32. EXPECT_TRUE(eventDrivenInternalEventIface_get_i2_sequence(&statechart)== 3l);
  33. eventDrivenInternalEvent_exit(&statechart);
  34. }