StatechartLocalReactionsTest.cc 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* Generated by YAKINDU Statechart Tools code generator. */
  2. #include <string>
  3. #include "gtest/gtest.h"
  4. #include "StatechartLocalReactions.h"
  5. #include "sc_runner.h"
  6. #include "sc_types.h"
  7. static StatechartLocalReactions* statechart;
  8. //! The timers are managed by a timer service. */
  9. static SctUnitRunner * runner;
  10. class StatechartLocalReactionsTest : public ::testing::Test{
  11. protected:
  12. virtual void SetUp() {
  13. statechart = new StatechartLocalReactions();
  14. statechart->init();
  15. runner = new SctUnitRunner(
  16. statechart,
  17. false,
  18. 200
  19. );
  20. }
  21. virtual void TearDown() {
  22. delete statechart;
  23. delete runner;
  24. }
  25. };
  26. TEST_F(StatechartLocalReactionsTest, statechartLocalReactionsTest) {
  27. statechart->enter();
  28. EXPECT_TRUE(statechart->isStateActive(StatechartLocalReactions::main_region_S1));
  29. EXPECT_TRUE(statechart->isStateActive(StatechartLocalReactions::region2_a));
  30. while (statechart->getDefaultSCI()->get_myInt()< 10l) {
  31. EXPECT_TRUE(statechart->isStateActive(StatechartLocalReactions::region2_a));
  32. if (statechart->getDefaultSCI()->get_myInt()%2l== 0l) {
  33. EXPECT_TRUE(statechart->isStateActive(StatechartLocalReactions::main_region_S1));
  34. }
  35. else {
  36. EXPECT_TRUE(statechart->isStateActive(StatechartLocalReactions::main_region_S2));
  37. }
  38. runner->proceed_cycles(1);
  39. }
  40. }