瀏覽代碼

regenrated c generator tests

Axel Terfloth 9 年之前
父節點
當前提交
0d08253c5d

+ 63 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryReactionAction/EntryReactionAction.cc

@@ -0,0 +1,63 @@
+/**
+* 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"
+
+
+EntryReactionAction handle;
+
+TEST(StatemachineTest, entryTransitionActionOnStatechartEnter) {
+	entryReactionAction_init(&handle);
+	entryReactionAction_enter(&handle);
+	EXPECT_TRUE(entryReactionActionIface_get_enteredR1(&handle) );
+	EXPECT_TRUE(entryReactionActionIface_get_enteredR2(&handle) );
+	EXPECT_TRUE(entryReactionActionIface_get_enteredBdefault(&handle) );
+	EXPECT_TRUE(!entryReactionActionIface_get_enteredBother(&handle) );
+}
+TEST(StatemachineTest, entryOnRTS) {
+	entryReactionAction_init(&handle);
+	entryReactionAction_enter(&handle);
+	entryReactionActionIface_raise_b(&handle);
+	entryReactionAction_runCycle(&handle);
+	entryReactionActionIface_raise_d(&handle);
+	entryReactionAction_runCycle(&handle);
+	entryReactionActionIface_set_enteredR1(&handle, false);
+	entryReactionActionIface_set_enteredR2(&handle, false);
+	entryReactionActionIface_set_enteredBdefault(&handle, false);
+	entryReactionActionIface_set_enteredBother(&handle, false);
+	entryReactionActionIface_raise_b(&handle);
+	entryReactionAction_runCycle(&handle);
+	EXPECT_TRUE(!entryReactionActionIface_get_enteredR1(&handle) );
+	EXPECT_TRUE(!entryReactionActionIface_get_enteredR2(&handle) );
+	EXPECT_TRUE(!entryReactionActionIface_get_enteredBdefault(&handle) );
+	EXPECT_TRUE(entryReactionActionIface_get_enteredBother(&handle) );
+}
+TEST(StatemachineTest, noEntryTransitionActionOnHistory) {
+	entryReactionAction_init(&handle);
+	entryReactionAction_enter(&handle);
+	entryReactionActionIface_raise_b(&handle);
+	entryReactionAction_runCycle(&handle);
+	entryReactionActionIface_raise_d(&handle);
+	entryReactionAction_runCycle(&handle);
+	entryReactionActionIface_set_enteredR1(&handle, false);
+	entryReactionActionIface_set_enteredR2(&handle, false);
+	entryReactionActionIface_set_enteredBdefault(&handle, false);
+	entryReactionActionIface_set_enteredBother(&handle, false);
+	entryReactionActionIface_raise_d(&handle);
+	entryReactionAction_runCycle(&handle);
+	EXPECT_TRUE(!entryReactionActionIface_get_enteredR1(&handle) );
+	EXPECT_TRUE(!entryReactionActionIface_get_enteredR2(&handle) );
+	EXPECT_TRUE(!entryReactionActionIface_get_enteredBdefault(&handle) );
+	EXPECT_TRUE(!entryReactionActionIface_get_enteredBother(&handle) );
+}
+
+		

+ 19 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryReactionAction/EntryReactionAction.sgen

@@ -0,0 +1,19 @@
+GeneratorModel for yakindu::c {
+	statechart EntryReactionAction {
+		feature Outlet {
+			targetProject = "gtests"
+			targetFolder = "EntryReactionAction"
+		}
+		feature FunctionInlining {
+			inlineReactions = false
+			inlineEntryActions = false
+			inlineEnterSequences = false 
+			inlineExitActions = false
+			inlineExitSequences = false
+			inlineChoices = false
+			inlineEntries = false
+			inlineEnterRegion = false
+			inlineExitRegion = false
+		}
+	}
+}

+ 4 - 4
test-plugins/org.yakindu.sct.generator.c.test/gtests/ReadOnlyVariable/ReadOnlyVariable.cc

@@ -22,21 +22,21 @@ TEST(StatemachineTest, ReadOnlyVariableTest) {
 	EXPECT_TRUE(readOnlyVariableIface_get_myInt(&handle) == 0l);
 	EXPECT_TRUE(strcmp(readOnlyVariableIface_get_myString(&handle) , "testString") == 0);
 	EXPECT_TRUE(readOnlyVariableIface_get_myBool(&handle) == true);
-	EXPECT_TRUE(readOnlyVariableIface_get_myReal(&handle) == 1.1d);
+	EXPECT_TRUE(readOnlyVariableIface_get_myReal(&handle) == 1.1);
 	EXPECT_TRUE(readOnlyVariableIfaceA_get_myInt(&handle) == 0l);
 	EXPECT_TRUE(strcmp(readOnlyVariableIfaceA_get_myString(&handle) , "testString") == 0);
 	EXPECT_TRUE(readOnlyVariableIfaceA_get_myBool(&handle) == true);
-	EXPECT_TRUE(readOnlyVariableIfaceA_get_myReal(&handle) == 1.1d);
+	EXPECT_TRUE(readOnlyVariableIfaceA_get_myReal(&handle) == 1.1);
 	readOnlyVariable_runCycle(&handle);
 	EXPECT_TRUE(readOnlyVariable_isStateActive(&handle, ReadOnlyVariable_main_region_StateB));
 	EXPECT_TRUE(readOnlyVariableIface_get_myInt(&handle) == 100l);
 	EXPECT_TRUE(strcmp(readOnlyVariableIface_get_myString(&handle) , "fail") == 0);
 	EXPECT_TRUE(readOnlyVariableIface_get_myBool(&handle) == false);
-	EXPECT_TRUE(readOnlyVariableIface_get_myReal(&handle) == 6.6d);
+	EXPECT_TRUE(readOnlyVariableIface_get_myReal(&handle) == 6.6);
 	EXPECT_TRUE(readOnlyVariableIfaceA_get_myInt(&handle) == 200l);
 	EXPECT_TRUE(strcmp(readOnlyVariableIfaceA_get_myString(&handle) , "A_fail") == 0);
 	EXPECT_TRUE(readOnlyVariableIfaceA_get_myBool(&handle) == false);
-	EXPECT_TRUE(readOnlyVariableIfaceA_get_myReal(&handle) == 7.7d);
+	EXPECT_TRUE(readOnlyVariableIfaceA_get_myReal(&handle) == 7.7);
 }
 
 		

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

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

+ 11 - 11
test-plugins/org.yakindu.sct.generator.c.test/test-gen/org/yakindu/sct/generator/c/test/AllTests.java

@@ -14,18 +14,18 @@ import org.junit.runners.Suite;
 import org.junit.runners.Suite.SuiteClasses;
 
 @RunWith(Suite.class)
-@SuiteClasses({ActionOutgoingTransitionsInitialState.class, AlwaysOncycle.class, AssignmentAsExpression.class, BitExpressions.class, BooleanExpressions.class,
+@SuiteClasses({AlwaysOncycle.class, AssignmentAsExpression.class, BitExpressions.class, BooleanExpressions.class,
 		CastExpressions.class, Choice.class, CKeywords.class, ConditionalExpression.class, ConstantsTests.class,
 		Declarations.class, DeepEntry.class, DeepHistory.class, DynamicChoice.class, EmptyTransition.class,
-		EnterState.class, EntryChoice.class, EntryExitSelfTransition.class, ExitOnSelfTransition.class, ExitState.class,
-		FeatureCalls.class, FinalState.class, Guard.class, GuardedEntry.class, GuardedExit.class,
-		HistoryWithExitPoint.class, HistoryWithoutInitialStep.class, InEventLifeCycle.class, IntegerExpressions.class,
-		InternalEventLifeCycle.class, LocalReactions.class, LogicalAndTests.class, LogicalOrTests.class,
-		NamedInterfaceAccess.class, OutEventLifeCycle.class, Parenthesis.class, PriorityValues.class, RaiseEvent.class,
-		ReadOnlyVariable.class, SameNameDifferentRegion.class, ShallowHistory.class, ShallowHistoryWithDeepEntry.class,
-		SimpleEvent.class, SimpleHierachy.class, StatechartActive.class, StatechartLocalReactions.class,
-		StateIsActive.class, StaticChoice.class, STextKeywordsInStatesAndRegions.class, StringExpressions.class,
-		SyncFork.class, SyncJoin.class, TransitionWithoutCondition.class, TriggerGuardExpressions.class,
-		ValuedEvents.class})
+		EnterState.class, EntryChoice.class, EntryExitSelfTransition.class, EntryReactionAction.class,
+		ExitOnSelfTransition.class, ExitState.class, FeatureCalls.class, FinalState.class, Guard.class,
+		GuardedEntry.class, GuardedExit.class, HistoryWithExitPoint.class, HistoryWithoutInitialStep.class,
+		InEventLifeCycle.class, IntegerExpressions.class, InternalEventLifeCycle.class, LocalReactions.class,
+		LogicalAndTests.class, LogicalOrTests.class, NamedInterfaceAccess.class, OutEventLifeCycle.class,
+		Parenthesis.class, PriorityValues.class, RaiseEvent.class, ReadOnlyVariable.class,
+		SameNameDifferentRegion.class, ShallowHistory.class, ShallowHistoryWithDeepEntry.class, SimpleEvent.class,
+		SimpleHierachy.class, StatechartActive.class, StatechartLocalReactions.class, StateIsActive.class,
+		StaticChoice.class, STextKeywordsInStatesAndRegions.class, StringExpressions.class, SyncFork.class,
+		SyncJoin.class, TransitionWithoutCondition.class, TriggerGuardExpressions.class, ValuedEvents.class})
 public class AllTests {
 }

+ 39 - 0
test-plugins/org.yakindu.sct.generator.c.test/test-gen/org/yakindu/sct/generator/c/test/EntryReactionAction.java

@@ -0,0 +1,39 @@
+/**
+* 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
+*/
+package org.yakindu.sct.generator.c.test;
+
+import java.util.Collection;
+
+import org.junit.Before;
+import org.junit.runner.RunWith;
+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/EntryReactionAction/EntryReactionAction.cc", program = "gtests/EntryReactionAction/EntryReactionAction", model = "testmodels/SCTUnit/entries/EntryReactionAction.sct")
+@RunWith(GTestRunner.class)
+public class EntryReactionAction {
+
+	protected final GTestHelper helper = new GTestHelper(this) {
+
+		@Override
+		protected void getSourceFiles(Collection<String> files) {
+			super.getSourceFiles(files);
+			files.add(getFileName(getTestProgram()) + ".c");
+		}
+	};
+
+	@Before
+	public void setUp() {
+		helper.generate();
+		helper.compile();
+	}
+}