Browse Source

regenerated C++ tests

Axel Terfloth 9 years ago
parent
commit
cb7601262f

+ 1 - 1
test-plugins/org.yakindu.sct.generator.cpp.test/all C++ generator tests.launch

@@ -30,7 +30,7 @@
 <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
 <stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
 <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.yakindu.sct.generator.cpp.test.AllTestsTest"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.yakindu.sct.generator.cpp.test"/>

+ 0 - 26
test-plugins/org.yakindu.sct.generator.cpp.test/gtests/ActionOutgoingTransitionsInitialStateTest/ActionOutgoingTransitionsInitialStateTest.cc

@@ -1,26 +0,0 @@
-/**
-* Copyright (c) 2016 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 "ActionOutgoingTransitionsInitialState.h"
-
-TEST(StatemachineTest, ActionOutgoingTransitionsInitialStateTest) {
-	ActionOutgoingTransitionsInitialState* statechart = new ActionOutgoingTransitionsInitialState();
-	statechart->init();
-	statechart->enter();
-	EXPECT_TRUE(statechart->isStateActive(ActionOutgoingTransitionsInitialState::region_1__1));
-	EXPECT_TRUE(statechart->isStateActive(ActionOutgoingTransitionsInitialState::region_2__1));
-	EXPECT_TRUE(statechart->isStateActive(ActionOutgoingTransitionsInitialState::region_2__1_r1__2));
-	EXPECT_TRUE(statechart->getDefaultSCI()->get_internalB()== 5l);
-	EXPECT_TRUE(statechart->getDefaultSCI()->get_c()== 5l);
-	EXPECT_TRUE(statechart->getDefaultSCI()->get_d()== 5l);
-	delete statechart;
-}

+ 2 - 2
test-plugins/org.yakindu.sct.generator.cpp.test/gtests/ActionOutgoingTransitionsInitialStateTest/ActionOutgoingTransitionsInitialState.sgen

@@ -1,8 +1,8 @@
 GeneratorModel for yakindu::cpp {
-	statechart ActionOutgoingTransitionsInitialState {
+	statechart EntryReactionAction {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "ActionOutgoingTransitionsInitialStateTest"
+			targetFolder = "EntryReactionActionTest"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 64 - 0
test-plugins/org.yakindu.sct.generator.cpp.test/gtests/EntryReactionActionTest/EntryReactionActionTest.cc

@@ -0,0 +1,64 @@
+/**
+* Copyright (c) 2016 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 "EntryReactionAction.h"
+
+TEST(StatemachineTest, entryTransitionActionOnStatechartEnter) {
+	EntryReactionAction* statechart = new EntryReactionAction();
+	statechart->init();
+	statechart->enter();
+	EXPECT_TRUE(statechart->getDefaultSCI()->get_enteredR1());
+	EXPECT_TRUE(statechart->getDefaultSCI()->get_enteredR2());
+	EXPECT_TRUE(statechart->getDefaultSCI()->get_enteredBdefault());
+	EXPECT_TRUE(!statechart->getDefaultSCI()->get_enteredBother());
+	delete statechart;
+}
+TEST(StatemachineTest, entryOnRTS) {
+	EntryReactionAction* statechart = new EntryReactionAction();
+	statechart->init();
+	statechart->enter();
+	statechart->raise_b();
+	statechart->runCycle();
+	statechart->raise_d();
+	statechart->runCycle();
+	statechart->getDefaultSCI()->set_enteredR1(false);
+	statechart->getDefaultSCI()->set_enteredR2(false);
+	statechart->getDefaultSCI()->set_enteredBdefault(false);
+	statechart->getDefaultSCI()->set_enteredBother(false);
+	statechart->raise_b();
+	statechart->runCycle();
+	EXPECT_TRUE(!statechart->getDefaultSCI()->get_enteredR1());
+	EXPECT_TRUE(!statechart->getDefaultSCI()->get_enteredR2());
+	EXPECT_TRUE(!statechart->getDefaultSCI()->get_enteredBdefault());
+	EXPECT_TRUE(statechart->getDefaultSCI()->get_enteredBother());
+	delete statechart;
+}
+TEST(StatemachineTest, noEntryTransitionActionOnHistory) {
+	EntryReactionAction* statechart = new EntryReactionAction();
+	statechart->init();
+	statechart->enter();
+	statechart->raise_b();
+	statechart->runCycle();
+	statechart->raise_d();
+	statechart->runCycle();
+	statechart->getDefaultSCI()->set_enteredR1(false);
+	statechart->getDefaultSCI()->set_enteredR2(false);
+	statechart->getDefaultSCI()->set_enteredBdefault(false);
+	statechart->getDefaultSCI()->set_enteredBother(false);
+	statechart->raise_d();
+	statechart->runCycle();
+	EXPECT_TRUE(!statechart->getDefaultSCI()->get_enteredR1());
+	EXPECT_TRUE(!statechart->getDefaultSCI()->get_enteredR2());
+	EXPECT_TRUE(!statechart->getDefaultSCI()->get_enteredBdefault());
+	EXPECT_TRUE(!statechart->getDefaultSCI()->get_enteredBother());
+	delete statechart;
+}

+ 1 - 1
test-plugins/org.yakindu.sct.generator.cpp.test/model/test.sgen

@@ -24,7 +24,7 @@ GeneratorModel for sctunit::cpp {
 		}	
 	}
 		
-	test ActionOutgoingTransitionsInitialState{
+	test EntryReactionAction {
 		
 		feature Outlet{ 
 			targetProject = "org.yakindu.sct.generator.cpp.test" 

+ 11 - 12
test-plugins/org.yakindu.sct.generator.cpp.test/test-gen/org/yakindu/sct/generator/cpp/test/AllTestsTest.java

@@ -14,18 +14,17 @@ import org.junit.runners.Suite;
 import org.junit.runners.Suite.SuiteClasses;
 
 @RunWith(Suite.class)
-@SuiteClasses({ActionOutgoingTransitionsInitialStateTest.class, AlwaysOncycleTest.class,
-		AssignmentAsExpressionTest.class, BitExpressionsTest.class, BooleanExpressionsTest.class,
-		CastExpressionsTest.class, ChoiceTest.class, CKeywordsTest.class, ConditionalExpressionTest.class,
-		ConstantsTestsTest.class, DeclarationsTest.class, DeepEntryTest.class, DeepHistoryTest.class,
-		DynamicChoiceTest.class, EmptyTransitionTest.class, EnterStateTest.class, EntryChoiceTest.class,
-		EntryExitSelfTransitionTest.class, ExitOnSelfTransitionTest.class, ExitStateTest.class, FeatureCallsTest.class,
-		FinalStateTest.class, GuardTest.class, GuardedEntryTest.class, GuardedExitTest.class,
-		HistoryWithExitPointTest.class, HistoryWithoutInitialStepTest.class, InEventLifeCycleTest.class,
-		IntegerExpressionsTest.class, InternalEventLifeCycleTest.class, LocalReactionsTest.class,
-		LogicalAndTestsTest.class, LogicalOrTestsTest.class, NamedInterfaceAccessTest.class,
-		OutEventLifeCycleTest.class, ParenthesisTest.class, PriorityValuesTest.class, RaiseEventTest.class,
-		ReadOnlyVariableTest.class, SameNameDifferentRegionTest.class, ShallowHistoryTest.class,
+@SuiteClasses({AlwaysOncycleTest.class, AssignmentAsExpressionTest.class, BitExpressionsTest.class,
+		BooleanExpressionsTest.class, CastExpressionsTest.class, ChoiceTest.class, CKeywordsTest.class,
+		ConditionalExpressionTest.class, ConstantsTestsTest.class, DeclarationsTest.class, DeepEntryTest.class,
+		DeepHistoryTest.class, DynamicChoiceTest.class, EmptyTransitionTest.class, EnterStateTest.class,
+		EntryChoiceTest.class, EntryExitSelfTransitionTest.class, EntryReactionActionTest.class,
+		ExitOnSelfTransitionTest.class, ExitStateTest.class, FeatureCallsTest.class, FinalStateTest.class,
+		GuardTest.class, GuardedEntryTest.class, GuardedExitTest.class, HistoryWithExitPointTest.class,
+		HistoryWithoutInitialStepTest.class, InEventLifeCycleTest.class, IntegerExpressionsTest.class,
+		InternalEventLifeCycleTest.class, LocalReactionsTest.class, LogicalAndTestsTest.class, LogicalOrTestsTest.class,
+		NamedInterfaceAccessTest.class, OutEventLifeCycleTest.class, ParenthesisTest.class, PriorityValuesTest.class,
+		RaiseEventTest.class, ReadOnlyVariableTest.class, SameNameDifferentRegionTest.class, ShallowHistoryTest.class,
 		ShallowHistoryWithDeepEntryTest.class, SimpleEventTest.class, SimpleHierachyTest.class,
 		StatechartActiveTest.class, StatechartLocalReactionsTest.class, StateIsActiveTest.class, StaticChoiceTest.class,
 		STextKeywordsInStatesAndRegionsTest.class, StringExpressionsTest.class, SyncForkTest.class, SyncJoinTest.class,

+ 2 - 2
test-plugins/org.yakindu.sct.generator.cpp.test/test-gen/org/yakindu/sct/generator/cpp/test/ActionOutgoingTransitionsInitialStateTest.java

@@ -18,9 +18,9 @@ import org.yakindu.sct.generator.c.gtest.GTest;
 import org.yakindu.sct.generator.c.gtest.GTestRunner;
 import org.yakindu.sct.generator.c.gtest.GTestHelper;
 
-@GTest(sourceFile = "gtests/ActionOutgoingTransitionsInitialStateTest/ActionOutgoingTransitionsInitialStateTest.cc", program = "gtests/ActionOutgoingTransitionsInitialStateTest/ActionOutgoingTransitionsInitialState", model = "testmodels/SCTUnit/ActionOutgoingTransitionsInitialState.sct")
+@GTest(sourceFile = "gtests/EntryReactionActionTest/EntryReactionActionTest.cc", program = "gtests/EntryReactionActionTest/EntryReactionAction", model = "testmodels/SCTUnit/EntryReactionAction.sct")
 @RunWith(GTestRunner.class)
-public class ActionOutgoingTransitionsInitialStateTest {
+public class EntryReactionActionTest {
 
 	protected final GTestHelper helper = new GTestHelper(this) {