InEventLifeCycleTest.cc 865 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* Generated by YAKINDU Statechart Tools code generator. */
  2. #include "gtest/gtest.h"
  3. #include "InEventLifeCycle.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 InEventLifeCycle statechart;
  8. class InEventLifeCycleTest : public ::testing::Test{
  9. protected:
  10. virtual void SetUp() {
  11. inEventLifeCycle_init(&statechart);
  12. sc_timer_service_init(
  13. &timer_service,
  14. 0,
  15. (sc_run_cycle_fp) &inEventLifeCycle_runCycle,
  16. false,
  17. 200,
  18. &statechart
  19. );
  20. }
  21. };
  22. TEST_F(InEventLifeCycleTest, eventLifeCycle) {
  23. inEventLifeCycle_enter(&statechart);
  24. inEventLifeCycleIface_raise_e(&statechart);
  25. EXPECT_TRUE(inEventLifeCycleIface_get_i(&statechart)== 0l);
  26. sc_timer_service_proceed_cycles(&timer_service, 1);
  27. EXPECT_TRUE(inEventLifeCycleIface_get_i(&statechart)== 1l);
  28. }