Quellcode durchsuchen

regenerated interpreter tests

Axel Terfloth vor 9 Jahren
Ursprung
Commit
97f1446d35

+ 1 - 1
test-plugins/org.yakindu.sct.simulation.core.sexec.test/model/test.sgen

@@ -8,7 +8,7 @@ GeneratorModel for sctunit::interpreter {
 		}
 	}	
 	
-	test ActionOutgoingTransitionsInitialState{ 
+	test EntryReactionAction{ 
 		
 		feature Outlet{ 
 			targetProject = "org.yakindu.sct.simulation.core.sexec.test" 

+ 0 - 45
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/ActionOutgoingTransitionsInitialStateTest.java

@@ -1,45 +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
-*/
-package org.yakindu.sct.simulation.core.sexec.test;
-import org.eclipse.xtext.junit4.InjectWith;
-import org.eclipse.xtext.junit4.XtextRunner;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.yakindu.sct.model.sexec.ExecutionFlow;
-import org.yakindu.sct.model.sexec.interpreter.test.util.AbstractExecutionFlowTest;
-import org.yakindu.sct.model.sexec.interpreter.test.util.SExecInjectionProvider;
-import org.yakindu.sct.test.models.SCTUnitTestModels;
-import com.google.inject.Inject;
-import static org.junit.Assert.assertTrue;
-/**
- *  Unit TestCase for ActionOutgoingTransitionsInitialState
- */
-@SuppressWarnings("all")
-@RunWith(XtextRunner.class)
-@InjectWith(SExecInjectionProvider.class)
-public class ActionOutgoingTransitionsInitialStateTest extends AbstractExecutionFlowTest {
-	@Before
-	public void setup() throws Exception {
-		ExecutionFlow flow = models.loadExecutionFlowFromResource("ActionOutgoingTransitionsInitialState.sct");
-		initInterpreter(flow);
-	}
-	@Test
-	public void ActionOutgoingTransitionsInitialStateTest() throws Exception {
-		interpreter.enter();
-		assertTrue(isStateActive("1"));
-		assertTrue(isStateActive("1"));
-		assertTrue(isStateActive("2"));
-		assertTrue(getInteger("internalB") == 5l);
-		assertTrue(getInteger("c") == 5l);
-		assertTrue(getInteger("d") == 5l);
-	}
-}

+ 11 - 12
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/AllTestsTest.java

@@ -15,18 +15,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,

+ 79 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/EntryReactionActionTest.java

@@ -0,0 +1,79 @@
+/**
+* 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.simulation.core.sexec.test;
+import org.eclipse.xtext.junit4.InjectWith;
+import org.eclipse.xtext.junit4.XtextRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.interpreter.test.util.AbstractExecutionFlowTest;
+import org.yakindu.sct.model.sexec.interpreter.test.util.SExecInjectionProvider;
+import org.yakindu.sct.test.models.SCTUnitTestModels;
+import com.google.inject.Inject;
+import static org.junit.Assert.assertTrue;
+/**
+ *  Unit TestCase for EntryReactionAction
+ */
+@SuppressWarnings("all")
+@RunWith(XtextRunner.class)
+@InjectWith(SExecInjectionProvider.class)
+public class EntryReactionActionTest extends AbstractExecutionFlowTest {
+	@Before
+	public void setup() throws Exception {
+		ExecutionFlow flow = models.loadExecutionFlowFromResource("entries/EntryReactionAction.sct");
+		initInterpreter(flow);
+	}
+	@Test
+	public void entryTransitionActionOnStatechartEnter() throws Exception {
+		interpreter.enter();
+		assertTrue(getBoolean("enteredR1"));
+		assertTrue(getBoolean("enteredR2"));
+		assertTrue(getBoolean("enteredBdefault"));
+		assertTrue(!getBoolean("enteredBother"));
+	}
+	@Test
+	public void entryOnRTS() throws Exception {
+		interpreter.enter();
+		raiseEvent("b");
+		interpreter.runCycle();
+		raiseEvent("d");
+		interpreter.runCycle();
+		setBoolean("enteredR1", false);
+		setBoolean("enteredR2", false);
+		setBoolean("enteredBdefault", false);
+		setBoolean("enteredBother", false);
+		raiseEvent("b");
+		interpreter.runCycle();
+		assertTrue(!getBoolean("enteredR1"));
+		assertTrue(!getBoolean("enteredR2"));
+		assertTrue(!getBoolean("enteredBdefault"));
+		assertTrue(getBoolean("enteredBother"));
+	}
+	@Test
+	public void noEntryTransitionActionOnHistory() throws Exception {
+		interpreter.enter();
+		raiseEvent("b");
+		interpreter.runCycle();
+		raiseEvent("d");
+		interpreter.runCycle();
+		setBoolean("enteredR1", false);
+		setBoolean("enteredR2", false);
+		setBoolean("enteredBdefault", false);
+		setBoolean("enteredBother", false);
+		raiseEvent("d");
+		interpreter.runCycle();
+		assertTrue(!getBoolean("enteredR1"));
+		assertTrue(!getBoolean("enteredR2"));
+		assertTrue(!getBoolean("enteredBdefault"));
+		assertTrue(!getBoolean("enteredBother"));
+	}
+}

+ 4 - 4
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/ReadOnlyVariableTest.java

@@ -39,20 +39,20 @@ public class ReadOnlyVariableTest extends AbstractExecutionFlowTest {
 		assertTrue(getInteger("myInt") == 0l);
 		assertTrue(getString("myString").equals("testString"));
 		assertTrue(getBoolean("myBool") == true);
-		assertTrue(getReal("myReal") == 1.1d);
+		assertTrue(getReal("myReal") == 1.1);
 		assertTrue(getInteger("A.myInt") == 0l);
 		assertTrue(getString("A.myString").equals("testString"));
 		assertTrue(getBoolean("A.myBool") == true);
-		assertTrue(getReal("A.myReal") == 1.1d);
+		assertTrue(getReal("A.myReal") == 1.1);
 		interpreter.runCycle();
 		assertTrue(isStateActive("StateB"));
 		assertTrue(getInteger("myInt") == 100l);
 		assertTrue(getString("myString").equals("fail"));
 		assertTrue(getBoolean("myBool") == false);
-		assertTrue(getReal("myReal") == 6.6d);
+		assertTrue(getReal("myReal") == 6.6);
 		assertTrue(getInteger("A.myInt") == 200l);
 		assertTrue(getString("A.myString").equals("A_fail"));
 		assertTrue(getBoolean("A.myBool") == false);
-		assertTrue(getReal("A.myReal") == 7.7d);
+		assertTrue(getReal("A.myReal") == 7.7);
 	}
 }