Browse Source

YAKHMI-1024, STatechart and Test for static/dynamic Choice Test

malknet42 11 years ago
parent
commit
8aeb7327ef

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

@@ -80,6 +80,16 @@ GeneratorModel for sctunit::interpreter {
 		}			
 	}
 	
+	test DynamicChoice{
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.simulation.core.sexec.test" 
+			targetFolder = "test-gen"			
+		}			
+	}
+	
+	
+	
 	test EnterState{
 		
 		feature Outlet{ 
@@ -281,6 +291,16 @@ GeneratorModel for sctunit::interpreter {
 		}			
 	}
 	
+	test StaticChoice{
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.simulation.core.sexec.test" 
+			targetFolder = "test-gen"			
+		}			
+	}
+	
+	
+	
 	test STextKeywordsInStatesAndRegions{
 		
 		feature Outlet{ 

+ 10 - 8
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/AllTestsTest.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2013 committers of YAKINDU and others.
+ * Copyright (c) 2014 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
@@ -15,12 +15,13 @@ import org.junit.runners.Suite;
 import org.junit.runners.Suite.SuiteClasses;
 
 @RunWith(Suite.class)
-@SuiteClasses({AlwaysOncycleTest.class, AssignmentAsExpressionTest.class,
+@SuiteClasses({ AlwaysOncycleTest.class, AssignmentAsExpressionTest.class,
 		BitExpressionsTest.class, BooleanExpressionsTest.class,
 		ChoiceTest.class, CKeywordsTest.class, DeclarationsTest.class,
-		DeepEntryTest.class, DeepHistoryTest.class, EnterStateTest.class,
-		EntryChoiceTest.class, ExitOnSelfTransitionTest.class,
-		ExitStateTest.class, GuardTest.class, GuardedEntryTest.class,
+		DeepEntryTest.class, DeepHistoryTest.class, DynamicChoiceTest.class,
+		EnterStateTest.class, EntryChoiceTest.class,
+		ExitOnSelfTransitionTest.class, ExitStateTest.class,
+		FeatureCallsTest.class, GuardTest.class, GuardedEntryTest.class,
 		GuardedExitTest.class, HistoryWithoutInitialStepTest.class,
 		InEventLifeCycleTest.class, IntegerExpressionsTest.class,
 		InternalEventLifeCycleTest.class, LogicalAndTestsTest.class,
@@ -30,8 +31,9 @@ import org.junit.runners.Suite.SuiteClasses;
 		SameNameDifferentRegionTest.class, ShallowHistoryTest.class,
 		SimpleEventTest.class, StatechartLocalReactionsTest.class,
 		SimpleHierachyTest.class, StateIsActiveTest.class,
-		STextKeywordsInStatesAndRegionsTest.class, StringExpressionsTest.class,
-		SyncForkTest.class, SyncJoinTest.class, TimedTransitionsTest.class,
-		TransitionWithoutConditionTest.class, ValuedEventsTest.class})
+		StaticChoiceTest.class, STextKeywordsInStatesAndRegionsTest.class,
+		StringExpressionsTest.class, SyncForkTest.class, SyncJoinTest.class,
+		TransitionWithoutConditionTest.class, ValuedEventsTest.class,
+		EntryChoiceTest.class })
 public class AllTestsTest {
 }

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

@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2014 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 DynamicChoice
+ */
+@SuppressWarnings("all")
+@RunWith(XtextRunner.class)
+@InjectWith(SExecInjectionProvider.class)
+public class DynamicChoiceTest extends AbstractExecutionFlowTest {
+	@Inject
+	private SCTUnitTestModels models;
+	@Before
+	public void setup() throws Exception {
+		ExecutionFlow flow = models
+				.loadExecutionFlowFromResource("DynamicChoice.sct");
+		initInterpreter(flow);
+	}
+	@Test
+	public void DynamicChoiceTest() throws Exception {
+		interpreter.enter();
+		assertTrue(isActive("Start"));
+		interpreter.runCycle();
+		assertTrue(isActive("A"));
+	}
+}

+ 44 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/StaticChoiceTest.java

@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2014 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 StaticChoice
+ */
+@SuppressWarnings("all")
+@RunWith(XtextRunner.class)
+@InjectWith(SExecInjectionProvider.class)
+public class StaticChoiceTest extends AbstractExecutionFlowTest {
+	@Inject
+	private SCTUnitTestModels models;
+	@Before
+	public void setup() throws Exception {
+		ExecutionFlow flow = models
+				.loadExecutionFlowFromResource("StaticChoice.sct");
+		initInterpreter(flow);
+	}
+	@Test
+	public void StaticChoiceTest() throws Exception {
+		interpreter.enter();
+		assertTrue(isActive("Start"));
+		interpreter.runCycle();
+	}
+}