Просмотр исходного кода

SVN chaos, recomiting missing files

malknet42 11 лет назад
Родитель
Сommit
aaf1d2be02

+ 19 - 0
test-plugins/org.yakindu.sct.generator.cpp.test/src/org/yakindu/sct/generator/cpp/test/AllTestsTestCustom.java

@@ -0,0 +1,19 @@
+/**
+ * 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.generator.cpp.test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({OperationsTestCustom.class})
+public class AllTestsTestCustom {
+}

+ 46 - 0
test-plugins/org.yakindu.sct.generator.cpp.test/src/org/yakindu/sct/generator/cpp/test/OperationsTestCustom.java

@@ -0,0 +1,46 @@
+/**
+ * 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.generator.cpp.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/OperationsTest/OperationsTestCustom.cc", program = "gtests/OperationsTest/Operations", model = "testmodels/SCTUnit/Operations.sct")
+@RunWith(GTestRunner.class)
+public class OperationsTestCustom {
+
+	protected final GTestHelper helper = new GTestHelper(this) {
+
+		@Override
+		protected void getTestDataFiles(Collection<String> files) {
+			super.getTestDataFiles(files);
+			files.add("gtests/OperationsTest/Operations_OCB.h");
+		}
+		
+		@Override
+		protected void getSourceFiles(Collection<String> files) {
+			super.getSourceFiles(files);
+			files.add(getFileName(getTestProgram()) + ".cpp");
+		}
+		
+	};
+
+	@Before
+	public void setUp() {
+		helper.generate();
+		helper.compile();
+	}
+}

+ 63 - 0
test-plugins/org.yakindu.sct.generator.java.test/src/org/yakindu/sct/generator/java/JavaSCTGeneratorTest.java

@@ -0,0 +1,63 @@
+/**
+ * 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.generator.java;
+
+import org.eclipse.core.resources.IMarker;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.yakindu.sct.generator.java.util.AbstractJavaGeneratorTest;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.test.models.SCTUnitTestModels;
+import org.yakindu.sct.test.models.TestModelInjectorProvider;
+
+/**
+ * These tests only check for compile errors, they don't check the behaviour of
+ * the generated Statemachine!
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+@RunWith(Parameterized.class)
+public class JavaSCTGeneratorTest extends AbstractJavaGeneratorTest {
+
+	private Statechart statechart;
+
+	@Before
+	public void setup() {
+		new TestModelInjectorProvider().getInjector().injectMembers(this);
+	}
+
+	public JavaSCTGeneratorTest(Statechart statechart) {
+		this.statechart = statechart;
+	}
+
+	@Parameters
+	public static Iterable<Object[]> testData() throws Exception {
+		return SCTUnitTestModels.parameterizedTestData();
+	}
+
+	@Test
+	public void testCompileStatechart() throws Exception {
+		IMarker[] marker = generateAndCompile(statechart);
+		for (IMarker diagnostic : marker) {
+			int severity = (Integer) diagnostic.getAttribute("severity");
+			if (severity == IMarker.SEVERITY_ERROR) {
+				Assert.fail("Unable to compile '" + statechart.getName() + "': "
+						+ diagnostic.getAttribute(IMarker.MESSAGE, ""));
+			}
+		}
+
+	}
+}

+ 20 - 0
test-plugins/org.yakindu.sct.generator.java.test/src/org/yakindu/sct/generator/java/test/AllTestsTestCustom.java

@@ -0,0 +1,20 @@
+/**
+ * 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.generator.java.test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.yakindu.sct.generator.java.JavaSCTGeneratorTest;
+
+@RunWith(Suite.class)
+@SuiteClasses({OperationsTestCustom.class, JavaSCTGeneratorTest.class})
+public class AllTestsTestCustom {
+}

+ 106 - 0
test-plugins/org.yakindu.sct.generator.java.test/src/org/yakindu/sct/generator/java/test/OperationsTestCustom.java

@@ -0,0 +1,106 @@
+/**
+ * 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.generator.java.test;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import org.yakindu.scr.operations.IOperationsStatemachine.SCIInterface1OperationCallback;
+import org.yakindu.scr.operations.IOperationsStatemachine.SCInterfaceOperationCallback;
+import org.yakindu.scr.operations.OperationsStatemachine;
+import org.yakindu.scr.operations.IOperationsStatemachine.InternalOperationCallback;
+import org.yakindu.scr.operations.OperationsStatemachine.State;
+/**
+ *  Unit TestCase for Operations
+ */
+@SuppressWarnings("all")
+public class OperationsTestCustom implements InternalOperationCallback, SCIInterface1OperationCallback, SCInterfaceOperationCallback{
+
+	private OperationsStatemachine statemachine;
+
+	private boolean internalOpration1visited = false;
+	private boolean interfaceOperation1visited = false;
+	private boolean unnamedInterfaceOperation1visited = false;
+	
+	@Before
+	public void setUp() {
+		statemachine = new OperationsStatemachine();
+		statemachine.init();
+		statemachine.setInternalOperationCallback(this);
+		statemachine.getSCInterface().setSCInterfaceOperationCallback(this);
+		statemachine.getSCIInterface1().setSCIInterface1OperationCallback(this);
+	}
+
+	@After
+	public void tearDown() {
+		statemachine = null;
+	}
+
+	@Test
+	public void testOperationsSimpleTest() {
+		statemachine.enter();
+		assertTrue(statemachine.isStateActive(State.main_region_A));
+		statemachine.runCycle();
+		assertTrue(statemachine.isStateActive(State.main_region_B));
+	}
+	
+	@Test
+	public void testOperationsTest() {
+		statemachine.enter();
+		assertTrue(statemachine.isStateActive(State.main_region_A));
+		statemachine.runCycle();
+		assertTrue(statemachine.isStateActive(State.main_region_B));
+		statemachine.raiseEv();
+		statemachine.runCycle();
+		assertTrue(statemachine.isStateActive(State.main_region_C));
+		statemachine.raiseEv();
+		statemachine.runCycle();
+		assertTrue(statemachine.isStateActive(State.main_region_D));
+		
+		// Operations used
+		assertTrue(interfaceOperation1visited && internalOpration1visited && unnamedInterfaceOperation1visited);
+	}
+
+	public void internalOperation1() {
+		internalOpration1visited = true;
+	}
+
+	public boolean internalOperation2(long param1) {
+		assertTrue(param1 == 4);		
+		return false;
+	}
+
+	public void interfaceOperation1() {
+		interfaceOperation1visited = true;		
+	}
+
+	public boolean interfaceOperation2(long param1) {
+		assertTrue(param1 == 4);	
+		return false;
+	}
+
+	public void unnamedInterfaceOperation1() {
+		unnamedInterfaceOperation1visited = true;
+	}
+
+	public boolean unnamedInterfaceOperation2(long param1) {
+		assertTrue(param1 == 4);	
+		return false;
+	}
+
+	public boolean alwaysTrue() {
+		return true;
+	}
+}

+ 98 - 0
test-plugins/org.yakindu.sct.generator.java.test/src/org/yakindu/sct/generator/java/util/AbstractJavaGeneratorTest.java

@@ -0,0 +1,98 @@
+/**
+ * Copyright (c) 2012 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.java.util;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IJavaModelMarker;
+import org.yakindu.sct.generator.core.util.GeneratorUtils;
+import org.yakindu.sct.generator.java.JavaCodeGenerator;
+import org.yakindu.sct.model.sgen.FeatureConfiguration;
+import org.yakindu.sct.model.sgen.FeatureParameter;
+import org.yakindu.sct.model.sgen.FeatureParameterValue;
+import org.yakindu.sct.model.sgen.FeatureType;
+import org.yakindu.sct.model.sgen.GeneratorEntry;
+import org.yakindu.sct.model.sgen.SGenFactory;
+import org.yakindu.sct.model.sgraph.Statechart;
+
+import com.google.inject.Inject;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public abstract class AbstractJavaGeneratorTest {
+
+	private static final String SRC_GEN = "src-gen";
+	private static final String TARGET_PROJECT = "targetProject";
+	private static final String CONTENT_TYPE = "statechart";
+	private static final String OUTLET_FEATURE = "Outlet";
+	private static final String TARGET_FOLDER = "targetFolder";
+
+	@Inject
+	protected JavaCodeGenerator generator;
+
+	public IMarker[] generateAndCompile(Statechart statechart) throws Exception {
+		GeneratorEntry entry = createGeneratorEntry(statechart.getName(),
+				SRC_GEN);
+		entry.setElementRef(statechart);
+		IProject targetProject = GeneratorUtils.getTargetProject(entry);
+		targetProject.delete(true, new NullProgressMonitor());
+		generator.generate(entry);
+		targetProject.getWorkspace().build(
+				IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
+		targetProject = GeneratorUtils.getTargetProject(entry);
+		if (!targetProject.exists()) {
+			targetProject.create(new NullProgressMonitor());
+			targetProject.open(new NullProgressMonitor());
+		}
+		targetProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD,
+				new NullProgressMonitor());
+		IMarker[] markers = targetProject.findMarkers(
+				IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, true,
+				IResource.DEPTH_INFINITE);
+		return markers;
+	}
+
+	private GeneratorEntry createGeneratorEntry(String targetProject,
+			String targetFolder) {
+		GeneratorEntry entry = SGenFactory.eINSTANCE.createGeneratorEntry();
+		entry.setContentType(CONTENT_TYPE);
+		FeatureConfiguration config = SGenFactory.eINSTANCE
+				.createFeatureConfiguration();
+		FeatureType type = SGenFactory.eINSTANCE.createFeatureType();
+		type.setName(OUTLET_FEATURE);
+		config.setType(type);
+		FeatureParameterValue project = SGenFactory.eINSTANCE
+				.createFeatureParameterValue();
+		FeatureParameter projectParameter = SGenFactory.eINSTANCE
+				.createFeatureParameter();
+		projectParameter.setName(TARGET_PROJECT);
+		project.setParameter(projectParameter);
+		project.setValue(targetProject);
+		config.getParameterValues().add(project);
+		FeatureParameterValue targetFolderValue = SGenFactory.eINSTANCE
+				.createFeatureParameterValue();
+		FeatureParameter targetParameter = SGenFactory.eINSTANCE
+				.createFeatureParameter();
+		targetParameter.setName(TARGET_FOLDER);
+		targetFolderValue.setParameter(targetParameter);
+		targetFolderValue.setValue(targetFolder);
+		config.getParameterValues().add(targetFolderValue);
+		entry.getFeatures().add(config);
+		return entry;
+	}
+
+}

Разница между файлами не показана из-за своего большого размера
+ 1220 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/src/org/yakindu/sct/model/sexec/interpreter/test/CoreFunctionTest.java


+ 553 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/src/org/yakindu/sct/model/sexec/interpreter/test/STextInterpreterTest.java

@@ -0,0 +1,553 @@
+/**
+ * Copyright (c) 2010 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.model.sexec.interpreter.test;
+
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.xtext.junit4.InjectWith;
+import org.eclipse.xtext.junit4.XtextRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.yakindu.base.expressions.expressions.Expression;
+import org.yakindu.base.types.ITypeSystem;
+import org.yakindu.base.types.InferredType;
+import org.yakindu.sct.model.sgraph.Scope;
+import org.yakindu.sct.model.stext.test.util.AbstractSTextTest;
+import org.yakindu.sct.model.stext.test.util.STextInjectorProvider;
+import org.yakindu.sct.simulation.core.sexec.interpreter.IStatementInterpreter;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionEvent;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionVariable;
+import org.yakindu.sct.simulation.core.sruntime.impl.ExecutionEventImpl;
+import org.yakindu.sct.simulation.core.sruntime.impl.ExecutionVariableImpl;
+
+import com.google.inject.Inject;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+@RunWith(XtextRunner.class)
+@InjectWith(STextInjectorProvider.class)
+public class STextInterpreterTest extends AbstractSTextTest {
+
+	@Inject
+	private ExecutionContext context;
+	@Inject
+	private IStatementInterpreter interpreter;
+	@Inject
+	private ITypeSystem typeSystem;
+
+	@Test
+	public void testIntVariableAssignment() {
+		executeWithDefaultScope("intVar = 42");
+		assertEquals(42L, getIntValue());
+	}
+
+	@Test
+	public void testHexVariableAssignment() {
+		executeWithDefaultScope("intVar = 0xFF");
+		assertEquals(0xFF, getIntValue());
+	}
+
+	@Test
+	public void testBoolTrueVariableAssignment() {
+		executeWithDefaultScope("boolVar = true");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testBoolFalseVariableAssignment() {
+		executeWithDefaultScope("boolVar = false");
+		assertEquals(false, getContext().getVariable("boolVar").getValue());
+	}
+
+	@Test
+	public void testRealVariableAssignment() {
+		executeWithDefaultScope("realVar = 42.0");
+		assertEquals(42.0d, getContext().getVariable("realVar").getValue());
+	}
+
+	@Test
+	public void testStringVariableAssignment() {
+		executeWithDefaultScope("stringVar = 'fortytwo'");
+		assertEquals("fortytwo", getStringValue());
+	}
+
+	@Test
+	public void testStringNullAssignment() {
+		executeWithDefaultScope("stringVar = null");
+		assertEquals(null, getStringValue());
+	}
+
+	@Test
+	public void testConditionalTrue() {
+		executeWithDefaultScope("intVar = true ? 42 : 1");
+		assertEquals(42L, getIntValue());
+	}
+
+	@Test
+	public void testConditionalFalse() {
+		executeWithDefaultScope("intVar = false ? 42 : 1");
+		assertEquals(1L, getIntValue());
+	}
+
+	@Test
+	public void testNestedExpression() {
+		executeWithDefaultScope("intVar = (1 + 1) * 2");
+		assertEquals(4L, getIntValue());
+	}
+
+	@Test
+	public void testBooleanOr() {
+		executeWithDefaultScope("boolVar = true || false");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testBooleanAnd() {
+		executeWithDefaultScope("boolVar = true && false");
+		assertEquals(false, getContext().getVariable("boolVar").getValue());
+	}
+
+	@Test
+	public void testBitwiseXor() {
+		executeWithDefaultScope("intVar = 0xF0F0 ^ 0xFF00");
+		assertEquals(0x0FF0, getContext().getVariable("intVar").getValue());
+
+	}
+
+	@Test
+	public void testBitwiseOr() {
+		executeWithDefaultScope("intVar = 0xF0F0 | 0xFFFF");
+		assertEquals(0xFFFF, getContext().getVariable("intVar").getValue());
+	}
+
+	@Test
+	public void testBitwiseAnd() {
+		executeWithDefaultScope("intVar = 0xF0F0 & 0xFFFF");
+		assertEquals(0x0F0F0, getContext().getVariable("intVar").getValue());
+	}
+
+	@Test
+	public void testBoolEqual() {
+		executeWithDefaultScope("boolVar = false == false");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testIntEqual() {
+		executeWithDefaultScope("boolVar = 1 == 1");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testRealEqual() {
+		executeWithDefaultScope("boolVar = 1.0f == 1.0f");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testStringEqual() {
+		executeWithDefaultScope("boolVar = 'string' == 'string'");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testBoolNotEqual() {
+		executeWithDefaultScope("boolVar = true != false");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testIntNotEqual() {
+		executeWithDefaultScope("boolVar = 1 != 2");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testRealNotEqual() {
+		executeWithDefaultScope("boolVar = 1.0f != 2.0f");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testStringNotEqual() {
+		executeWithDefaultScope("boolVar = 'string' != 'string2'");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testIntGreaterEqual() {
+		executeWithDefaultScope("boolVar = 2 >= 1");
+		assertEquals(true, getBoolValue());
+
+	}
+
+	@Test
+	public void testRealGreaterEqual() {
+		executeWithDefaultScope("boolVar = 2.0f >= 2.0f");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testIntSmallerEqual() {
+		executeWithDefaultScope("boolVar = 1 <= 2");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testRealSmallerEqual() {
+		executeWithDefaultScope("boolVar = 2.0f <= 2.0f");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testIntGreater() {
+		executeWithDefaultScope("boolVar = 2 > 1");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testRealGreater() {
+		executeWithDefaultScope("boolVar = 2.1f > 2.0f");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testIntSmaller() {
+		executeWithDefaultScope("boolVar = 1 < 2");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testRealSmaller() {
+		executeWithDefaultScope("boolVar = 2.0f < 2.1f");
+		assertEquals(true, getBoolValue());
+	}
+
+	@Test
+	public void testIntPositive() {
+		executeWithDefaultScope("intVar = + 1");
+		assertEquals(1L, getIntValue());
+		executeWithDefaultScope("intVar = +2");
+		assertEquals(2L, getIntValue());
+	}
+
+	@Test
+	public void testRealPositive() {
+		executeWithDefaultScope("realVar = +1.0");
+		assertEquals(1.0d, getRealValue());
+	}
+
+	@Test
+	public void testIntNegative() {
+		executeWithDefaultScope("intVar = - 1");
+		assertEquals(-1L, getIntValue());
+		executeWithDefaultScope("intVar = -2");
+		assertEquals(-2L, getIntValue());
+
+	}
+
+	@Test
+	public void testRealNegative() {
+		executeWithDefaultScope("realVar = -1.0f");
+		assertEquals(-1.0d, getRealValue());
+	}
+
+	@Test
+	public void testIntPlus() {
+		executeWithDefaultScope("intVar = 42 + 1");
+		assertEquals(43L, getIntValue());
+	}
+
+	@Test
+	public void testRealPlus() {
+		executeWithDefaultScope("realVar = 42.0 + 1.0");
+		assertEquals(43.0d, getRealValue());
+	}
+
+	@Test
+	public void testIntMinus() {
+		executeWithDefaultScope("intVar = 42 - 1");
+		assertEquals(41L, getIntValue());
+	}
+
+	@Test
+	public void testRealMinus() {
+		executeWithDefaultScope("realVar = 42.0f - 1.0f");
+		assertEquals(41.0d, getRealValue());
+	}
+
+	@Test
+	public void testIntMultiply() {
+		executeWithDefaultScope("intVar = 42 * 2");
+		assertEquals(84L, getIntValue());
+	}
+
+	@Test
+	public void testRealMultiply() {
+		executeWithDefaultScope("realVar = 42.0f * 2.0f");
+		assertEquals(84.0d, getRealValue());
+	}
+
+	@Test
+	public void testIntDivide() {
+		executeWithDefaultScope("intVar = 42 / 2");
+		assertEquals(21L, getIntValue());
+	}
+
+	@Test
+	public void testRealDivide() {
+		executeWithDefaultScope("realVar = 42.0f / 2.0f");
+		assertEquals(21.0d, getRealValue());
+	}
+
+	@Test
+	public void testIntModulo() {
+		executeWithDefaultScope("intVar = 42 % 2");
+		assertEquals(0L, getIntValue());
+	}
+
+	@Test
+	public void testRealModulo() {
+		executeWithDefaultScope("realVar = 42.0f % 2.0f");
+		assertEquals(0.0d, getRealValue());
+	}
+
+	@Test
+	public void testIntLeft() {
+		executeWithDefaultScope("intVar = 42 << 2");
+		assertEquals(168L, getIntValue());
+	}
+
+	@Test
+	public void testIntRight() {
+		executeWithDefaultScope("intVar = 42 >> 2");
+		assertEquals(10L, getIntValue());
+	}
+
+	@Test
+	public void testIntAnd() {
+		executeWithDefaultScope("intVar= 9 & 12");
+		assertEquals(8L, getIntValue());
+	}
+
+	@Test
+	public void testIntXor() {
+		executeWithDefaultScope("intVar= 9 ^ 12");
+		assertEquals(5L, getIntValue());
+	}
+
+	@Test
+	public void testIntOr() {
+		executeWithDefaultScope("intVar= 9 | 12");
+		assertEquals(13L, getIntValue());
+	}
+
+	@Test
+	public void testIntBitComplement() {
+		executeWithDefaultScope("intVar= ~9");
+		assertEquals(-10L, getIntValue());
+	}
+
+	@Test
+	public void testNot() {
+		executeWithDefaultScope("boolVar = ! true");
+		assertEquals(false, getBoolValue());
+	}
+
+	@Test
+	public void testPrirority() {
+		executeWithDefaultScope("intVar = 1 + 2 * 3");
+		assertEquals(7L, getIntValue());
+	}
+
+	@Test
+	public void testNested() {
+		executeWithDefaultScope("intVar = (1 + 2) * 3");
+		assertEquals(9L, getIntValue());
+	}
+
+	@Test
+	public void testIntPlusAssign() {
+		executeWithDefaultScope("intVar=42");
+		executeWithDefaultScope("intVar+=42");
+		assertEquals(84L, getIntValue());
+	}
+
+	@Test
+	public void testRealPlusAssign() {
+		executeWithDefaultScope("realVar = 42.0");
+		executeWithDefaultScope("realVar+=42.0");
+		assertEquals(84.0d, getRealValue());
+	}
+
+	@Test
+	public void testIntMinusAssign() {
+		executeWithDefaultScope("intVar=42");
+		executeWithDefaultScope("intVar-=10");
+		assertEquals(32L, getIntValue());
+	}
+
+	@Test
+	public void testRealMinusAssign() {
+		executeWithDefaultScope("realVar=42.0f");
+		executeWithDefaultScope("realVar-=10.0");
+		assertEquals(32.0d, getRealValue());
+	}
+
+	@Test
+	public void testIntMultAssign() {
+		executeWithDefaultScope("intVar=42");
+		executeWithDefaultScope("intVar*=1");
+		assertEquals(42L, getIntValue());
+	}
+
+	@Test
+	public void testRealMultAssign() {
+		executeWithDefaultScope("realVar=42.0f");
+		executeWithDefaultScope("realVar*=1.0");
+		assertEquals(42.0d, getRealValue());
+	}
+
+	@Test
+	public void testIntDivAssign() {
+		executeWithDefaultScope("intVar=42");
+		executeWithDefaultScope("intVar/=1");
+		assertEquals(42L, getIntValue());
+	}
+
+	@Test
+	public void testRealDivAssign() {
+		executeWithDefaultScope("realVar=42.0f");
+		executeWithDefaultScope("realVar/=1.0f");
+		assertEquals(42.0d, getRealValue());
+	}
+
+	@Test
+	public void testIntModAssign() {
+		executeWithDefaultScope("intVar=42");
+		executeWithDefaultScope("intVar%=1");
+		assertEquals(0L, getIntValue());
+	}
+
+	@Test
+	public void testRealModAssign() {
+		executeWithDefaultScope("realVar=42.0f");
+		executeWithDefaultScope("realVar%=1.0f");
+		assertEquals(0.0d, getRealValue());
+	}
+
+	@Test
+	public void testPlainTrue() {
+		assertEquals(true, executeExpression("", "true"));
+	}
+
+	@Test
+	public void testPlainFalse() {
+		assertEquals(false, executeExpression("", "false"));
+	}
+
+	// Convenience...
+
+	@Before
+	public void setup() {
+		initContext();
+	}
+
+	private void initContext() {
+		// "event abc operation foo() var intVar : integer var boolVar : boolean
+		// var realVar : real
+		ExecutionVariable intVar = new ExecutionVariableImpl();
+		intVar.setName("intVar");
+		intVar.setFqName("intVar");
+		intVar.setType(new InferredType(typeSystem.getIntegerType()));
+		intVar.setValue(0);
+		context.getSlots().add(intVar);
+
+		ExecutionVariable boolVar = new ExecutionVariableImpl();
+		boolVar.setName("boolVar");
+		boolVar.setFqName("boolVar");
+		boolVar.setType(new InferredType(typeSystem.getBooleanType()));
+		boolVar.setValue(false);
+		context.getSlots().add(boolVar);
+
+		ExecutionVariable realVar = new ExecutionVariableImpl();
+		realVar.setName("realVar");
+		realVar.setFqName("realVar");
+		realVar.setType(new InferredType(typeSystem.getRealType()));
+		realVar.setValue(0.0f);
+		context.getSlots().add(realVar);
+
+		ExecutionVariable stringVar = new ExecutionVariableImpl();
+		stringVar.setName("stringVar");
+		stringVar.setFqName("stringVar");
+		stringVar.setType(new InferredType(typeSystem.getStringType()));
+		stringVar.setValue("");
+		context.getSlots().add(stringVar);
+
+		ExecutionEvent event = new ExecutionEventImpl();
+		event.setName("abc");
+		event.setFqName("abc");
+		event.setType(new InferredType(typeSystem.getIntegerType()));
+		context.getSlots().add(event);
+	}
+
+	protected Object getBoolValue() {
+		return context.getVariable("boolVar").getValue();
+	}
+
+	protected Object getIntValue() {
+		return context.getVariable("intVar").getValue();
+	}
+
+	protected Object getRealValue() {
+		return context.getVariable("realVar").getValue();
+	}
+
+	protected Object getStringValue() {
+		return context.getVariable("stringVar").getValue();
+	}
+
+	protected Object executeWithDefaultScope(String expression) {
+		Scope defaultScope = internalScope();
+		Expression statement = (Expression) parseExpression(expression,
+				defaultScope, Expression.class.getSimpleName());
+		return interpreter.evaluateStatement(statement, context);
+	}
+
+	protected Object execute(String scope, String expression) {
+		Scope defaultScope = createInternalScope(scope);
+		Expression statement = (Expression) parseExpression(expression,
+				defaultScope, Expression.class.getSimpleName());
+		return interpreter.evaluateStatement(statement, context);
+	}
+
+	protected Object executeExpression(String scope, String expression) {
+		Scope defaultScope = createInternalScope(scope);
+		Expression statement = (Expression) parseExpression(expression,
+				defaultScope, Expression.class.getSimpleName());
+		return interpreter.evaluateStatement(statement, context);
+	}
+
+	public ExecutionContext getContext() {
+		return context;
+	}
+
+	@After
+	public void tearDown() {
+		context = null;
+	}
+}

+ 126 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/src/org/yakindu/sct/model/sexec/interpreter/test/util/AbstractExecutionFlowTest.java

@@ -0,0 +1,126 @@
+/**
+ * Copyright (c) 2012 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.model.sexec.interpreter.test.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sgraph.RegularState;
+import org.yakindu.sct.simulation.core.sexec.container.IExecutionContextInitializer;
+import org.yakindu.sct.simulation.core.sexec.interpreter.IExecutionFlowInterpreter;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionContext;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionVariable;
+import org.yakindu.sct.test.models.SCTUnitTestModels;
+
+import com.google.inject.Inject;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public abstract class AbstractExecutionFlowTest {
+	@Inject
+	protected IExecutionFlowInterpreter interpreter;
+	@Inject
+	protected SCTUnitTestModels models;
+	@Inject
+	protected ExecutionContext context;
+	@Inject
+	protected IExecutionContextInitializer initializer;
+
+	protected ExecutionContext context() {
+		return context;
+	}
+
+	protected void initInterpreter(ExecutionFlow flow) {
+		initializer.initialize(context, flow);
+		interpreter.initialize(flow, context);
+	}
+
+	protected long getInteger(String varName) {
+		ExecutionVariable variable = context().getVariable(varName);
+		return (Long) variable.getValue();
+	}
+
+	protected boolean getBoolean(String varName) {
+		ExecutionVariable variable = context().getVariable(varName);
+		return (Boolean) variable.getValue();
+	}
+
+	protected Float getReal(String varName) {
+		ExecutionVariable variable = context().getVariable(varName);
+		return (Float) variable.getValue();
+	}
+
+	protected String getString(String varName) {
+		ExecutionVariable variable = context().getVariable(varName);
+		return (String) variable.getValue();
+	}
+
+	protected long setInteger(String varName, long v) {
+		context().getVariable(varName).setValue((Long) v);
+		return v;
+	}
+
+	protected boolean setBoolean(String varName, boolean v) {
+		context().getVariable(varName).setValue((Boolean) v);
+		return v;
+	}
+
+	protected double setReal(String varName, double v) {
+		context().getVariable(varName).setValue((Double) v);
+		return v;
+	}
+
+	protected String setString(String varName, String v) {
+		context().getVariable(varName).setValue((String) v);
+		return v;
+	}
+
+	// -> Assertion methods...
+	protected void assertVarValue(String variableName, Object value) {
+		ExecutionVariable variable = context().getVariable(variableName);
+		assertNotNull("Variable '" + variableName + "' is not defined",
+				variable);
+		assertEquals(value, variable.getValue());
+	}
+
+	protected boolean isActive(String stateName) {
+		Assert.isNotNull(stateName);
+		List<RegularState> allActiveStates = context().getAllActiveStates();
+		for (RegularState regularState : allActiveStates) {
+			if (stateName.equals(regularState.getName())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	protected void raiseEvent(String eventName) {
+		context().getEvent(eventName).setRaised(true);
+	}
+
+	protected void raiseEvent(String eventName, Object value) {
+		context().getEvent(eventName).setValue(value);
+		context().getEvent(eventName).setRaised(true);
+
+	}
+
+	protected boolean isRaised(String eventName) {
+		return context().getEvent(eventName).isRaised();
+	}
+
+}

+ 32 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/src/org/yakindu/sct/model/sexec/interpreter/test/util/SExecInjectionProvider.java

@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2012 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.model.sexec.interpreter.test.util;
+
+import org.eclipse.xtext.junit4.IInjectorProvider;
+import org.yakindu.sct.model.sexec.transformation.SequencerModule;
+import org.yakindu.sct.simulation.core.sexec.SimulationModule;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.util.Modules;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class SExecInjectionProvider implements IInjectorProvider {
+
+	public Injector getInjector() {
+		return Guice.createInjector(Modules.override(new SequencerModule()).with(new SimulationModule()));
+	}
+
+}