ShallowHistoryWithDeepEntryTest.cc 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* Generated by YAKINDU Statechart Tools code generator. */
  2. #include "gtest/gtest.h"
  3. #include "ShallowHistoryWithDeepEntry.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 ShallowHistoryWithDeepEntry statechart;
  8. class ShallowHistoryWithDeepEntryTest : public ::testing::Test{
  9. protected:
  10. virtual void SetUp() {
  11. shallowHistoryWithDeepEntry_init(&statechart);
  12. sc_timer_service_init(
  13. &timer_service,
  14. 0,
  15. (sc_run_cycle_fp) &shallowHistoryWithDeepEntry_runCycle,
  16. false,
  17. 200,
  18. &statechart
  19. );
  20. }
  21. };
  22. TEST_F(ShallowHistoryWithDeepEntryTest, noDeepEntryWithinHistory) {
  23. shallowHistoryWithDeepEntry_enter(&statechart);
  24. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Y));
  25. shallowHistoryWithDeepEntryIface_raise_toZ(&statechart);
  26. sc_timer_service_proceed_cycles(&timer_service, 1);
  27. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Z__region0_A));
  28. shallowHistoryWithDeepEntryIface_raise_toY(&statechart);
  29. sc_timer_service_proceed_cycles(&timer_service, 1);
  30. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Y));
  31. shallowHistoryWithDeepEntryIface_raise_toZ(&statechart);
  32. sc_timer_service_proceed_cycles(&timer_service, 1);
  33. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Z__region0_A));
  34. }
  35. TEST_F(ShallowHistoryWithDeepEntryTest, deepEntryWithinHistory) {
  36. shallowHistoryWithDeepEntry_enter(&statechart);
  37. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Y));
  38. shallowHistoryWithDeepEntryIface_raise_toZ(&statechart);
  39. sc_timer_service_proceed_cycles(&timer_service, 1);
  40. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Z__region0_A));
  41. shallowHistoryWithDeepEntryIface_raise_toC(&statechart);
  42. sc_timer_service_proceed_cycles(&timer_service, 1);
  43. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Z__region0_B__region0_C));
  44. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Z__region0_B));
  45. shallowHistoryWithDeepEntryIface_raise_toY(&statechart);
  46. sc_timer_service_proceed_cycles(&timer_service, 1);
  47. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Y));
  48. shallowHistoryWithDeepEntryIface_raise_toZ(&statechart);
  49. sc_timer_service_proceed_cycles(&timer_service, 1);
  50. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Z__region0_B__region0_C));
  51. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Z__region0_B));
  52. }
  53. TEST_F(ShallowHistoryWithDeepEntryTest, directDeepEntryIntoHistory) {
  54. shallowHistoryWithDeepEntry_enter(&statechart);
  55. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Y));
  56. shallowHistoryWithDeepEntryIface_raise_toC(&statechart);
  57. sc_timer_service_proceed_cycles(&timer_service, 1);
  58. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Z__region0_B__region0_C));
  59. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Z__region0_B));
  60. shallowHistoryWithDeepEntryIface_raise_toY(&statechart);
  61. sc_timer_service_proceed_cycles(&timer_service, 1);
  62. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Y));
  63. shallowHistoryWithDeepEntryIface_raise_toZ(&statechart);
  64. sc_timer_service_proceed_cycles(&timer_service, 1);
  65. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Z__region0_B__region0_C));
  66. EXPECT_TRUE(shallowHistoryWithDeepEntry_isStateActive(&statechart, ShallowHistoryWithDeepEntry_main_region_Z__region0_B));
  67. }