InEventLifeCycleTest.cc 878 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Generated by YAKINDU Statechart Tools code generator. */
  2. #include <string>
  3. #include "gtest/gtest.h"
  4. #include "InEventLifeCycle.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 InEventLifeCycleTest : public ::testing::Test{
  10. protected:
  11. InEventLifeCycle* statechart;
  12. virtual void SetUp() {
  13. statechart = new InEventLifeCycle();
  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(InEventLifeCycleTest, eventLifeCycle) {
  27. statechart->enter();
  28. statechart->getDefaultSCI()->raise_e();
  29. EXPECT_TRUE(statechart->getDefaultSCI()->get_i()== 0l);
  30. runner->proceed_cycles(1);
  31. EXPECT_TRUE(statechart->getDefaultSCI()->get_i()== 1l);
  32. }