123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- /**
- * Copyright (c) 2017 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * committers of YAKINDU - initial API and implementation
- */
- #include <string>
- #include "gtest/gtest.h"
- #include "EntryExitSelfTransition.h"
- #include "sc_types.h"
- EntryExitSelfTransition* statechart;
- class StatemachineTest : public ::testing::Test{
- protected:
- virtual void SetUp() {
- statechart = new EntryExitSelfTransition();
- statechart->init();
- }
- virtual void TearDown() {
- delete statechart;
- }
- };
- void init(){
- statechart->enter();
- statechart->runCycle();
- EXPECT_TRUE(statechart->getDefaultSCI()->get_entries()== 1l);
- EXPECT_TRUE(statechart->isStateActive(EntryExitSelfTransition::main_region_A__region0_B));
- statechart->getDefaultSCI()->set_entries(0l);
- }
- TEST_F(StatemachineTest, SelfTransitionToChildState) {
-
-
- init();
-
- statechart->raise_e();
-
- statechart->runCycle();
-
- EXPECT_TRUE(statechart->getDefaultSCI()->get_entries()== 1l);
-
- EXPECT_TRUE(statechart->getDefaultSCI()->get_exits()== 1l);
-
- EXPECT_TRUE(statechart->isStateActive(EntryExitSelfTransition::main_region_A__region0_C));
-
- }
- TEST_F(StatemachineTest, SelfTransitionFromChildState) {
-
-
- init();
-
- statechart->raise_e1();
-
- statechart->runCycle();
-
- EXPECT_TRUE(statechart->getDefaultSCI()->get_entries()== 0l);
-
- EXPECT_TRUE(statechart->getDefaultSCI()->get_exits()== 0l);
-
- EXPECT_TRUE(statechart->isStateActive(EntryExitSelfTransition::main_region_A__region0_C));
-
- statechart->raise_e1();
-
- statechart->runCycle();
-
- EXPECT_TRUE(statechart->isStateActive(EntryExitSelfTransition::main_region_A__region0_B));
-
- EXPECT_TRUE(statechart->getDefaultSCI()->get_entries()== 1l);
-
- EXPECT_TRUE(statechart->getDefaultSCI()->get_exits()== 1l);
-
- }
|