123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- /* Generated by YAKINDU Statechart Tools code generator. */
- #include "gtest/gtest.h"
- #include "ExitState.h"
- #include "sc_timer_service.h"
- //! The timers are managed by a timer service. */
- static sc_unit_timer_service_t timer_service;
- static ExitState statechart;
- class ExitStateTest : public ::testing::Test{
- protected:
- virtual void SetUp() {
- exitState_init(&statechart);
- sc_timer_service_init(
- &timer_service,
- 0,
- (sc_run_cycle_fp) &exitState_runCycle,
- false,
- 200,
- &statechart
- );
- }
- };
- TEST_F(ExitStateTest, defaultExit) {
- exitState_enter(&statechart);
- EXPECT_TRUE(exitState_isStateActive(&statechart, ExitState_r_A));
- exitStateIface_raise_e(&statechart);
- sc_timer_service_proceed_cycles(&timer_service, 1);
- EXPECT_TRUE(exitState_isStateActive(&statechart, ExitState_r_E));
- }
- TEST_F(ExitStateTest, namedExitThroughNamedTransition) {
- exitState_enter(&statechart);
- EXPECT_TRUE(exitState_isStateActive(&statechart, ExitState_r_A));
- exitStateIface_raise_f(&statechart);
- sc_timer_service_proceed_cycles(&timer_service, 1);
- EXPECT_TRUE(exitState_isStateActive(&statechart, ExitState_r_F));
- }
- TEST_F(ExitStateTest, namedExitThroughDefaultTransition) {
- exitState_enter(&statechart);
- EXPECT_TRUE(exitState_isStateActive(&statechart, ExitState_r_A));
- exitStateIface_raise_g(&statechart);
- sc_timer_service_proceed_cycles(&timer_service, 1);
- EXPECT_TRUE(exitState_isStateActive(&statechart, ExitState_r_E));
- }
- TEST_F(ExitStateTest, remainInA) {
- exitState_enter(&statechart);
- EXPECT_TRUE(exitState_isStateActive(&statechart, ExitState_r_A));
- sc_timer_service_proceed_cycles(&timer_service, 1);
- EXPECT_TRUE(exitState_isStateActive(&statechart, ExitState_r_A));
- }
|