Browse Source

New generation of tests

Markus Mühlbrandt 9 years ago
parent
commit
5cadad6a4b

+ 1 - 1
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/constants/ConstantsStatemachine.java

@@ -21,7 +21,7 @@ public class ConstantsStatemachine implements IConstantsStatemachine {
 
 		protected long getE2Value() {
 			if (!e2)
-				throw new IllegalStateException("Illegal event value acces. Event E2 is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event E2 is not raised!");
 			return e2Value;
 		}
 

+ 12 - 12
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/declarations/DeclarationsStatemachine.java

@@ -31,7 +31,7 @@ public class DeclarationsStatemachine implements IDeclarationsStatemachine {
 
 		protected boolean getEvCValue() {
 			if (!evC)
-				throw new IllegalStateException("Illegal event value acces. Event EvC is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event EvC is not raised!");
 			return evCValue;
 		}
 
@@ -50,7 +50,7 @@ public class DeclarationsStatemachine implements IDeclarationsStatemachine {
 
 		public long getEvDValue() {
 			if (!evD)
-				throw new IllegalStateException("Illegal event value acces. Event EvD is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event EvD is not raised!");
 			return evDValue;
 		}
 
@@ -65,7 +65,7 @@ public class DeclarationsStatemachine implements IDeclarationsStatemachine {
 
 		protected double getEvEValue() {
 			if (!evE)
-				throw new IllegalStateException("Illegal event value acces. Event EvE is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event EvE is not raised!");
 			return evEValue;
 		}
 
@@ -84,7 +84,7 @@ public class DeclarationsStatemachine implements IDeclarationsStatemachine {
 
 		public String getEvFValue() {
 			if (!evF)
-				throw new IllegalStateException("Illegal event value acces. Event EvF is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event EvF is not raised!");
 			return evFValue;
 		}
 
@@ -182,7 +182,7 @@ public class DeclarationsStatemachine implements IDeclarationsStatemachine {
 
 		protected boolean getEvCValue() {
 			if (!evC)
-				throw new IllegalStateException("Illegal event value acces. Event EvC is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event EvC is not raised!");
 			return evCValue;
 		}
 
@@ -201,7 +201,7 @@ public class DeclarationsStatemachine implements IDeclarationsStatemachine {
 
 		public long getEvDValue() {
 			if (!evD)
-				throw new IllegalStateException("Illegal event value acces. Event EvD is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event EvD is not raised!");
 			return evDValue;
 		}
 
@@ -216,7 +216,7 @@ public class DeclarationsStatemachine implements IDeclarationsStatemachine {
 
 		protected double getEvEValue() {
 			if (!evE)
-				throw new IllegalStateException("Illegal event value acces. Event EvE is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event EvE is not raised!");
 			return evEValue;
 		}
 
@@ -235,7 +235,7 @@ public class DeclarationsStatemachine implements IDeclarationsStatemachine {
 
 		public String getEvFValue() {
 			if (!evF)
-				throw new IllegalStateException("Illegal event value acces. Event EvF is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event EvF is not raised!");
 			return evFValue;
 		}
 
@@ -518,7 +518,7 @@ public class DeclarationsStatemachine implements IDeclarationsStatemachine {
 
 	private boolean getEvInCValue() {
 		if (!evInC)
-			throw new IllegalStateException("Illegal event value acces. Event EvInC is not raised!");
+			throw new IllegalStateException("Illegal event value access. Event EvInC is not raised!");
 		return evInCValue;
 	}
 	private void raiseEvInD(long value) {
@@ -528,7 +528,7 @@ public class DeclarationsStatemachine implements IDeclarationsStatemachine {
 
 	private long getEvInDValue() {
 		if (!evInD)
-			throw new IllegalStateException("Illegal event value acces. Event EvInD is not raised!");
+			throw new IllegalStateException("Illegal event value access. Event EvInD is not raised!");
 		return evInDValue;
 	}
 	private void raiseEvInE(double value) {
@@ -538,7 +538,7 @@ public class DeclarationsStatemachine implements IDeclarationsStatemachine {
 
 	private double getEvInEValue() {
 		if (!evInE)
-			throw new IllegalStateException("Illegal event value acces. Event EvInE is not raised!");
+			throw new IllegalStateException("Illegal event value access. Event EvInE is not raised!");
 		return evInEValue;
 	}
 	private void raiseEvInF(String value) {
@@ -548,7 +548,7 @@ public class DeclarationsStatemachine implements IDeclarationsStatemachine {
 
 	private String getEvInFValue() {
 		if (!evInF)
-			throw new IllegalStateException("Illegal event value acces. Event EvInF is not raised!");
+			throw new IllegalStateException("Illegal event value access. Event EvInF is not raised!");
 		return evInFValue;
 	}
 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/namedinterfaceaccess/NamedInterfaceAccessStatemachine.java

@@ -48,7 +48,7 @@ public class NamedInterfaceAccessStatemachine implements INamedInterfaceAccessSt
 
 		protected long getNumberPressedValue() {
 			if (!numberPressed)
-				throw new IllegalStateException("Illegal event value acces. Event NumberPressed is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event NumberPressed is not raised!");
 			return numberPressedValue;
 		}
 

+ 2 - 2
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/runnabletest/RunnableTestStatemachine.java

@@ -37,7 +37,7 @@ public class RunnableTestStatemachine implements IRunnableTestStatemachine {
 
 		public long getEv_outValue() {
 			if (!ev_out)
-				throw new IllegalStateException("Illegal event value acces. Event Ev_out is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event Ev_out is not raised!");
 			return ev_outValue;
 		}
 
@@ -52,7 +52,7 @@ public class RunnableTestStatemachine implements IRunnableTestStatemachine {
 
 		protected long getEv_inValue() {
 			if (!ev_in)
-				throw new IllegalStateException("Illegal event value acces. Event Ev_in is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event Ev_in is not raised!");
 			return ev_inValue;
 		}
 

+ 1 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/timedtransitions/ITimedTransitionsStatemachine.java

@@ -3,4 +3,5 @@ import org.yakindu.scr.IStatemachine;
 import org.yakindu.scr.ITimerCallback;
 
 public interface ITimedTransitionsStatemachine extends ITimerCallback, IStatemachine {
+
 }

+ 67 - 1
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/timedtransitions/TimedTransitionsStatemachine.java

@@ -15,7 +15,27 @@ public class TimedTransitionsStatemachine implements ITimedTransitionsStatemachi
 
 	private ITimer timer;
 
-	private final boolean[] timeEvents = new boolean[1];
+	private final boolean[] timeEvents = new boolean[2];
+
+	private long x;
+
+	protected void setX(long value) {
+		x = value;
+	}
+
+	protected long getX() {
+		return x;
+	}
+
+	private long y;
+
+	protected void setY(long value) {
+		y = value;
+	}
+
+	protected long getY() {
+		return y;
+	}
 
 	public TimedTransitionsStatemachine() {
 
@@ -33,6 +53,9 @@ public class TimedTransitionsStatemachine implements ITimedTransitionsStatemachi
 		clearEvents();
 		clearOutEvents();
 
+		setX(0);
+
+		setY(0);
 	}
 
 	public void enter() {
@@ -43,11 +66,15 @@ public class TimedTransitionsStatemachine implements ITimedTransitionsStatemachi
 		if (timer == null) {
 			throw new IllegalStateException("timer not set.");
 		}
+		entryAction();
+
 		enterSequence_main_region_default();
 	}
 
 	public void exit() {
 		exitSequence_main_region();
+
+		exitAction();
 	}
 
 	/**
@@ -121,22 +148,49 @@ public class TimedTransitionsStatemachine implements ITimedTransitionsStatemachi
 		timeEvents[eventID] = true;
 	}
 
+	private boolean check__lr0() {
+		return timeEvents[1];
+	}
+
+	private boolean check__lr1() {
+		return true;
+	}
+
 	private boolean check_main_region_Start_tr0_tr0() {
 		return timeEvents[0];
 	}
 
+	private void effect__lr0() {
+		setX(getX() + 1);
+	}
+
+	private void effect__lr1() {
+		setY(getY() + 1);
+	}
+
 	private void effect_main_region_Start_tr0() {
 		exitSequence_main_region_Start();
 
 		enterSequence_main_region_End_default();
 	}
 
+	/* Entry action for statechart 'TimedTransitions'. */
+	private void entryAction() {
+
+		timer.setTimer(this, 1, 1 * 1000, true);
+	}
+
 	/* Entry action for state 'Start'. */
 	private void entryAction_main_region_Start() {
 
 		timer.setTimer(this, 0, 2 * 1000, false);
 	}
 
+	/* Exit action for state 'TimedTransitions'. */
+	private void exitAction() {
+		timer.unsetTimer(this, 1);
+	}
+
 	/* Exit action for state 'Start'. */
 	private void exitAction_main_region_Start() {
 		timer.unsetTimer(this, 0);
@@ -193,6 +247,12 @@ public class TimedTransitionsStatemachine implements ITimedTransitionsStatemachi
 
 	/* The reactions of state Start. */
 	private void react_main_region_Start() {
+		if (check__lr0()) {
+			effect__lr0();
+		}
+
+		effect__lr1();
+
 		if (check_main_region_Start_tr0_tr0()) {
 			effect_main_region_Start_tr0();
 		}
@@ -200,6 +260,12 @@ public class TimedTransitionsStatemachine implements ITimedTransitionsStatemachi
 
 	/* The reactions of state End. */
 	private void react_main_region_End() {
+		if (check__lr0()) {
+			effect__lr0();
+		}
+
+		effect__lr1();
+
 	}
 
 	/* Default react sequence for initial entry  */

+ 4 - 4
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/valuedevents/ValuedEventsStatemachine.java

@@ -15,7 +15,7 @@ public class ValuedEventsStatemachine implements IValuedEventsStatemachine {
 
 		protected long getIntegerEventValue() {
 			if (!integerEvent)
-				throw new IllegalStateException("Illegal event value acces. Event IntegerEvent is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event IntegerEvent is not raised!");
 			return integerEventValue;
 		}
 
@@ -30,7 +30,7 @@ public class ValuedEventsStatemachine implements IValuedEventsStatemachine {
 
 		protected boolean getBooleanEventValue() {
 			if (!booleanEvent)
-				throw new IllegalStateException("Illegal event value acces. Event BooleanEvent is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event BooleanEvent is not raised!");
 			return booleanEventValue;
 		}
 
@@ -45,7 +45,7 @@ public class ValuedEventsStatemachine implements IValuedEventsStatemachine {
 
 		protected double getRealEventValue() {
 			if (!realEvent)
-				throw new IllegalStateException("Illegal event value acces. Event RealEvent is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event RealEvent is not raised!");
 			return realEventValue;
 		}
 
@@ -60,7 +60,7 @@ public class ValuedEventsStatemachine implements IValuedEventsStatemachine {
 
 		protected String getStringEventValue() {
 			if (!stringEvent)
-				throw new IllegalStateException("Illegal event value acces. Event StringEvent is not raised!");
+				throw new IllegalStateException("Illegal event value access. Event StringEvent is not raised!");
 			return stringEventValue;
 		}
 

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

@@ -28,7 +28,7 @@ import org.junit.runners.Suite.SuiteClasses;
 		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, TriggerExpressionPrecedenceTest.class,
-		ValuedEventsTest.class})
+		TimedTransitionsTest.class, TransitionWithoutConditionTest.class, TriggerGuardExpressionsTest.class,
+		TriggerExpressionPrecedenceTest.class, ValuedEventsTest.class})
 public class AllTestsTest {
 }