Explorar o código

changed Name of TimeTrigger Tests, added DeepEntry and EntryChoice Test, updated AllTests

malknet42 %!s(int64=12) %!d(string=hai) anos
pai
achega
95107edc51

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

@@ -19,19 +19,19 @@ import org.junit.runners.Suite.SuiteClasses;
 		BitExpressionsTest.class, BooleanExpressionsTest.class,
 		ChoiceTest.class, CKeywordsTest.class, DeclarationsTest.class,
 		DeepEntryTest.class, DeepHistoryTest.class, EnterStateTest.class,
-		ExitOnSelfTransitionTest.class, ExitStateTest.class, GuardTest.class,
-		GuardedEntryTest.class, GuardedExitTest.class,
-		HistoryWithoutInitialStepTest.class, InEventLifeCycleTest.class,
-		IntegerExpressionsTest.class, InternalEventLifeCycleTest.class,
-		LogicalAndTestsTest.class, LogicalOrTestsTest.class,
-		NamedInterfaceAccessTest.class, OutEventLifeCycleTest.class,
-		ParenthesisTest.class, PriorityValuesTest.class, RaiseEventTest.class,
+		EntryChoiceTest.class, ExitOnSelfTransitionTest.class,
+		ExitStateTest.class, GuardTest.class, GuardedEntryTest.class,
+		GuardedExitTest.class, HistoryWithoutInitialStepTest.class,
+		InEventLifeCycleTest.class, IntegerExpressionsTest.class,
+		InternalEventLifeCycleTest.class, LogicalAndTestsTest.class,
+		LogicalOrTestsTest.class, NamedInterfaceAccessTest.class,
+		OutEventLifeCycleTest.class, ParenthesisTest.class,
+		PriorityValuesTest.class, RaiseEventTest.class,
 		SameNameDifferentRegionTest.class, ShallowHistoryTest.class,
 		SimpleEventTest.class, StatechartLocalReactionsTest.class,
 		SimpleHierachyTest.class, StateIsActiveTest.class,
 		STextKeywordsInStatesAndRegionsTest.class, StringExpressionsTest.class,
-		SyncForkTest.class, SyncJoinTest.class,
-		TransitionWithoutConditionTest.class, ValuedEventsTest.class,
-		EntryChoiceTest.class})
+		SyncForkTest.class, SyncJoinTest.class, TimedTransitionsTest.class,
+		TransitionWithoutConditionTest.class, ValuedEventsTest.class})
 public class AllTestsTest {
 }

+ 58 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/DeepEntryTest.java

@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2013 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 DeepEntry
+ */
+@SuppressWarnings("all")
+@RunWith(XtextRunner.class)
+@InjectWith(SExecInjectionProvider.class)
+public class DeepEntryTest extends AbstractExecutionFlowTest {
+	@Inject
+	private SCTUnitTestModels models;
+	@Before
+	public void setup() throws Exception {
+		ExecutionFlow flow = models
+				.loadExecutionFlowFromResource("DeepEntry.sct");
+		initInterpreter(flow);
+	}
+	@Test
+	public void enterToSubstate() throws Exception {
+		assertTrue(getInteger("x") == 0);
+		assertTrue(getInteger("y") == 0);
+		assertTrue(getInteger("z") == 0);
+		interpreter.enter();
+		assertTrue(getInteger("x") == 1);
+		assertTrue(getInteger("y") == 1);
+		assertTrue(getInteger("z") == 2);
+		raiseEvent("e");
+		interpreter.runCycle();
+		assertTrue(isActive("BB"));
+		raiseEvent("f");
+		interpreter.runCycle();
+		assertTrue(isActive("C"));
+		raiseEvent("f");
+		interpreter.runCycle();
+		assertTrue(isActive("BB"));
+		assertTrue(getInteger("y") == 1);
+	}
+}

+ 8 - 5
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/TimeTriggerTest.java

@@ -21,22 +21,25 @@ import org.yakindu.sct.test.models.SCTUnitTestModels;
 import com.google.inject.Inject;
 import static org.junit.Assert.assertTrue;
 /**
- *  Unit TestCase for TimeTrigger
+ *  Unit TestCase for EntryChoice
  */
 @SuppressWarnings("all")
 @RunWith(XtextRunner.class)
 @InjectWith(SExecInjectionProvider.class)
-public class TimeTriggerTest extends AbstractExecutionFlowTest {
+public class EntryChoiceTest extends AbstractExecutionFlowTest {
 	@Inject
 	private SCTUnitTestModels models;
 	@Before
 	public void setup() throws Exception {
 		ExecutionFlow flow = models
-				.loadExecutionFlowFromResource("TimeTrigger.sct");
+				.loadExecutionFlowFromResource("EntryChoice.sct");
 		initInterpreter(flow);
 	}
 	@Test
-	public void TestName() throws Exception {
-		assertTrue(true);
+	public void EntryChoiceTest() throws Exception {
+		interpreter.enter();
+		interpreter.runCycle();
+		interpreter.runCycle();
+		assertTrue(isActive("A"));
 	}
 }

+ 46 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/TimedTransitionsTest.java

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