Selaa lähdekoodia

added const only scope test cases for interpreter

Axel Terfloth 9 vuotta sitten
vanhempi
commit
7a5267f8c0

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

@@ -0,0 +1,30 @@
+GeneratorModel for sctunit::interpreter {
+	
+	test ConstOnlyDefaultScope {
+		
+		feature Outlet {
+			targetProject = "org.yakindu.sct.simulation.core.sexec.test"
+			targetFolder = "test-gen"
+		}
+		
+	}
+	
+	test ConstOnlyInternalScope {
+		
+		feature Outlet {
+			targetProject = "org.yakindu.sct.simulation.core.sexec.test"
+			targetFolder = "test-gen"
+		}
+		
+	}
+	
+	test ConstOnlyNamedScope {
+		
+		feature Outlet {
+			targetProject = "org.yakindu.sct.simulation.core.sexec.test"
+			targetFolder = "test-gen"
+		}
+		
+	}
+	
+}

+ 47 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/ConstOnlyDefaultScopeTest.java

@@ -0,0 +1,47 @@
+/**
+* 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 ConstOnlyDefaultScope
+ */
+@SuppressWarnings("all")
+@RunWith(XtextRunner.class)
+@InjectWith(SExecInjectionProvider.class)
+public class ConstOnlyDefaultScopeTest extends AbstractExecutionFlowTest {
+	@Before
+	public void setup() throws Exception {
+		ExecutionFlow flow = models.loadExecutionFlowFromResource("declarations/ConstOnlyDefaultScope.sct");
+		initInterpreter(flow);
+	}
+	@Test
+	public void statechartEntry() throws Exception {
+		interpreter.enter();
+		assertTrue(isStateActive("A"));
+	}
+	@Test
+	public void stateTransition() throws Exception {
+		interpreter.enter();
+		raiseEvent("A.e", 1l);
+		interpreter.runCycle();
+		assertTrue(isStateActive("B"));
+	}
+}

+ 47 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/ConstOnlyInternalScopeTest.java

@@ -0,0 +1,47 @@
+/**
+* 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 ConstOnlyInternalScope
+ */
+@SuppressWarnings("all")
+@RunWith(XtextRunner.class)
+@InjectWith(SExecInjectionProvider.class)
+public class ConstOnlyInternalScopeTest extends AbstractExecutionFlowTest {
+	@Before
+	public void setup() throws Exception {
+		ExecutionFlow flow = models.loadExecutionFlowFromResource("declarations/ConstOnlyInternalScope.sct");
+		initInterpreter(flow);
+	}
+	@Test
+	public void statechartEntry() throws Exception {
+		interpreter.enter();
+		assertTrue(isStateActive("A"));
+	}
+	@Test
+	public void stateTransition() throws Exception {
+		interpreter.enter();
+		raiseEvent("e", 1l);
+		interpreter.runCycle();
+		assertTrue(isStateActive("B"));
+	}
+}

+ 47 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/ConstOnlyNamedScopeTest.java

@@ -0,0 +1,47 @@
+/**
+* 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 ConstOnlyNamedScope
+ */
+@SuppressWarnings("all")
+@RunWith(XtextRunner.class)
+@InjectWith(SExecInjectionProvider.class)
+public class ConstOnlyNamedScopeTest extends AbstractExecutionFlowTest {
+	@Before
+	public void setup() throws Exception {
+		ExecutionFlow flow = models.loadExecutionFlowFromResource("declarations/ConstOnlyNamedScope.sct");
+		initInterpreter(flow);
+	}
+	@Test
+	public void statechartEntry() throws Exception {
+		interpreter.enter();
+		assertTrue(isStateActive("A"));
+	}
+	@Test
+	public void stateTransition() throws Exception {
+		interpreter.enter();
+		raiseEvent("e", 1l);
+		interpreter.runCycle();
+		assertTrue(isStateActive("B"));
+	}
+}