1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /* Generated by YAKINDU Statechart Tools code generator. */
- #include <string>
- #include "gtest/gtest.h"
- #include "StatechartLocalReactions.h"
- #include "sc_runner.h"
- #include "sc_types.h"
- static StatechartLocalReactions* statechart;
- //! The timers are managed by a timer service. */
- static SctUnitRunner * runner;
- class StatechartLocalReactionsTest : public ::testing::Test{
- protected:
- virtual void SetUp() {
- statechart = new StatechartLocalReactions();
- statechart->init();
- runner = new SctUnitRunner(
- statechart,
- false,
- 200
- );
- }
- virtual void TearDown() {
- delete statechart;
- delete runner;
- }
- };
- TEST_F(StatechartLocalReactionsTest, statechartLocalReactionsTest) {
-
- statechart->enter();
-
- EXPECT_TRUE(statechart->isStateActive(StatechartLocalReactions::main_region_S1));
-
- EXPECT_TRUE(statechart->isStateActive(StatechartLocalReactions::region2_a));
-
- while (statechart->getDefaultSCI()->get_myInt()< 10l) {
- EXPECT_TRUE(statechart->isStateActive(StatechartLocalReactions::region2_a));
- if (statechart->getDefaultSCI()->get_myInt()%2l== 0l) {
- EXPECT_TRUE(statechart->isStateActive(StatechartLocalReactions::main_region_S1));
- }
- else {
- EXPECT_TRUE(statechart->isStateActive(StatechartLocalReactions::main_region_S2));
- }
- runner->proceed_cycles(1);
- }
-
- }
|