Browse Source

added ReadOnlyVariable tests

bohl 10 years ago
parent
commit
a770f88151
20 changed files with 826 additions and 22 deletions
  1. 42 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ReadOnlyVariable/ReadOnlyVariable.cc
  2. 19 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ReadOnlyVariable/ReadOnlyVariable.sgen
  3. 24 0
      test-plugins/org.yakindu.sct.generator.c.test/model/test.sgen
  4. 4 3
      test-plugins/org.yakindu.sct.generator.c.test/test-gen/org/yakindu/sct/generator/c/test/AllTests.java
  5. 39 0
      test-plugins/org.yakindu.sct.generator.c.test/test-gen/org/yakindu/sct/generator/c/test/ReadOnlyVariable.java
  6. 24 0
      test-plugins/org.yakindu.sct.generator.cpp.test/model/test.sgen
  7. 7 6
      test-plugins/org.yakindu.sct.generator.cpp.test/test-gen/org/yakindu/sct/generator/cpp/test/AllTestsTest.java
  8. 39 0
      test-plugins/org.yakindu.sct.generator.cpp.test/test-gen/org/yakindu/sct/generator/cpp/test/ReadOnlyVariableTest.java
  9. 24 0
      test-plugins/org.yakindu.sct.generator.java.test/model/model.sgen
  10. 8 0
      test-plugins/org.yakindu.sct.generator.java.test/model/test.sgen
  11. 25 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/readonlyvariable/IReadOnlyVariableStatemachine.java
  12. 296 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/readonlyvariable/ReadOnlyVariableStatemachine.java
  13. 7 6
      test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/AllTestsTest.java
  14. 62 0
      test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/ReadOnlyVariableTest.java
  15. 9 1
      test-plugins/org.yakindu.sct.simulation.core.sexec.test/model/test.sgen
  16. 7 6
      test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/AllTestsTest.java
  17. 59 0
      test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/ReadOnlyVariableTest.java
  18. 98 0
      test-plugins/org.yakindu.sct.test.models/testmodels/SCTUnit/ReadOnlyVariable.sct
  19. 1 0
      test-plugins/org.yakindu.sct.test.models/tests/AllTests.sctunit
  20. 32 0
      test-plugins/org.yakindu.sct.test.models/tests/ReadOnlyVariable.sctunit

+ 42 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/ReadOnlyVariable/ReadOnlyVariable.cc

@@ -0,0 +1,42 @@
+/**
+* Copyright (c) 2015 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
+*/
+#include <string>
+#include "gtest/gtest.h"
+#include "ReadOnlyVariable.h"
+
+
+ReadOnlyVariable handle;
+
+TEST(StatemachineTest, ReadOnlyVariableTest) {
+	readOnlyVariable_init(&handle);
+	readOnlyVariable_enter(&handle);
+	EXPECT_TRUE(readOnlyVariable_isStateActive(&handle, ReadOnlyVariable_main_region_StateA));
+	EXPECT_TRUE(readOnlyVariableIface_get_myInt(&handle) == 0l);
+	EXPECT_TRUE(strcmp(readOnlyVariableIface_get_myString(&handle) , "testString") == 0);
+	EXPECT_TRUE(readOnlyVariableIface_get_myBool(&handle) == true);
+	EXPECT_TRUE(readOnlyVariableIface_get_myReal(&handle) == 1.1d);
+	EXPECT_TRUE(readOnlyVariableIfaceA_get_myInt(&handle) == 0l);
+	EXPECT_TRUE(strcmp(readOnlyVariableIfaceA_get_myString(&handle) , "testString") == 0);
+	EXPECT_TRUE(readOnlyVariableIfaceA_get_myBool(&handle) == true);
+	EXPECT_TRUE(readOnlyVariableIfaceA_get_myReal(&handle) == 1.1d);
+	readOnlyVariable_runCycle(&handle);
+	EXPECT_TRUE(readOnlyVariable_isStateActive(&handle, ReadOnlyVariable_main_region_StateB));
+	EXPECT_TRUE(readOnlyVariableIface_get_myInt(&handle) == 100l);
+	EXPECT_TRUE(strcmp(readOnlyVariableIface_get_myString(&handle) , "fail") == 0);
+	EXPECT_TRUE(readOnlyVariableIface_get_myBool(&handle) == false);
+	EXPECT_TRUE(readOnlyVariableIface_get_myReal(&handle) == 6.6d);
+	EXPECT_TRUE(readOnlyVariableIfaceA_get_myInt(&handle) == 200l);
+	EXPECT_TRUE(strcmp(readOnlyVariableIfaceA_get_myString(&handle) , "A_fail") == 0);
+	EXPECT_TRUE(readOnlyVariableIfaceA_get_myBool(&handle) == false);
+	EXPECT_TRUE(readOnlyVariableIfaceA_get_myReal(&handle) == 7.7d);
+}
+
+		

+ 19 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/ReadOnlyVariable/ReadOnlyVariable.sgen

@@ -0,0 +1,19 @@
+GeneratorModel for yakindu::c {
+	statechart ReadOnlyVariable {
+		feature Outlet {
+			targetProject = "gtests"
+			targetFolder = "ReadOnlyVariable"
+		}
+		feature FunctionInlining {
+			inlineReactions = false
+			inlineEntryActions = false
+			inlineEnterSequences = false 
+			inlineExitActions = false
+			inlineExitSequences = false
+			inlineChoices = false
+			inlineEntries = false
+			inlineEnterRegion = false
+			inlineExitRegion = false
+		}
+	}
+}

+ 24 - 0
test-plugins/org.yakindu.sct.generator.c.test/model/test.sgen

@@ -915,6 +915,30 @@ GeneratorModel for sctunit::c {
 			inlineEntries = false
 		}		
 	}	
+		
+	test ReadOnlyVariable{
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.generator.c.test" 
+			targetFolder = "test-gen"			
+		}		
+				
+		feature JUnitWrapper {
+			WrapToJUnit =  "true" 
+		}		
+		
+		feature FunctionInlining {
+			inlineReactions = false
+			inlineEntryActions = false
+			inlineExitActions = false
+			inlineEnterSequences = false
+			inlineExitSequences = false
+			inlineChoices = false
+			inlineEnterRegion = false
+			inlineExitRegion = false
+			inlineEntries = false
+		}		
+	}	
 	
 	test RaiseEvent{
 		

+ 4 - 3
test-plugins/org.yakindu.sct.generator.c.test/test-gen/org/yakindu/sct/generator/c/test/AllTests.java

@@ -27,9 +27,10 @@ import org.junit.runners.Suite.SuiteClasses;
 		InternalEventLifeCycle.class, LocalReactions.class,
 		LogicalAndTests.class, LogicalOrTests.class,
 		NamedInterfaceAccess.class, OutEventLifeCycle.class, Parenthesis.class,
-		PriorityValues.class, RaiseEvent.class, SameNameDifferentRegion.class,
-		ShallowHistory.class, ShallowHistoryWithDeepEntry.class,
-		SimpleEvent.class, SimpleHierachy.class, StatechartActive.class,
+		PriorityValues.class, RaiseEvent.class, ReadOnlyVariable.class,
+		SameNameDifferentRegion.class, ShallowHistory.class,
+		ShallowHistoryWithDeepEntry.class, SimpleEvent.class,
+		SimpleHierachy.class, StatechartActive.class,
 		StatechartLocalReactions.class, StateIsActive.class,
 		StaticChoice.class, STextKeywordsInStatesAndRegions.class,
 		StringExpressions.class, SyncFork.class, SyncJoin.class,

+ 39 - 0
test-plugins/org.yakindu.sct.generator.c.test/test-gen/org/yakindu/sct/generator/c/test/ReadOnlyVariable.java

@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2015 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.c.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/ReadOnlyVariable/ReadOnlyVariable.cc", program = "gtests/ReadOnlyVariable/ReadOnlyVariable", model = "testmodels/SCTUnit/ReadOnlyVariable.sct")
+@RunWith(GTestRunner.class)
+public class ReadOnlyVariable {
+
+	protected final GTestHelper helper = new GTestHelper(this) {
+
+		@Override
+		protected void getSourceFiles(Collection<String> files) {
+			super.getSourceFiles(files);
+			files.add(getFileName(getTestProgram()) + ".c");
+		}
+	};
+
+	@Before
+	public void setUp() {
+		helper.generate();
+		helper.compile();
+	}
+}

+ 24 - 0
test-plugins/org.yakindu.sct.generator.cpp.test/model/test.sgen

@@ -937,6 +937,30 @@ GeneratorModel for sctunit::cpp {
 			inlineEntries = false
 		}			
 	}
+	
+		test ReadOnlyVariable{
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.generator.cpp.test" 
+			targetFolder = "test-gen"			
+		}		
+		
+		feature JUnitWrapper {
+			WrapToJUnit =  "true"
+		}		
+				
+		feature FunctionInlining {
+			inlineReactions = false
+			inlineEntryActions = false
+			inlineExitActions = false
+			inlineEnterSequences = false
+			inlineExitSequences = false
+			inlineChoices = false
+			inlineEnterRegion = false
+			inlineExitRegion = false
+			inlineEntries = false
+		}			
+	}
 		
 	test SameNameDifferentRegion{
 		

+ 7 - 6
test-plugins/org.yakindu.sct.generator.cpp.test/test-gen/org/yakindu/sct/generator/cpp/test/AllTestsTest.java

@@ -30,12 +30,13 @@ import org.junit.runners.Suite.SuiteClasses;
 		LogicalAndTestsTest.class, LogicalOrTestsTest.class,
 		NamedInterfaceAccessTest.class, OutEventLifeCycleTest.class,
 		ParenthesisTest.class, PriorityValuesTest.class, RaiseEventTest.class,
-		SameNameDifferentRegionTest.class, ShallowHistoryTest.class,
-		ShallowHistoryWithDeepEntryTest.class, SimpleEventTest.class,
-		SimpleHierachyTest.class, StatechartActiveTest.class,
-		StatechartLocalReactionsTest.class, StateIsActiveTest.class,
-		StaticChoiceTest.class, STextKeywordsInStatesAndRegionsTest.class,
-		StringExpressionsTest.class, SyncForkTest.class, SyncJoinTest.class,
+		ReadOnlyVariableTest.class, SameNameDifferentRegionTest.class,
+		ShallowHistoryTest.class, ShallowHistoryWithDeepEntryTest.class,
+		SimpleEventTest.class, SimpleHierachyTest.class,
+		StatechartActiveTest.class, StatechartLocalReactionsTest.class,
+		StateIsActiveTest.class, StaticChoiceTest.class,
+		STextKeywordsInStatesAndRegionsTest.class, StringExpressionsTest.class,
+		SyncForkTest.class, SyncJoinTest.class,
 		TransitionWithoutConditionTest.class,
 		TriggerGuardExpressionsTest.class, ValuedEventsTest.class})
 public class AllTestsTest {

+ 39 - 0
test-plugins/org.yakindu.sct.generator.cpp.test/test-gen/org/yakindu/sct/generator/cpp/test/ReadOnlyVariableTest.java

@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2015 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/ReadOnlyVariableTest/ReadOnlyVariableTest.cc", program = "gtests/ReadOnlyVariableTest/ReadOnlyVariable", model = "testmodels/SCTUnit/ReadOnlyVariable.sct")
+@RunWith(GTestRunner.class)
+public class ReadOnlyVariableTest {
+
+	protected final GTestHelper helper = new GTestHelper(this) {
+
+		@Override
+		protected void getSourceFiles(Collection<String> files) {
+			super.getSourceFiles(files);
+			files.add(getFileName(getTestProgram()) + ".cpp");
+		}
+	};
+
+	@Before
+	public void setUp() {
+		helper.generate();
+		helper.compile();
+	}
+}

+ 24 - 0
test-plugins/org.yakindu.sct.generator.java.test/model/model.sgen

@@ -1013,6 +1013,30 @@ GeneratorModel for yakindu::java {
 		}
 	}
 	
+	statechart ReadOnlyVariable {
+		feature Outlet {
+			targetProject = "org.yakindu.sct.generator.java.test"
+			targetFolder = "src-gen"
+		}
+
+		feature GeneralFeatures {
+			TimerService = true
+			RuntimeService = true
+		}		
+			
+		feature FunctionInlining {
+			inlineReactions = false
+			inlineEntryActions = false
+			inlineExitActions = false
+			inlineEnterSequences = false
+			inlineExitSequences = false
+			inlineChoices = false
+			inlineEnterRegion = false
+			inlineExitRegion = false
+			inlineEntries = false
+		}
+	}
+	
 	statechart RealExpressions {
 		feature Outlet {
 			targetProject = "org.yakindu.sct.generator.java.test"

+ 8 - 0
test-plugins/org.yakindu.sct.generator.java.test/model/test.sgen

@@ -321,7 +321,15 @@ GeneratorModel for sctunit::java {
 			targetFolder = "test-gen"			
 		}			
 	}
+	
+	test ReadOnlyVariable{
 		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.generator.java.test" 
+			targetFolder = "test-gen"			
+		}			
+	}
+			
 	test SameNameDifferentRegion{
 		
 		feature Outlet{ 

+ 25 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/readonlyvariable/IReadOnlyVariableStatemachine.java

@@ -0,0 +1,25 @@
+package org.yakindu.scr.readonlyvariable;
+import org.yakindu.scr.IStatemachine;
+
+public interface IReadOnlyVariableStatemachine extends IStatemachine {
+	public interface SCInterface {
+		public long getMyInt();
+		public String getMyString();
+		public boolean getMyBool();
+		public double getMyReal();
+
+	}
+
+	public SCInterface getSCInterface();
+
+	public interface SCIA {
+		public long getMyInt();
+		public String getMyString();
+		public boolean getMyBool();
+		public double getMyReal();
+
+	}
+
+	public SCIA getSCIA();
+
+}

+ 296 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/readonlyvariable/ReadOnlyVariableStatemachine.java

@@ -0,0 +1,296 @@
+package org.yakindu.scr.readonlyvariable;
+
+public class ReadOnlyVariableStatemachine
+		implements
+			IReadOnlyVariableStatemachine {
+
+	private final class SCInterfaceImpl implements SCInterface {
+
+		private long myInt;
+		public long getMyInt() {
+			return myInt;
+		}
+
+		private String myString;
+		public String getMyString() {
+			return myString;
+		}
+
+		private boolean myBool;
+		public boolean getMyBool() {
+			return myBool;
+		}
+
+		private double myReal;
+		public double getMyReal() {
+			return myReal;
+		}
+
+	}
+
+	private SCInterfaceImpl sCInterface;
+	private final class SCIAImpl implements SCIA {
+
+		private long myInt;
+		public long getMyInt() {
+			return myInt;
+		}
+
+		private String myString;
+		public String getMyString() {
+			return myString;
+		}
+
+		private boolean myBool;
+		public boolean getMyBool() {
+			return myBool;
+		}
+
+		private double myReal;
+		public double getMyReal() {
+			return myReal;
+		}
+
+	}
+
+	private SCIAImpl sCIA;
+
+	public enum State {
+		main_region_StateB, main_region_StateA, $NullState$
+	};
+
+	private final State[] stateVector = new State[1];
+
+	private int nextStateIndex;
+
+	public ReadOnlyVariableStatemachine() {
+
+		sCInterface = new SCInterfaceImpl();
+		sCIA = new SCIAImpl();
+	}
+
+	public void init() {
+		for (int i = 0; i < 1; i++) {
+			stateVector[i] = State.$NullState$;
+		}
+
+		clearEvents();
+		clearOutEvents();
+
+		sCInterface.myInt = 0;
+
+		sCInterface.myString = "testString";
+
+		sCInterface.myBool = true;
+
+		sCInterface.myReal = 1.1;
+
+		sCIA.myInt = 0;
+
+		sCIA.myString = "testString";
+
+		sCIA.myBool = true;
+
+		sCIA.myReal = 1.1;
+	}
+
+	public void enter() {
+		entryAction();
+
+		enterSequence_main_region_default();
+	}
+
+	public void exit() {
+		exitSequence_main_region();
+
+		exitAction();
+	}
+
+	/**
+	 * @see IStatemachine#isActive()
+	 */
+	@Override
+	public boolean isActive() {
+
+		return stateVector[0] != State.$NullState$;
+	}
+
+	/** 
+	 * Always returns 'false' since this state machine can never become final.
+	 *
+	 * @see IStatemachine#isFinal() 
+	 */
+	@Override
+	public boolean isFinal() {
+		return false;
+	}
+
+	/**
+	 * This method resets the incoming events (time events included).
+	 */
+	protected void clearEvents() {
+
+	}
+
+	/**
+	 * This method resets the outgoing events.
+	 */
+	protected void clearOutEvents() {
+	}
+
+	/**
+	 * Returns true if the given state is currently active otherwise false.
+	 */
+	public boolean isStateActive(State state) {
+		switch (state) {
+			case main_region_StateB :
+				return stateVector[0] == State.main_region_StateB;
+			case main_region_StateA :
+				return stateVector[0] == State.main_region_StateA;
+			default :
+				return false;
+		}
+	}
+
+	public SCInterface getSCInterface() {
+		return sCInterface;
+	}
+	public SCIA getSCIA() {
+		return sCIA;
+	}
+
+	public long getMyInt() {
+		return sCInterface.getMyInt();
+	}
+
+	public String getMyString() {
+		return sCInterface.getMyString();
+	}
+
+	public boolean getMyBool() {
+		return sCInterface.getMyBool();
+	}
+
+	public double getMyReal() {
+		return sCInterface.getMyReal();
+	}
+
+	private boolean check_main_region_StateA_tr0_tr0() {
+		return true;
+	}
+
+	private void effect_main_region_StateA_tr0() {
+		exitSequence_main_region_StateA();
+
+		enterSequence_main_region_StateB_default();
+	}
+
+	/* Entry action for statechart 'ReadOnlyVariable'. */
+	private void entryAction() {
+	}
+
+	/* Entry action for state 'StateB'. */
+	private void entryAction_main_region_StateB() {
+		sCInterface.myInt = 100;
+
+		sCInterface.myString = "fail";
+
+		sCInterface.myBool = false;
+
+		sCInterface.myReal = 6.6;
+
+		sCIA.myInt = 200;
+
+		sCIA.myString = "A_fail";
+
+		sCIA.myBool = false;
+
+		sCIA.myReal = 7.7;
+	}
+
+	/* Exit action for state 'ReadOnlyVariable'. */
+	private void exitAction() {
+	}
+
+	/* 'default' enter sequence for state StateB */
+	private void enterSequence_main_region_StateB_default() {
+		entryAction_main_region_StateB();
+
+		nextStateIndex = 0;
+		stateVector[0] = State.main_region_StateB;
+	}
+
+	/* 'default' enter sequence for state StateA */
+	private void enterSequence_main_region_StateA_default() {
+		nextStateIndex = 0;
+		stateVector[0] = State.main_region_StateA;
+	}
+
+	/* 'default' enter sequence for region main region */
+	private void enterSequence_main_region_default() {
+		react_main_region__entry_Default();
+	}
+
+	/* Default exit sequence for state StateB */
+	private void exitSequence_main_region_StateB() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+
+	/* Default exit sequence for state StateA */
+	private void exitSequence_main_region_StateA() {
+		nextStateIndex = 0;
+		stateVector[0] = State.$NullState$;
+	}
+
+	/* Default exit sequence for region main region */
+	private void exitSequence_main_region() {
+		switch (stateVector[0]) {
+			case main_region_StateB :
+				exitSequence_main_region_StateB();
+				break;
+
+			case main_region_StateA :
+				exitSequence_main_region_StateA();
+				break;
+
+			default :
+				break;
+		}
+	}
+
+	/* The reactions of state StateB. */
+	private void react_main_region_StateB() {
+	}
+
+	/* The reactions of state StateA. */
+	private void react_main_region_StateA() {
+		effect_main_region_StateA_tr0();
+	}
+
+	/* Default react sequence for initial entry  */
+	private void react_main_region__entry_Default() {
+		enterSequence_main_region_StateA_default();
+	}
+
+	public void runCycle() {
+
+		clearOutEvents();
+
+		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
+
+			switch (stateVector[nextStateIndex]) {
+				case main_region_StateB :
+					react_main_region_StateB();
+					break;
+				case main_region_StateA :
+					react_main_region_StateA();
+					break;
+				default :
+					// $NullState$
+			}
+		}
+
+		clearEvents();
+	}
+}

+ 7 - 6
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/AllTestsTest.java

@@ -30,12 +30,13 @@ import org.junit.runners.Suite.SuiteClasses;
 		LogicalAndTestsTest.class, LogicalOrTestsTest.class,
 		NamedInterfaceAccessTest.class, OutEventLifeCycleTest.class,
 		ParenthesisTest.class, PriorityValuesTest.class, RaiseEventTest.class,
-		SameNameDifferentRegionTest.class, ShallowHistoryTest.class,
-		ShallowHistoryWithDeepEntryTest.class, SimpleEventTest.class,
-		SimpleHierachyTest.class, StatechartActiveTest.class,
-		StatechartLocalReactionsTest.class, StateIsActiveTest.class,
-		StaticChoiceTest.class, STextKeywordsInStatesAndRegionsTest.class,
-		StringExpressionsTest.class, SyncForkTest.class, SyncJoinTest.class,
+		ReadOnlyVariableTest.class, SameNameDifferentRegionTest.class,
+		ShallowHistoryTest.class, ShallowHistoryWithDeepEntryTest.class,
+		SimpleEventTest.class, SimpleHierachyTest.class,
+		StatechartActiveTest.class, StatechartLocalReactionsTest.class,
+		StateIsActiveTest.class, StaticChoiceTest.class,
+		STextKeywordsInStatesAndRegionsTest.class, StringExpressionsTest.class,
+		SyncForkTest.class, SyncJoinTest.class,
 		TransitionWithoutConditionTest.class,
 		TriggerGuardExpressionsTest.class, ValuedEventsTest.class})
 public class AllTestsTest {

+ 62 - 0
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/ReadOnlyVariableTest.java

@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2015 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.readonlyvariable.ReadOnlyVariableStatemachine;
+import org.yakindu.scr.readonlyvariable.ReadOnlyVariableStatemachine.State;
+/**
+ *  Unit TestCase for ReadOnlyVariable
+ */
+@SuppressWarnings("all")
+public class ReadOnlyVariableTest {
+
+	private ReadOnlyVariableStatemachine statemachine;
+
+	@Before
+	public void setUp() {
+		statemachine = new ReadOnlyVariableStatemachine();
+		statemachine.init();
+	}
+
+	@After
+	public void tearDown() {
+		statemachine = null;
+	}
+
+	@Test
+	public void testReadOnlyVariableTest() {
+		statemachine.enter();
+		assertTrue(statemachine.isStateActive(State.main_region_StateA));
+		assertTrue(statemachine.getMyInt() == 0l);
+		assertTrue(statemachine.getMyString().equals("testString"));
+		assertTrue(statemachine.getMyBool() == true);
+		assertTrue(statemachine.getMyReal() == 1.1d);
+		assertTrue(statemachine.getSCIA().getMyInt() == 0l);
+		assertTrue(statemachine.getSCIA().getMyString().equals("testString"));
+		assertTrue(statemachine.getSCIA().getMyBool() == true);
+		assertTrue(statemachine.getSCIA().getMyReal() == 1.1d);
+		statemachine.runCycle();
+		assertTrue(statemachine.isStateActive(State.main_region_StateB));
+		assertTrue(statemachine.getMyInt() == 100l);
+		assertTrue(statemachine.getMyString().equals("fail"));
+		assertTrue(statemachine.getMyBool() == false);
+		assertTrue(statemachine.getMyReal() == 6.6d);
+		assertTrue(statemachine.getSCIA().getMyInt() == 200l);
+		assertTrue(statemachine.getSCIA().getMyString().equals("A_fail"));
+		assertTrue(statemachine.getSCIA().getMyBool() == false);
+		assertTrue(statemachine.getSCIA().getMyReal() == 7.7d);
+	}
+}

+ 9 - 1
test-plugins/org.yakindu.sct.simulation.core.sexec.test/model/test.sgen

@@ -312,8 +312,16 @@ GeneratorModel for sctunit::interpreter {
 			targetProject = "org.yakindu.sct.simulation.core.sexec.test" 
 			targetFolder = "test-gen"			
 		}			
-	}	
+	}
 	
+	test ReadOnlyVariable{
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.simulation.core.sexec.test" 
+			targetFolder = "test-gen"			
+		}			
+	}
+			
 	test RaiseEvent{
 		
 		feature Outlet{ 

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

@@ -31,12 +31,13 @@ import org.junit.runners.Suite.SuiteClasses;
 		LogicalAndTestsTest.class, LogicalOrTestsTest.class,
 		NamedInterfaceAccessTest.class, OutEventLifeCycleTest.class,
 		ParenthesisTest.class, PriorityValuesTest.class, RaiseEventTest.class,
-		SameNameDifferentRegionTest.class, ShallowHistoryTest.class,
-		ShallowHistoryWithDeepEntryTest.class, SimpleEventTest.class,
-		SimpleHierachyTest.class, StatechartActiveTest.class,
-		StatechartLocalReactionsTest.class, StateIsActiveTest.class,
-		StaticChoiceTest.class, STextKeywordsInStatesAndRegionsTest.class,
-		StringExpressionsTest.class, SyncForkTest.class, SyncJoinTest.class,
+		ReadOnlyVariableTest.class, SameNameDifferentRegionTest.class,
+		ShallowHistoryTest.class, ShallowHistoryWithDeepEntryTest.class,
+		SimpleEventTest.class, SimpleHierachyTest.class,
+		StatechartActiveTest.class, StatechartLocalReactionsTest.class,
+		StateIsActiveTest.class, StaticChoiceTest.class,
+		STextKeywordsInStatesAndRegionsTest.class, StringExpressionsTest.class,
+		SyncForkTest.class, SyncJoinTest.class,
 		TransitionWithoutConditionTest.class,
 		TriggerGuardExpressionsTest.class, ValuedEventsTest.class})
 public class AllTestsTest {

+ 59 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/ReadOnlyVariableTest.java

@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2015 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 ReadOnlyVariable
+ */
+@SuppressWarnings("all")
+@RunWith(XtextRunner.class)
+@InjectWith(SExecInjectionProvider.class)
+public class ReadOnlyVariableTest extends AbstractExecutionFlowTest {
+	@Before
+	public void setup() throws Exception {
+		ExecutionFlow flow = models
+				.loadExecutionFlowFromResource("ReadOnlyVariable.sct");
+		initInterpreter(flow);
+	}
+	@Test
+	public void ReadOnlyVariableTest() throws Exception {
+		interpreter.enter();
+		assertTrue(isStateActive("StateA"));
+		assertTrue(getInteger("myInt") == 0l);
+		assertTrue(getString("myString").equals("testString"));
+		assertTrue(getBoolean("myBool") == true);
+		assertTrue(getReal("myReal") == 1.1d);
+		assertTrue(getInteger("A.myInt") == 0l);
+		assertTrue(getString("A.myString").equals("testString"));
+		assertTrue(getBoolean("A.myBool") == true);
+		assertTrue(getReal("A.myReal") == 1.1d);
+		interpreter.runCycle();
+		assertTrue(isStateActive("StateB"));
+		assertTrue(getInteger("myInt") == 100l);
+		assertTrue(getString("myString").equals("fail"));
+		assertTrue(getBoolean("myBool") == false);
+		assertTrue(getReal("myReal") == 6.6d);
+		assertTrue(getInteger("A.myInt") == 200l);
+		assertTrue(getString("A.myString").equals("A_fail"));
+		assertTrue(getBoolean("A.myBool") == false);
+		assertTrue(getReal("A.myReal") == 7.7d);
+	}
+}

File diff suppressed because it is too large
+ 98 - 0
test-plugins/org.yakindu.sct.test.models/testmodels/SCTUnit/ReadOnlyVariable.sct


+ 1 - 0
test-plugins/org.yakindu.sct.test.models/tests/AllTests.sctunit

@@ -37,6 +37,7 @@ testsuite AllTests {
 	Parenthesis,
 	PriorityValues,
 	RaiseEvent,
+	ReadOnlyVariable,
 	SameNameDifferentRegion, 
 	ShallowHistory, 	
 	ShallowHistoryWithDeepEntry, 	

+ 32 - 0
test-plugins/org.yakindu.sct.test.models/tests/ReadOnlyVariable.sctunit

@@ -0,0 +1,32 @@
+
+testgroup ReadOnlyVariable for statechart ReadOnlyVariable{
+	test ReadOnlyVariableTest { 
+		enter
+		
+		assert active(ReadOnlyVariable.main_region.StateA)
+		assert myInt == 0
+		assert myString == "testString"
+		assert myBool == true
+		assert myReal == 1.1
+		
+		assert A.myInt == 0
+		assert A.myString == "testString"
+		assert A.myBool == true
+		assert A.myReal == 1.1
+		
+		cycle
+		
+		assert active(ReadOnlyVariable.main_region.StateB)
+		assert myInt == 100
+		assert myString == "fail"
+		assert myBool == false
+		assert myReal == 6.6
+		
+		assert A.myInt == 200
+		assert A.myString == "A_fail"
+		assert A.myBool == false
+		assert A.myReal == 7.7		
+				
+	} 
+}
+