InEventLifeCycleTest.cc 892 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. namespace {
  8. //! The timers are managed by a timer service. */
  9. static SctUnitRunner * runner;
  10. class InEventLifeCycleTest : public ::testing::Test{
  11. protected:
  12. InEventLifeCycle* statechart;
  13. virtual void SetUp() {
  14. statechart = new InEventLifeCycle();
  15. statechart->init();
  16. runner = new SctUnitRunner(
  17. statechart,
  18. false,
  19. 200
  20. );
  21. }
  22. virtual void TearDown() {
  23. delete statechart;
  24. delete runner;
  25. }
  26. };
  27. TEST_F(InEventLifeCycleTest, eventLifeCycle) {
  28. statechart->enter();
  29. statechart->getDefaultSCI()->raise_e();
  30. EXPECT_TRUE(statechart->getDefaultSCI()->get_i()== 0l);
  31. runner->proceed_cycles(1);
  32. EXPECT_TRUE(statechart->getDefaultSCI()->get_i()== 1l);
  33. }
  34. }