StateIsActiveTest.cc 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Generated by YAKINDU Statechart Tools code generator. */
  2. #include <string>
  3. #include "gtest/gtest.h"
  4. #include "StateIsActive.h"
  5. #include "sc_runner.h"
  6. #include "sc_types.h"
  7. //! The timers are managed by a timer service. */
  8. static SctUnitRunner * runner;
  9. class StateIsActiveTest : public ::testing::Test{
  10. protected:
  11. StateIsActive* statechart;
  12. virtual void SetUp() {
  13. statechart = new StateIsActive();
  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(StateIsActiveTest, stateIsActive) {
  27. statechart->enter();
  28. EXPECT_TRUE(statechart->isStateActive(StateIsActive::R1_R1A));
  29. EXPECT_TRUE(statechart->isStateActive(StateIsActive::R2_R2A));
  30. statechart->getDefaultSCI()->raise_event1();
  31. runner->proceed_cycles(1);
  32. runner->proceed_cycles(1);
  33. EXPECT_TRUE(statechart->isStateActive(StateIsActive::R1_R1B));
  34. EXPECT_TRUE(statechart->isStateActive(StateIsActive::R2_R2B));
  35. }