HistoryWithoutInitialStepTest.cc 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Generated by YAKINDU Statechart Tools code generator. */
  2. #include "gtest/gtest.h"
  3. #include "HistoryWithoutInitialStep.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 HistoryWithoutInitialStep statechart;
  8. class HistoryWithoutInitialStepTest : public ::testing::Test{
  9. protected:
  10. virtual void SetUp() {
  11. historyWithoutInitialStep_init(&statechart);
  12. sc_timer_service_init(
  13. &timer_service,
  14. 0,
  15. (sc_run_cycle_fp) &historyWithoutInitialStep_runCycle,
  16. false,
  17. 200,
  18. &statechart
  19. );
  20. }
  21. };
  22. void init(){
  23. historyWithoutInitialStep_enter(&statechart);
  24. EXPECT_TRUE(historyWithoutInitialStep_isStateActive(&statechart, HistoryWithoutInitialStep_main_region_A));
  25. historyWithoutInitialStepIface_raise_toB(&statechart);
  26. sc_timer_service_proceed_cycles(&timer_service, 1);
  27. }
  28. TEST_F(HistoryWithoutInitialStepTest, enterThroughInitialEntry) {
  29. init();
  30. EXPECT_TRUE(historyWithoutInitialStep_isStateActive(&statechart, HistoryWithoutInitialStep_main_region_B_r1_C));
  31. historyWithoutInitialStepIface_raise_next(&statechart);
  32. sc_timer_service_proceed_cycles(&timer_service, 1);
  33. EXPECT_TRUE(historyWithoutInitialStep_isStateActive(&statechart, HistoryWithoutInitialStep_main_region_B_r1_D));
  34. }
  35. TEST_F(HistoryWithoutInitialStepTest, enterCThroughHistory) {
  36. init();
  37. EXPECT_TRUE(historyWithoutInitialStep_isStateActive(&statechart, HistoryWithoutInitialStep_main_region_B_r1_C));
  38. historyWithoutInitialStepIface_raise_toA(&statechart);
  39. sc_timer_service_proceed_cycles(&timer_service, 1);
  40. EXPECT_TRUE(historyWithoutInitialStep_isStateActive(&statechart, HistoryWithoutInitialStep_main_region_A));
  41. historyWithoutInitialStepIface_raise_toHistory(&statechart);
  42. sc_timer_service_proceed_cycles(&timer_service, 1);
  43. EXPECT_TRUE(historyWithoutInitialStep_isStateActive(&statechart, HistoryWithoutInitialStep_main_region_B_r1_C));
  44. }
  45. TEST_F(HistoryWithoutInitialStepTest, enterDThroughHistory) {
  46. init();
  47. historyWithoutInitialStepIface_raise_next(&statechart);
  48. sc_timer_service_proceed_cycles(&timer_service, 1);
  49. EXPECT_TRUE(historyWithoutInitialStep_isStateActive(&statechart, HistoryWithoutInitialStep_main_region_B_r1_D));
  50. historyWithoutInitialStepIface_raise_toA(&statechart);
  51. sc_timer_service_proceed_cycles(&timer_service, 1);
  52. EXPECT_TRUE(historyWithoutInitialStep_isStateActive(&statechart, HistoryWithoutInitialStep_main_region_A));
  53. historyWithoutInitialStepIface_raise_toHistory(&statechart);
  54. sc_timer_service_proceed_cycles(&timer_service, 1);
  55. EXPECT_TRUE(historyWithoutInitialStep_isStateActive(&statechart, HistoryWithoutInitialStep_main_region_B_r1_D));
  56. }