12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- /* Generated by YAKINDU Statechart Tools code generator. */
- #include "gtest/gtest.h"
- #include "ReadOnlyVariable.h"
- #include "sc_timer_service.h"
- //! The timers are managed by a timer service. */
- static sc_unit_timer_service_t timer_service;
- static ReadOnlyVariable statechart;
- class ReadOnlyVariableTest : public ::testing::Test{
- protected:
- virtual void SetUp() {
- readOnlyVariable_init(&statechart);
- sc_timer_service_init(
- &timer_service,
- 0,
- (sc_run_cycle_fp) &readOnlyVariable_runCycle,
- false,
- 200,
- &statechart
- );
- }
- };
- TEST_F(ReadOnlyVariableTest, ReadOnlyVariableTest) {
- readOnlyVariable_enter(&statechart);
- EXPECT_TRUE(readOnlyVariable_isStateActive(&statechart, ReadOnlyVariable_main_region_StateA));
- EXPECT_TRUE(readOnlyVariableIface_get_myInt(&statechart)== 0l);
- EXPECT_TRUE(strcmp(readOnlyVariableIface_get_myString(&statechart), "testString") == 0);
- EXPECT_TRUE(readOnlyVariableIface_get_myBool(&statechart)== true);
- EXPECT_TRUE(readOnlyVariableIface_get_myReal(&statechart)== 1.1);
- EXPECT_TRUE(readOnlyVariableIfaceA_get_myInt(&statechart) == 0l);
- EXPECT_TRUE(strcmp(readOnlyVariableIfaceA_get_myString(&statechart) , "testString") == 0);
- EXPECT_TRUE(readOnlyVariableIfaceA_get_myBool(&statechart) == true);
- EXPECT_TRUE(readOnlyVariableIfaceA_get_myReal(&statechart) == 1.1);
- sc_timer_service_proceed_cycles(&timer_service, 1);
- EXPECT_TRUE(readOnlyVariable_isStateActive(&statechart, ReadOnlyVariable_main_region_StateB));
- EXPECT_TRUE(readOnlyVariableIface_get_myInt(&statechart)== 100l);
- EXPECT_TRUE(strcmp(readOnlyVariableIface_get_myString(&statechart), "fail") == 0);
- EXPECT_TRUE(readOnlyVariableIface_get_myBool(&statechart)== false);
- EXPECT_TRUE(readOnlyVariableIface_get_myReal(&statechart)== 6.6);
- EXPECT_TRUE(readOnlyVariableIfaceA_get_myInt(&statechart) == 200l);
- EXPECT_TRUE(strcmp(readOnlyVariableIfaceA_get_myString(&statechart) , "A_fail") == 0);
- EXPECT_TRUE(readOnlyVariableIfaceA_get_myBool(&statechart) == false);
- EXPECT_TRUE(readOnlyVariableIfaceA_get_myReal(&statechart) == 7.7);
- }
|