Преглед изворни кода

[YAKHMI-1146] Enriched CastExpression test

malknet42 пре 11 година
родитељ
комит
3ed296950e
17 измењених фајлова са 120 додато и 2331 уклоњено
  1. 3 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/CastExpressions/CastExpressions.cc
  2. 3 0
      test-plugins/org.yakindu.sct.generator.cpp.test/gtests/CastExpressionsTest/CastExpressionsTest.cc
  3. 0 19
      test-plugins/org.yakindu.sct.generator.cpp.test/src/org/yakindu/sct/generator/cpp/test/AllTestsTestCustom.java
  4. 0 46
      test-plugins/org.yakindu.sct.generator.cpp.test/src/org/yakindu/sct/generator/cpp/test/OperationsTestCustom.java
  5. 27 1
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/castexpressions/CastExpressionsStatemachine.java
  6. 0 63
      test-plugins/org.yakindu.sct.generator.java.test/src/org/yakindu/sct/generator/java/JavaSCTGeneratorTest.java
  7. 0 20
      test-plugins/org.yakindu.sct.generator.java.test/src/org/yakindu/sct/generator/java/test/AllTestsTestCustom.java
  8. 0 106
      test-plugins/org.yakindu.sct.generator.java.test/src/org/yakindu/sct/generator/java/test/OperationsTestCustom.java
  9. 0 98
      test-plugins/org.yakindu.sct.generator.java.test/src/org/yakindu/sct/generator/java/util/AbstractJavaGeneratorTest.java
  10. 3 0
      test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/CastExpressionsTest.java
  11. 0 1220
      test-plugins/org.yakindu.sct.simulation.core.sexec.test/src/org/yakindu/sct/model/sexec/interpreter/test/CoreFunctionTest.java
  12. 0 553
      test-plugins/org.yakindu.sct.simulation.core.sexec.test/src/org/yakindu/sct/model/sexec/interpreter/test/STextInterpreterTest.java
  13. 0 126
      test-plugins/org.yakindu.sct.simulation.core.sexec.test/src/org/yakindu/sct/model/sexec/interpreter/test/util/AbstractExecutionFlowTest.java
  14. 0 32
      test-plugins/org.yakindu.sct.simulation.core.sexec.test/src/org/yakindu/sct/model/sexec/interpreter/test/util/SExecInjectionProvider.java
  15. 47 44
      test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/CastExpressionsTest.java
  16. 33 3
      test-plugins/org.yakindu.sct.test.models/testmodels/SCTUnit/CastExpressions.sct
  17. 4 0
      test-plugins/org.yakindu.sct.test.models/tests/CastExpressions.sctunit

+ 3 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/CastExpressions/CastExpressions.cc

@@ -22,6 +22,9 @@ TEST(StatemachineTest, CastExpressionTest) {
 	EXPECT_TRUE(castExpressionsIface_get_intValue(&handle) == 5);
 	castExpressions_runCycle(&handle);
 	EXPECT_TRUE(castExpressionsIface_get_realValue(&handle) == 15);
+	castExpressions_runCycle(&handle);
+	EXPECT_TRUE(castExpressions_isActive(&handle, CastExpressions_main_region_C));
+	EXPECT_TRUE(castExpressionsIface_get_realValue(&handle) == 757);
 }
 
 		

+ 3 - 0
test-plugins/org.yakindu.sct.generator.cpp.test/gtests/CastExpressionsTest/CastExpressionsTest.cc

@@ -20,5 +20,8 @@ TEST(StatemachineTest, CastExpressionTest) {
 	EXPECT_TRUE(statechart->getDefaultSCI()->get_intValue()== 5);
 	statechart->runCycle();
 	EXPECT_TRUE(statechart->getDefaultSCI()->get_realValue()== 15);
+	statechart->runCycle();
+	EXPECT_TRUE(statechart->isActive(CastExpressions::main_region_C));
+	EXPECT_TRUE(statechart->getDefaultSCI()->get_realValue()== 757);
 	delete statechart;
 }

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

@@ -1,19 +0,0 @@
-/**
- * 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 {
-}

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

@@ -1,46 +0,0 @@
-/**
- * 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();
-	}
-}

+ 27 - 1
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/castexpressions/CastExpressionsStatemachine.java

@@ -31,7 +31,7 @@ public class CastExpressionsStatemachine
 	private SCInterfaceImpl sCInterface;
 
 	public enum State {
-		main_region_A, main_region_B, $NullState$
+		main_region_A, main_region_B, main_region_C, $NullState$
 	};
 
 	private final State[] stateVector = new State[1];
@@ -75,6 +75,11 @@ public class CastExpressionsStatemachine
 				stateVector[0] = State.$NullState$;
 				break;
 
+			case main_region_C :
+				nextStateIndex = 0;
+				stateVector[0] = State.$NullState$;
+				break;
+
 			default :
 				break;
 		}
@@ -104,6 +109,8 @@ public class CastExpressionsStatemachine
 				return stateVector[0] == State.main_region_A;
 			case main_region_B :
 				return stateVector[0] == State.main_region_B;
+			case main_region_C :
+				return stateVector[0] == State.main_region_C;
 			default :
 				return false;
 		}
@@ -149,6 +156,22 @@ public class CastExpressionsStatemachine
 
 	/* The reactions of state B. */
 	private void reactMain_region_B() {
+		if (true
+				&& ((double) (sCInterface.realValue * 0.1)) > ((long) 1.4)
+				&& ((long) (sCInterface.realValue * sCInterface.intValue)) < ((double) 100)) {
+			nextStateIndex = 0;
+			stateVector[0] = State.$NullState$;
+
+			sCInterface.realValue = ((long) (sCInterface.realValue
+					* sCInterface.intValue * 10.1));
+
+			nextStateIndex = 0;
+			stateVector[0] = State.main_region_C;
+		}
+	}
+
+	/* The reactions of state C. */
+	private void reactMain_region_C() {
 	}
 
 	public void runCycle() {
@@ -164,6 +187,9 @@ public class CastExpressionsStatemachine
 				case main_region_B :
 					reactMain_region_B();
 					break;
+				case main_region_C :
+					reactMain_region_C();
+					break;
 				default :
 					// $NullState$
 			}

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

@@ -1,63 +0,0 @@
-/**
- * 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, ""));
-			}
-		}
-
-	}
-}

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

@@ -1,20 +0,0 @@
-/**
- * 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 {
-}

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

@@ -1,106 +0,0 @@
-/**
- * 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;
-	}
-}

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

@@ -1,98 +0,0 @@
-/**
- * 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;
-	}
-
-}

+ 3 - 0
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/CastExpressionsTest.java

@@ -43,5 +43,8 @@ public class CastExpressionsTest {
 		assertTrue(statemachine.getIntValue() == 5);
 		statemachine.runCycle();
 		assertTrue(statemachine.getRealValue() == 15);
+		statemachine.runCycle();
+		assertTrue(statemachine.isStateActive(State.main_region_C));
+		assertTrue(statemachine.getRealValue() == 757);
 	}
 }

Разлика између датотеке није приказан због своје велике величине
+ 0 - 1220
test-plugins/org.yakindu.sct.simulation.core.sexec.test/src/org/yakindu/sct/model/sexec/interpreter/test/CoreFunctionTest.java


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

@@ -1,553 +0,0 @@
-/**
- * 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;
-	}
-}

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

@@ -1,126 +0,0 @@
-/**
- * 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();
-	}
-
-}

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

@@ -1,32 +0,0 @@
-/**
- * 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()));
-	}
-
-}

+ 47 - 44
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/CastExpressionsTest.java

@@ -1,44 +1,47 @@
-/**
- * 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 CastExpressions
- */
-@SuppressWarnings("all")
-@RunWith(XtextRunner.class)
-@InjectWith(SExecInjectionProvider.class)
-public class CastExpressionsTest extends AbstractExecutionFlowTest {
-	@Before
-	public void setup() throws Exception {
-		ExecutionFlow flow = models
-				.loadExecutionFlowFromResource("CastExpressions.sct");
-		initInterpreter(flow);
-	}
-	@Test
-	public void CastExpressionTest() throws Exception {
-		interpreter.enter();
-		assertTrue(getReal("realValue") == 5);
-		assertTrue(getInteger("intValue") == 5);
-		interpreter.runCycle();
-		assertTrue(getReal("realValue") == 15);
-	}
-}
+/**
+ * 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 CastExpressions
+ */
+@SuppressWarnings("all")
+@RunWith(XtextRunner.class)
+@InjectWith(SExecInjectionProvider.class)
+public class CastExpressionsTest extends AbstractExecutionFlowTest {
+	@Before
+	public void setup() throws Exception {
+		ExecutionFlow flow = models
+				.loadExecutionFlowFromResource("CastExpressions.sct");
+		initInterpreter(flow);
+	}
+	@Test
+	public void CastExpressionTest() throws Exception {
+		interpreter.enter();
+		assertTrue(getReal("realValue") == 5);
+		assertTrue(getInteger("intValue") == 5);
+		interpreter.runCycle();
+		assertTrue(getReal("realValue") == 15);
+		interpreter.runCycle();
+		assertTrue(isActive("C"));
+		assertTrue(getReal("realValue") == 757);
+	}
+}

+ 33 - 3
test-plugins/org.yakindu.sct.test.models/testmodels/SCTUnit/CastExpressions.sct

@@ -8,7 +8,10 @@
       <vertices xsi:type="sgraph:State" xmi:id="_Ws2YRyfYEeSpK_WCONv8UQ" specification="" name="A" incomingTransitions="_Ws3mYyfYEeSpK_WCONv8UQ">
         <outgoingTransitions xmi:id="_myT_8CfYEeSpK_WCONv8UQ" specification="always" target="_mA7mUCfYEeSpK_WCONv8UQ"/>
       </vertices>
-      <vertices xsi:type="sgraph:State" xmi:id="_mA7mUCfYEeSpK_WCONv8UQ" specification="entry / realValue = 3 *  5.5 as integer" name="B" incomingTransitions="_myT_8CfYEeSpK_WCONv8UQ"/>
+      <vertices xsi:type="sgraph:State" xmi:id="_mA7mUCfYEeSpK_WCONv8UQ" specification="entry / realValue = 3 *  5.5 as integer" name="B" incomingTransitions="_myT_8CfYEeSpK_WCONv8UQ">
+        <outgoingTransitions xmi:id="_tlUsYDG-EeS_kOAaYKgcxg" specification="always [(realValue * 0.1) as real > 1.4 as integer&#xD;&#xA;&#x9;&amp;&amp; (realValue * intValue) as integer &lt; 100 as real]" target="_tRqJgDG-EeS_kOAaYKgcxg"/>
+      </vertices>
+      <vertices xsi:type="sgraph:State" xmi:id="_tRqJgDG-EeS_kOAaYKgcxg" specification="entry / realValue = (realValue * intValue * 10.1) as integer" name="C" incomingTransitions="_tlUsYDG-EeS_kOAaYKgcxg"/>
     </regions>
   </sgraph:Statechart>
   <notation:Diagram xmi:id="_WsxfwCfYEeSpK_WCONv8UQ" type="org.yakindu.sct.ui.editor.editor.StatechartDiagramEditor" element="_Wsw4sCfYEeSpK_WCONv8UQ" measurementUnit="Pixel">
@@ -62,10 +65,26 @@
           <styles xsi:type="notation:BooleanValueStyle" xmi:id="_mA9bhyfYEeSpK_WCONv8UQ" name="isHorizontal" booleanValue="true"/>
           <layoutConstraint xsi:type="notation:Bounds" xmi:id="_mA80cyfYEeSpK_WCONv8UQ" x="178" y="80" width="222" height="63"/>
         </children>
+        <children xmi:id="_tSfP8DG-EeS_kOAaYKgcxg" type="State" element="_tRqJgDG-EeS_kOAaYKgcxg">
+          <children xsi:type="notation:DecorationNode" xmi:id="_tSi6UDG-EeS_kOAaYKgcxg" type="StateName">
+            <styles xsi:type="notation:ShapeStyle" xmi:id="_tSi6UTG-EeS_kOAaYKgcxg"/>
+            <layoutConstraint xsi:type="notation:Location" xmi:id="_tSi6UjG-EeS_kOAaYKgcxg"/>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_tSjhYDG-EeS_kOAaYKgcxg" type="StateTextCompartment">
+            <children xsi:type="notation:Shape" xmi:id="_tSjhYTG-EeS_kOAaYKgcxg" type="StateTextCompartmentExpression" fontName="Verdana" lineColor="4210752">
+              <layoutConstraint xsi:type="notation:Bounds" xmi:id="_tSjhYjG-EeS_kOAaYKgcxg"/>
+            </children>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_tSkIcDG-EeS_kOAaYKgcxg" type="StateFigureCompartment"/>
+          <styles xsi:type="notation:ShapeStyle" xmi:id="_tSfP8TG-EeS_kOAaYKgcxg" fontName="Verdana" fillColor="15981773" lineColor="12632256"/>
+          <styles xsi:type="notation:FontStyle" xmi:id="_tSfP8jG-EeS_kOAaYKgcxg"/>
+          <styles xsi:type="notation:BooleanValueStyle" xmi:id="_tSkIcTG-EeS_kOAaYKgcxg" name="isHorizontal" booleanValue="true"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_tSfP8zG-EeS_kOAaYKgcxg" x="178" y="292" width="205"/>
+        </children>
         <layoutConstraint xsi:type="notation:Bounds" xmi:id="_Ws1KJCfYEeSpK_WCONv8UQ"/>
       </children>
       <styles xsi:type="notation:ShapeStyle" xmi:id="_WszU8SfYEeSpK_WCONv8UQ" fontName="Verdana" fillColor="15790320" lineColor="12632256"/>
-      <layoutConstraint xsi:type="notation:Bounds" xmi:id="_Ws1xMCfYEeSpK_WCONv8UQ" x="220" y="10" width="436" height="400"/>
+      <layoutConstraint xsi:type="notation:Bounds" xmi:id="_Ws1xMCfYEeSpK_WCONv8UQ" x="290" y="10" width="436" height="422"/>
     </children>
     <children xsi:type="notation:Shape" xmi:id="_Ws40gCfYEeSpK_WCONv8UQ" type="StatechartText" fontName="Verdana" lineColor="4210752">
       <children xsi:type="notation:DecorationNode" xmi:id="_Ws40gifYEeSpK_WCONv8UQ" type="StatechartName">
@@ -75,7 +94,7 @@
       <children xsi:type="notation:Shape" xmi:id="_Ws40hSfYEeSpK_WCONv8UQ" type="StatechartTextExpression" fontName="Verdana" lineColor="4210752">
         <layoutConstraint xsi:type="notation:Bounds" xmi:id="_Ws40hifYEeSpK_WCONv8UQ"/>
       </children>
-      <layoutConstraint xsi:type="notation:Bounds" xmi:id="_Ws40hyfYEeSpK_WCONv8UQ" x="10" y="10" width="200" height="400"/>
+      <layoutConstraint xsi:type="notation:Bounds" xmi:id="_Ws40hyfYEeSpK_WCONv8UQ" x="10" y="10" width="262" height="422"/>
     </children>
     <styles xsi:type="notation:DiagramStyle" xmi:id="_WsxfwSfYEeSpK_WCONv8UQ"/>
     <edges xmi:id="_Ws4NcCfYEeSpK_WCONv8UQ" type="Transition" element="_Ws3mYyfYEeSpK_WCONv8UQ" source="_Ws1xMifYEeSpK_WCONv8UQ" target="_Ws2_UCfYEeSpK_WCONv8UQ">
@@ -96,5 +115,16 @@
       <styles xsi:type="notation:FontStyle" xmi:id="_myXDQCfYEeSpK_WCONv8UQ" fontName="Verdana"/>
       <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_myWcMifYEeSpK_WCONv8UQ" points="[18, -5, -106, -3]$[119, -26, -5, -24]"/>
     </edges>
+    <edges xmi:id="_tlWhkDG-EeS_kOAaYKgcxg" type="Transition" element="_tlUsYDG-EeS_kOAaYKgcxg" source="_mA80cCfYEeSpK_WCONv8UQ" target="_tSfP8DG-EeS_kOAaYKgcxg">
+      <children xsi:type="notation:DecorationNode" xmi:id="_tlXIoDG-EeS_kOAaYKgcxg" type="TransitionExpression">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_tlXIoTG-EeS_kOAaYKgcxg"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_tlXIojG-EeS_kOAaYKgcxg" x="-18" y="186"/>
+      </children>
+      <styles xsi:type="notation:ConnectorStyle" xmi:id="_tlWhkTG-EeS_kOAaYKgcxg" lineColor="4210752"/>
+      <styles xsi:type="notation:FontStyle" xmi:id="_tlWhkzG-EeS_kOAaYKgcxg" fontName="Verdana"/>
+      <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_tlWhkjG-EeS_kOAaYKgcxg" points="[-14, 29, 79, -149]$[-89, 168, 4, -10]"/>
+      <sourceAnchor xsi:type="notation:IdentityAnchor" xmi:id="_g_wPwDJ-EeSzIOuhY1zG5A" id="(0.8828828828828829,0.9523809523809523)"/>
+      <targetAnchor xsi:type="notation:IdentityAnchor" xmi:id="_tlY90DG-EeS_kOAaYKgcxg" id="(0.9365853658536586,0.09090909090909091)"/>
+    </edges>
   </notation:Diagram>
 </xmi:XMI>

+ 4 - 0
test-plugins/org.yakindu.sct.test.models/tests/CastExpressions.sctunit

@@ -7,6 +7,10 @@ testgroup CastExpressions for statechart CastExpressions{
 		assert intValue == 5
 		cycle
 		assert realValue == 15
+		cycle
+		assert active(CastExpressions.main_region.C)
+		
+		assert realValue == 757
 	} 
 }