Ver código fonte

Added Statechart Builder Tests

Andreas Mülder 14 anos atrás
pai
commit
df5ac067e3

+ 3 - 2
test-plugins/org.yakindu.sct.simulation.runtime.test/META-INF/MANIFEST.MF

@@ -6,9 +6,10 @@ Bundle-Version: 1.1.0.qualifier
 Bundle-Vendor: YAKINDU.org
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
- org.junit;bundle-version="3.8.0",
  org.yakindu.sct.model.sgraph;bundle-version="1.0.0",
- org.yakindu.sct.simulation.runtime;bundle-version="1.1.0"
+ org.yakindu.sct.simulation.runtime;bundle-version="1.1.0",
+ org.junit;bundle-version="4.8.2",
+ org.yakindu.sct.model.stext;bundle-version="1.0.0"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Bundle-ActivationPolicy: lazy
 Export-Package: org.yakindu.sct.simulation.runtime.sgraph.builder.test,

+ 7 - 19
test-plugins/org.yakindu.sct.simulation.runtime.test/src/org/yakindu/sct/simulation/runtime/sgraph/builder/test/AllTests.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2010 committers of YAKINDU and others.
+ * Copyright (c) 2011 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
@@ -10,26 +10,14 @@
  */
 package org.yakindu.sct.simulation.runtime.sgraph.builder.test;
 
-import junit.framework.Test;
 import junit.framework.TestSuite;
 
-/**
-@RunWith(value=Suite.class)
-@SuiteClasses(value={
-		ExpressionsTest.class, 
-		FunctionsTest.class,
-		CoreFunctionsTest.class
-		}) 
-*/
-public class AllTests extends TestSuite{
-	
-	public static Test suite() {
-		TestSuite suite = new AllTests();
-		suite.addTestSuite(StatechartBuilderTest.class);
-			
-		return suite;
-	}
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
 
-	
+@RunWith(value = Suite.class)
+@SuiteClasses(value = { StatechartBuilderTest.class})
+public class AllTests extends TestSuite {
 
 }

+ 266 - 199
test-plugins/org.yakindu.sct.simulation.runtime.test/src/org/yakindu/sct/simulation/runtime/sgraph/builder/test/StatechartBuilderTest.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2010 committers of YAKINDU and others.
+ * Copyright (c) 2011 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
@@ -10,120 +10,156 @@
  */
 package org.yakindu.sct.simulation.runtime.sgraph.builder.test;
 
-import java.util.List;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.*;
 
-import junit.framework.TestCase;
+import java.util.List;
 
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.yakindu.sct.model.sgraph.Choice;
+import org.yakindu.sct.model.sgraph.Entry;
+import org.yakindu.sct.model.sgraph.EntryKind;
+import org.yakindu.sct.model.sgraph.Event;
+import org.yakindu.sct.model.sgraph.FinalState;
+import org.yakindu.sct.model.sgraph.Region;
 import org.yakindu.sct.model.sgraph.SGraphFactory;
 import org.yakindu.sct.model.sgraph.SGraphPackage;
-import org.yakindu.sct.simulation.runtime.stext.Assign;
-import org.yakindu.sct.simulation.runtime.stext.ProcedureCall;
-import org.yakindu.sct.simulation.runtime.stext.Raise;
-import org.yakindu.sct.simulation.runtime.stext.Statement;
-import org.yakindu.sct.simulation.runtime.stext.StatementSequence;
-import org.yakindu.sct.simulation.runtime.stext.UnaryOperation;
-import org.yakindu.sct.simulation.runtime.stext.VariableRef;
-import org.yakindu.sct.simulation.runtime.sgraph.Action;
+import org.yakindu.sct.model.sgraph.Scope;
+import org.yakindu.sct.model.sgraph.State;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.model.sgraph.Transition;
+import org.yakindu.sct.model.sgraph.Variable;
+import org.yakindu.sct.model.stext.stext.Direction;
+import org.yakindu.sct.model.stext.stext.EventDefinition;
+import org.yakindu.sct.model.stext.stext.StextFactory;
+import org.yakindu.sct.model.stext.stext.Type;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
 import org.yakindu.sct.simulation.runtime.sgraph.ActionStatement;
-import org.yakindu.sct.simulation.runtime.sgraph.CompoundState;
-import org.yakindu.sct.simulation.runtime.sgraph.FinalState;
-import org.yakindu.sct.simulation.runtime.sgraph.GuardExpression;
-import org.yakindu.sct.simulation.runtime.sgraph.Node;
-import org.yakindu.sct.simulation.runtime.sgraph.Pseudostate;
 import org.yakindu.sct.simulation.runtime.sgraph.PseudostateKind;
-import org.yakindu.sct.simulation.runtime.sgraph.Region;
-import org.yakindu.sct.simulation.runtime.sgraph.SimpleState;
-import org.yakindu.sct.simulation.runtime.sgraph.Statechart;
-import org.yakindu.sct.simulation.runtime.sgraph.Transition;
-import org.yakindu.sct.simulation.runtime.sgraph.builder.StatechartBuilder;
+import org.yakindu.sct.simulation.runtime.sgraph.RTCompoundState;
+import org.yakindu.sct.simulation.runtime.sgraph.RTFinalState;
+import org.yakindu.sct.simulation.runtime.sgraph.RTNode;
+import org.yakindu.sct.simulation.runtime.sgraph.RTPseudostate;
+import org.yakindu.sct.simulation.runtime.sgraph.RTRegion;
+import org.yakindu.sct.simulation.runtime.sgraph.RTSimpleState;
+import org.yakindu.sct.simulation.runtime.sgraph.RTStatechart;
+import org.yakindu.sct.simulation.runtime.sgraph.RTTransition;
+import org.yakindu.sct.simulation.runtime.sgraph.builder.SGraphBuilder;
+import org.yakindu.sct.simulation.runtime.stext.Statement;
+import org.yakindu.sct.simulation.runtime.stext.StatementSequence;
 
-public class StatechartBuilderTest extends TestCase {
-	
+/**
+ * 
+ * @author axel terfloth
+ * @author andreas muelder
+ * 
+ */
+public class StatechartBuilderTest {
 
-	static {
-		// set up EMF - the EPackage.Registry requires a context class loader ...
+	private Statechart sourceSC;
+	private SGraphFactory graphFactory;
+	//TODO: Move to stext
+	private StextFactory textFactory;
+	private SGraphBuilder builder;
+
+	@BeforeClass
+	public static void initContextClassLoader() {
+		// set up EMF - the EPackage.Registry requires a context class loader
 		if (Thread.currentThread().getContextClassLoader() == null) {
-			Thread.currentThread().setContextClassLoader(StatechartBuilderTest.class.getClassLoader());	
+			Thread.currentThread().setContextClassLoader(
+					StatechartBuilderTest.class.getClassLoader());
 		}
-		SGraphPackage.eINSTANCE.eClass();
+		//SGraphPackage.eINSTANCE.eClass();
+		
 	}
-	
-	protected org.yakindu.sct.model.sgraph.Statechart sourceSC;
-	protected SGraphFactory factory;
-	StatechartBuilder builder;
-	
-	
 
-	@Override
-	protected void setUp() throws Exception {
-		super.setUp();
-		factory = SGraphFactory.eINSTANCE;
-		sourceSC = factory.createStatechart();
+	@Before
+	public void setUp() throws Exception {
+		graphFactory = SGraphFactory.eINSTANCE;
+		textFactory = StextFactory.eINSTANCE;
+		sourceSC = graphFactory.createStatechart();
 		sourceSC.setName("SC");
-		sourceSC.setUUID("SC1");
-		builder = new StatechartBuilder();
+		// sourceSC.setUUID("SC1");
+		builder = new SGraphBuilder();
 	}
 
-	
+	@After
+	public void tearDown() {
+		sourceSC = null;
+		builder = null;
+	}
 
+	@Test
 	public void testEmptyStatechart() {
-		
-		Statechart tSC = builder.build(sourceSC);
+		RTStatechart tSC = builder.build(sourceSC);
 		assertNotNull(tSC);
-		//assertEquals(sSC.getName(), tSC.)
+	}
+	@Test
+	public void testSignalEvents() {
+		//TODO: Move to sText
+		Scope scope = graphFactory.createScope();
+		sourceSC.getScopes().add(scope);
+		
+		EventDefinition event_a = textFactory.createEventDefinition();
+		event_a.setName("a");
+		event_a.setType(Type.VOID);
+		event_a.setDirection(Direction.IN);
+		scope.getEvents().add(event_a);
+
+		Event event_b = textFactory.createEventDefinition();
+		event_b.setName("b");
+		event_a.setType(Type.VOID);
+		event_a.setDirection(Direction.IN);
+		scope.getEvents().add(event_b);
+		
+		RTStatechart tSC = builder.build(sourceSC);
+		assertEquals(2, tSC.getSignalEvents().size());
+		assertNotNull(tSC.getSignalEvent(event_a.getName()));
+		assertNotNull(tSC.getSignalEvent(event_b.getName()));
 	}
 	
-	
+	@Test
 	public void testVars() {
-		statemachine.Variable var_a = factory.createVariable();
+		//TODO: Move to sText
+		Scope scope = graphFactory.createScope();
+		sourceSC.getScopes().add(scope);
+		
+		VariableDefinition var_a = textFactory.createVariableDefinition();
 		var_a.setName("a");
-		var_a.setDataType(statemachine.DataTypes.INT);
-		sourceSC.getDataElement().add(var_a);
+		var_a.setType(Type.INTEGER);
+		scope.getVariables().add(var_a);
 
-		statemachine.Variable var_b = factory.createVariable();
+		VariableDefinition var_b = textFactory.createVariableDefinition();
 		var_b.setName("b");
-		var_b.setDataType(statemachine.DataTypes.BOOLEAN);
-		sourceSC.getDataElement().add(var_b);
+		var_b.setType(Type.BOOLEAN);
+		scope.getVariables().add(var_b);
 		
-		Statechart tSC = builder.build(sourceSC);
+		RTStatechart tSC = builder.build(sourceSC);
 		assertNotNull(tSC.getVariable(var_a.getName()));
 		assertNotNull(tSC.getVariable(var_b.getName()));
 		
 		assertEquals(0, tSC.getVariable("a").getValue());
 		assertEquals(false, tSC.getVariable("b").getValue());
 	}
-
-	
-	
-	public void testSignalEvents() {
-		statemachine.Event event_a = factory.createEvent();
-		event_a.setName("a");
-		sourceSC.getDataElement().add(event_a);
-
-		statemachine.Event event_b = factory.createEvent();
-		event_b.setName("b");
-		sourceSC.getDataElement().add(event_b);
-		
-		Statechart tSC = builder.build(sourceSC);
-		assertEquals(2, tSC.getSignalEvents().size());
-		assertNotNull(tSC.getSignalEvent(event_a.getName()));
-		assertNotNull(tSC.getSignalEvent(event_b.getName()));
-	}
-
-	
 	
+	@Test
 	public void testTopLevelRegions() throws Exception {
-		statemachine.Region reg_a = factory.createRegion();
+		Region reg_a = graphFactory.createRegion();
 		reg_a.setPriority(3);
-		sourceSC.getRegion().add(reg_a);
+		sourceSC.getRegions().add(reg_a);
 
-		statemachine.Region reg_b = factory.createRegion();
+		Region reg_b = graphFactory.createRegion();
 		reg_b.setPriority(1);
-		sourceSC.getRegion().add(reg_b);
+		sourceSC.getRegions().add(reg_b);
+
+		RTStatechart rtSC = builder.build(sourceSC);
+		List<RTRegion> regions = rtSC.getRegions();
 
-		Statechart tSC = builder.build(sourceSC);
-		List<Region> regions = tSC.getRegions();
-		
 		assertEquals(2, regions.size());
 		assertEquals(1, regions.get(0).getPriority());
 		assertEquals("1", regions.get(0).getId());
@@ -132,51 +168,8 @@ public class StatechartBuilderTest extends TestCase {
 	}
 
 	
-
-	
-	public void testChoice() throws Exception {
-		testPseudoState(statemachine.PseudoTypes.CHOICE, PseudostateKind.CHOICE);
-	}
-
-	public void testJunction() throws Exception {
-		testPseudoState(statemachine.PseudoTypes.JUNCTION, PseudostateKind.JUNCTION);
-	}
-
-	public void testInitialState() throws Exception {
-		testPseudoState(statemachine.PseudoTypes.INITIAL, PseudostateKind.INITIAL);
-	}
-
-	public void testDeepHistory() throws Exception {
-		testPseudoState(statemachine.PseudoTypes.DEEP_HISTORY, PseudostateKind.DEEPHISTORY);
-	}
-	
-	public void testShallowHistory() throws Exception {
-		testPseudoState(statemachine.PseudoTypes.SHALLOW_HISTORY, PseudostateKind.SHALLOWHISTORY);
-	}
-
-	
-	public void testPseudoState(statemachine.PseudoTypes sourceType, PseudostateKind targetType) throws Exception {
-		statemachine.Region region = factory.createRegion();
-		region.setPriority(3);
-		sourceSC.getRegion().add(region);
-
-		statemachine.Pseudostate initial = factory.createPseudostate();
-		initial.setPseudoType(sourceType);
-		initial.setId(1);
-		region.getState().add(initial);
-		
-		Statechart tSC = builder.build(sourceSC);
-		List<Region> regions = tSC.getRegions();
-		
-		assertEquals(1, regions.size());
-		assertEquals(1, regions.get(0).getNodes().size());
-		Node node = regions.get(0).getNodes().iterator().next();
-		assertTrue(node instanceof Pseudostate);
-		assertEquals(targetType, ((Pseudostate)node).getKind());
-	}
-	
-	
-	public void testSimpleState() {
+	/**
+	 * public void testSimpleState() {
 		statemachine.Region region = factory.createRegion();
 		region.setPriority(3);
 		sourceSC.getRegion().add(region);
@@ -205,110 +198,183 @@ public class StatechartBuilderTest extends TestCase {
 		assertTrue(firstFromSequence(tState.getDoAction()) instanceof Raise);
 		assertTrue(firstFromSequence(tState.getExitAction()) instanceof ProcedureCall);
 	}
+	 */
 	
-	
-	public void testFinalState() {
-		statemachine.Region region = factory.createRegion();
+	@Test
+	public void testSimpleState() {
+		Region region = graphFactory.createRegion();
 		region.setPriority(3);
-		sourceSC.getRegion().add(region);
+		sourceSC.getRegions().add(region);
+
+		State state = graphFactory.createState();
+		state.setName("stateA");
+		state.setExpression("entry / raise e1; exit / raise e2;");
+		region.getVertices().add(state);
+
+		RTStatechart tSC = builder.build(sourceSC);
+		List<RTRegion> regions = tSC.getRegions();
 
-		statemachine.FinalState state = factory.createFinalState();
-		state.setId(1);
-		region.getState().add(state);
-		
-		Statechart tSC = builder.build(sourceSC);
-		List<Region> regions = tSC.getRegions();
-		
 		assertEquals(1, regions.size());
 		assertEquals(1, regions.get(0).getNodes().size());
-		Node node = regions.get(0).getNodes().iterator().next();
-		assertTrue(node instanceof FinalState);
+		RTNode node = regions.get(0).getNodes().iterator().next();
+		assertTrue(node instanceof RTSimpleState);
+		RTSimpleState tState = (RTSimpleState) node;
+		assertEquals(state.getName(), tState.getName());
+		
+		fail("complete me");
+		//FIXME
+//		StatementSequence seq = (StatementSequence) ((ActionStatement) tState
+//				.getEntryAction()).getStatement();
+//		assertTrue(firstFromSequence(tState.getEntryAction()) instanceof Assign);
+//		assertTrue(firstFromSequence(tState.getDoAction()) instanceof Raise);
+//		assertTrue(firstFromSequence(tState.getExitAction()) instanceof ProcedureCall);
 	}
 	
 
-	
-	/**
-	 * TODO: CompoundStates do not support do-Actions 
-	 */
+	@Test
 	public void testCompboundState() {
-		statemachine.Region region = factory.createRegion();
+		Region region = graphFactory.createRegion();
 		region.setPriority(3);
-		sourceSC.getRegion().add(region);
+		sourceSC.getRegions().add(region);
 
-		statemachine.State state = factory.createState();
+		State state = graphFactory.createState();
 		state.setName("stateA");
-		state.setId(1);
-		state.setEntry("a=1;");
-		state.setDo("raise(abc);");
-		state.setExit("call();");
-		region.getState().add(state);
+		region.getVertices().add(state);
 
-		statemachine.Region subRegion = factory.createRegion();
+		Region subRegion = graphFactory.createRegion();
 		region.setPriority(0);
-		state.getRegion().add(subRegion);
+		state.getSubRegions().add(subRegion);
 
-		
-		Statechart tSC = builder.build(sourceSC);
-		List<Region> regions = tSC.getRegions();
-		
+		RTStatechart tSC = builder.build(sourceSC);
+		List<RTRegion> regions = tSC.getRegions();
 
-		Node node = regions.get(0).getNodes().iterator().next();
-		assertTrue(node instanceof CompoundState);
+		RTNode node = regions.get(0).getNodes().iterator().next();
+		assertTrue(node instanceof RTCompoundState);
 
-		CompoundState tState = (CompoundState)node;
+		RTCompoundState tState = (RTCompoundState) node;
 		assertEquals(state.getName(), tState.getName());
-		
-		StatementSequence seq = (StatementSequence) ((ActionStatement)tState.getEntryAction()).getStatement();
-		assertTrue(firstFromSequence(tState.getEntryAction()) instanceof Assign);
-		// assertTrue(firstFromSequence(tState.getDoAction()) instanceof Raise);
-		assertTrue(firstFromSequence(tState.getExitAction()) instanceof ProcedureCall);
-		
 		assertEquals(1, tState.getRegions().size());
 	}
-	
-	
-	
+
+	@Test
+	public void testInitialState() throws Exception {
+		testEntryState(EntryKind.INITIAL, PseudostateKind.INITIAL);
+	}
+
+	@Test
+	public void testDeepHistory() throws Exception {
+		testEntryState(EntryKind.DEEP_HISTORY, PseudostateKind.DEEPHISTORY);
+	}
+
+	@Test
+	public void testShallowHistory() throws Exception {
+		testEntryState(EntryKind.SHALLOW_HISTORY,
+				PseudostateKind.SHALLOWHISTORY);
+	}
+
+	@Test
+	public void testChoice() throws Exception {
+		Region region = graphFactory.createRegion();
+		region.setPriority(3);
+		sourceSC.getRegions().add(region);
+
+		Choice entry = graphFactory.createChoice();
+		region.getVertices().add(entry);
+
+		RTStatechart tSC = builder.build(sourceSC);
+		List<RTRegion> regions = tSC.getRegions();
+
+		assertEquals(1, regions.size());
+		assertEquals(1, regions.get(0).getNodes().size());
+		RTNode node = regions.get(0).getNodes().iterator().next();
+		assertTrue(node instanceof RTPseudostate);
+		assertEquals(PseudostateKind.CHOICE, ((RTPseudostate) node).getKind());
+	}
+
+	@Test
+	public void testFinalState() {
+		Region region = graphFactory.createRegion();
+		region.setPriority(3);
+		sourceSC.getRegions().add(region);
+
+		FinalState state = graphFactory.createFinalState();
+		region.getVertices().add(state);
+
+		RTStatechart tSC = builder.build(sourceSC);
+		List<RTRegion> regions = tSC.getRegions();
+
+		assertEquals(1, regions.size());
+		assertEquals(1, regions.get(0).getNodes().size());
+		RTNode node = regions.get(0).getNodes().iterator().next();
+		System.out.println("NODE IS " + node);
+		assertTrue(node instanceof RTFinalState);
+	}
+
+	/**
+	 * Convenience methods...
+	 */
+	private void testEntryState(EntryKind sourceType, PseudostateKind targetType)
+			throws Exception {
+		Region region = graphFactory.createRegion();
+		region.setPriority(3);
+		sourceSC.getRegions().add(region);
+
+		Entry entry = graphFactory.createEntry();
+		entry.setKind(sourceType);
+		region.getVertices().add(entry);
+
+		RTStatechart tSC = builder.build(sourceSC);
+		List<RTRegion> regions = tSC.getRegions();
+
+		assertEquals(1, regions.size());
+		assertEquals(1, regions.get(0).getNodes().size());
+		RTNode node = regions.get(0).getNodes().iterator().next();
+		assertTrue(node instanceof RTPseudostate);
+		assertEquals(targetType, ((RTPseudostate) node).getKind());
+	}
+	@Test
 	public void testTransition() {
-		statemachine.Event e1 = factory.createEvent();
+		//TODO: transition test with events -> move to text
+		Scope scope = graphFactory.createScope();
+		sourceSC.getScopes().add(scope);
+		
+		Event e1 = textFactory.createEventDefinition();
 		e1.setName("e1");
-		sourceSC.getDataElement().add(e1);
+		scope.getEvents().add(e1);
 		
-		statemachine.Event e2 = factory.createEvent();
+		Event e2 = textFactory.createEventDefinition();
 		e2.setName("e2");
-		sourceSC.getDataElement().add(e2);
+		scope.getEvents().add(e2);
 		
-		statemachine.Region region = factory.createRegion();
+		Region region = graphFactory.createRegion();
 		region.setPriority(3);
-		sourceSC.getRegion().add(region);
+		sourceSC.getRegions().add(region);
 
-		statemachine.State state_a = factory.createState();
-		state_a.setId(1);
+		State state_a = graphFactory.createState();
 		state_a.setName("a");
-		region.getState().add(state_a);
+		region.getVertices().add(state_a);
 		
-		statemachine.State state_b = factory.createState();
-		state_b.setId(2);
+		State state_b = graphFactory.createState();
 		state_b.setName("b");
-		region.getState().add(state_b);
+		region.getVertices().add(state_b);
 		
-		statemachine.Transition trans = factory.createTransition();
-		trans.setSourceNode(state_a);
-		trans.setTargetNode(state_b);
-		trans.setId(1);
+		Transition trans = graphFactory.createTransition();
+		trans.setSource(state_a);
+		trans.setTarget(state_b);
 		trans.setPriority(42);
 		trans.setExpression("e1,e2,after(200) [a] / a=false;");
 		
-		sourceSC.getTransition().add(trans);
+		state_a.getOutgoingTransitions().add(trans);
 		
-		Statechart tSC = builder.build(sourceSC);
-		List<Region> regions = tSC.getRegions();
+		RTStatechart tSC = builder.build(sourceSC);
+		List<RTRegion> regions = tSC.getRegions();
 		
 		assertEquals(1, regions.size());
 		assertEquals(2, regions.get(0).getNodes().size());
 		
 		// check if nodes and transition are properly connected...
-		Node node_a = (Node) tSC.getElementByAlias(state_a);
-		Node node_b = (Node) tSC.getElementByAlias(state_b);
+		RTNode node_a = (RTNode) tSC.getElementByAlias(state_a);
+		RTNode node_b = (RTNode) tSC.getElementByAlias(state_b);
 		
 		assertNotSame(node_a, node_b);
 		assertTrue(regions.get(0).getNodes().contains(node_a));
@@ -318,7 +384,7 @@ public class StatechartBuilderTest extends TestCase {
 		assertEquals(1, node_b.getIncomingTransitions().size());
 		
 		assertSame(node_a.getOutgoingTransitions().get(0), node_b.getIncomingTransitions().get(0));
-		Transition tTrans = node_a.getOutgoingTransitions().get(0);
+		RTTransition tTrans = node_a.getOutgoingTransitions().get(0);
 		
 		assertSame(node_a, node_a.getOutgoingTransitions().get(0).getSourceNode());
 		assertSame(node_b, node_b.getIncomingTransitions().get(0).getTargetNode());
@@ -329,12 +395,14 @@ public class StatechartBuilderTest extends TestCase {
 		assertEquals("t@1", tTrans.getId());
 		
 		assertNotNull(tTrans.getGuard());
-		// Unary expression because new grammar always put a VariableRef inside a positive unary expression
-		assertTrue(((GuardExpression)tTrans.getGuard()).getExpression() instanceof UnaryOperation);
-		assertTrue(((UnaryOperation)((GuardExpression)tTrans.getGuard()).getExpression()).getExpression() instanceof VariableRef);
-		
-		assertNotNull(tTrans.getAction());
-		assertTrue(((ActionStatement)tTrans.getAction()).getStatement() instanceof StatementSequence);
+		fail("complete me");
+		//FIXME
+//		// Unary expression because new grammar always put a VariableRef inside a positive unary expression
+//		assertTrue(((GuardExpression)tTrans.getGuard()).getExpression() instanceof UnaryOperation);
+//		assertTrue(((UnaryOperation)((GuardExpression)tTrans.getGuard()).getExpression()).getExpression() instanceof VariableRef);
+//		
+//		assertNotNull(tTrans.getAction());
+//		assertTrue(((ActionStatement)tTrans.getAction()).getStatement() instanceof StatementSequence);
 
 		assertEquals(2, tTrans.getSignalTriggers().size());
 		assertTrue(tTrans.getSignalTriggers().contains(tSC.getSignalEvent("e1")));
@@ -346,10 +414,9 @@ public class StatechartBuilderTest extends TestCase {
 	
 	
 
-	private Statement firstFromSequence(Action action) {
-		return ((StatementSequence) ((ActionStatement)action).getStatement()).get(0);
-	}
-	
-	
+//	private Statement firstFromSequence(Action action) {
+//		return ((StatementSequence) ((ActionStatement)action).getStatement()).get(0);
+//	}
+
 
 }

+ 7 - 19
test-plugins/org.yakindu.sct.simulation.runtime.test/src/org/yakindu/sct/simulation/runtime/sgraph/test/AllTests.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2010 committers of YAKINDU and others.
+ * Copyright (c) 2011 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
@@ -10,26 +10,14 @@
  */
 package org.yakindu.sct.simulation.runtime.sgraph.test;
 
-import junit.framework.Test;
 import junit.framework.TestSuite;
 
-/**
-@RunWith(value=Suite.class)
-@SuiteClasses(value={
-		ExpressionsTest.class, 
-		FunctionsTest.class,
-		CoreFunctionsTest.class
-		}) 
-*/
-public class AllTests extends TestSuite{
-	
-	public static Test suite() {
-		TestSuite suite = new AllTests();
-		suite.addTestSuite(StatechartTest.class);
-			
-		return suite;
-	}
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
 
-	
+@RunWith(value = Suite.class)
+@SuiteClasses(value = { StatechartTest.class })
+public class AllTests extends TestSuite {
 
 }

+ 105 - 92
test-plugins/org.yakindu.sct.simulation.runtime.test/src/org/yakindu/sct/simulation/runtime/sgraph/test/StatechartTest.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2010 committers of YAKINDU and others.
+ * Copyright (c) 2011 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
@@ -10,171 +10,184 @@
  */
 package org.yakindu.sct.simulation.runtime.sgraph.test;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNull;
+
 import java.util.HashSet;
 
+import org.junit.Before;
+import org.junit.Test;
+import org.yakindu.sct.simulation.runtime.sgraph.ActionStatement;
+import org.yakindu.sct.simulation.runtime.sgraph.GuardExpression;
+import org.yakindu.sct.simulation.runtime.sgraph.PseudostateKind;
+import org.yakindu.sct.simulation.runtime.sgraph.RTPseudostate;
+import org.yakindu.sct.simulation.runtime.sgraph.RTRegion;
+import org.yakindu.sct.simulation.runtime.sgraph.RTSignalEvent;
+import org.yakindu.sct.simulation.runtime.sgraph.RTSimpleState;
+import org.yakindu.sct.simulation.runtime.sgraph.RTStatechart;
+import org.yakindu.sct.simulation.runtime.sgraph.RTTransition;
 import org.yakindu.sct.simulation.runtime.stext.Assign;
 import org.yakindu.sct.simulation.runtime.stext.Constant;
 import org.yakindu.sct.simulation.runtime.stext.Variable;
 import org.yakindu.sct.simulation.runtime.stext.VariableRef;
-import org.yakindu.sct.simulation.runtime.sgraph.ActionStatement;
-import org.yakindu.sct.simulation.runtime.sgraph.GuardExpression;
-import org.yakindu.sct.simulation.runtime.sgraph.Pseudostate;
-import org.yakindu.sct.simulation.runtime.sgraph.PseudostateKind;
-import org.yakindu.sct.simulation.runtime.sgraph.Region;
-import org.yakindu.sct.simulation.runtime.sgraph.SignalEvent;
-import org.yakindu.sct.simulation.runtime.sgraph.SimpleState;
-import org.yakindu.sct.simulation.runtime.sgraph.Statechart;
-import org.yakindu.sct.simulation.runtime.sgraph.Transition;
-
-import junit.framework.TestCase;
 
-public class StatechartTest extends TestCase {
-
-	
-	
-	private Region rootRegion;
-	protected Statechart statechart;
-	private Pseudostate initial;
-	private SimpleState state1;
-	private Transition trans;
+@SuppressWarnings("all")
+public class StatechartTest {
 
+	private RTRegion rootRegion;
+	protected RTStatechart statechart;
+	private RTPseudostate initial;
+	private RTSimpleState state1;
+	private RTTransition trans;
 
 	/**
-	 * The setup creates a basic statechart that consists of a single root region, an initial state within this region, 
-	 * a simple state, and a transition from the initial state to the simple state. This statechart will be extended 
-	 * by the different test cases as appropriate.
+	 * The setup creates a basic statechart that consists of a single root
+	 * region, an initial state within this region, a simple state, and a
+	 * transition from the initial state to the simple state. This statechart
+	 * will be extended by the different test cases as appropriate.
 	 */
-	@Override
+	@Before
 	protected void setUp() throws Exception {
-		super.setUp();
-		statechart = new Statechart("SC");
-		rootRegion = new Region("r", 1, statechart);
-		initial = new Pseudostate("i", rootRegion, PseudostateKind.INITIAL);
-		state1 = new SimpleState("s1", "a", rootRegion, null, null, null);
-		trans = new Transition("t_i_s1", 1, null, null, null, null, initial, state1);
+		statechart = new RTStatechart("SC");
+		rootRegion = new RTRegion("r", 1, statechart);
+		initial = new RTPseudostate("i", rootRegion, PseudostateKind.INITIAL);
+		state1 = new RTSimpleState("s1", "a", rootRegion, null, null, null);
+		trans = new RTTransition("t_i_s1", 1, null, null, null, null, initial,
+				state1);
 	}
 
-
 	/**
-	 * The simple statechart as created by the setup must enter  {@link #state1}when the statechart is initially entered.
-	 * After a run cycle the current state must stioll be {@link #state1}. 
+	 * The simple statechart as created by the setup must enter {@link #state1}
+	 * when the statechart is initially entered. After a run cycle the current
+	 * state must stioll be {@link #state1}.
 	 */
+	@Test
 	public void testSimpleStatechart() {
-		
+
 		assertNull(rootRegion.getCurrentState());
-		
-		statechart.enter();		
+
+		statechart.enter();
 		assertEquals(state1, rootRegion.getCurrentState());
 
 		statechart.runCycle();
-		assertEquals(state1, rootRegion.getCurrentState());		
+		assertEquals(state1, rootRegion.getCurrentState());
 	}
 
-	
 	/**
 	 * TODO: does not work currently. See bug #
 	 */
+	@Test
 	public void notestTransitionWithoutTrigger() {
-		
-		SimpleState state2 = new SimpleState("s2", "b", rootRegion, null, null, null);
-		new Transition("t_s1_s2", 1, null, null, null, null, state1, state2);
-		
+
+		RTSimpleState state2 = new RTSimpleState("s2", "b", rootRegion, null,
+				null, null);
+		new RTTransition("t_s1_s2", 1, null, null, null, null, state1, state2);
+
 		assertNull(rootRegion.getCurrentState());
-		
-		statechart.enter();		
+
+		statechart.enter();
 		assertEquals(state1, rootRegion.getCurrentState());
 
 		statechart.runCycle();
-		assertEquals(state2, rootRegion.getCurrentState());		
+		assertEquals(state2, rootRegion.getCurrentState());
 	}
 
-
 	/**
-	 * A transition with a trigger must only be taken if the event matches the signal event.
+	 * A transition with a trigger must only be taken if the event matches the
+	 * signal event.
 	 */
+	@Test
 	public void testTransitionTrigger() {
-		
-		final SignalEvent event = new SignalEvent("event");
-		
-		SimpleState state2 = new SimpleState("s2", "b", rootRegion, null, null, null);
-		new Transition("t_s1_s2", 1, null, 
-				new HashSet<SignalEvent>(){{add(event);}}, 
-				null, null, state1, state2);
-		
+
+		final RTSignalEvent event = new RTSignalEvent("event");
+
+		RTSimpleState state2 = new RTSimpleState("s2", "b", rootRegion, null,
+				null, null);
+		new RTTransition("t_s1_s2", 1, null, new HashSet<RTSignalEvent>() {
+			{
+				add(event);
+			}
+		}, null, null, state1, state2);
+
 		assertNull(rootRegion.getCurrentState());
-		
-		statechart.enter();		
+
+		statechart.enter();
 		assertEquals(state1, rootRegion.getCurrentState());
 
 		statechart.runCycle();
-		assertEquals(state1, rootRegion.getCurrentState());		
+		assertEquals(state1, rootRegion.getCurrentState());
 
 		statechart.setEvent(event);
 		statechart.runCycle();
-		assertEquals(state2, rootRegion.getCurrentState());		
+		assertEquals(state2, rootRegion.getCurrentState());
 	}
 
-	
 	/**
-	 * Even if a transition trigger matches the transition will only be taken if an existing guard evaluates to true. 
+	 * Even if a transition trigger matches the transition will only be taken if
+	 * an existing guard evaluates to true.
 	 */
+	@Test
 	public void testTransitionWithTriggerAndGuard() {
-		
-		final SignalEvent event = new SignalEvent("event");
+
+		final RTSignalEvent event = new RTSignalEvent("event");
 		Variable var = new Variable("v");
 		statechart.addVariable(var);
-		
-		SimpleState state2 = new SimpleState("s2", "b", rootRegion, null, null, null);
-		new Transition("t_s1_s2", 1, null, 
-				new HashSet<SignalEvent>(){{add(event);}}, 
-				new GuardExpression(new VariableRef("v"), statechart), 
-				null, state1, state2);
-		
+
+		RTSimpleState state2 = new RTSimpleState("s2", "b", rootRegion, null,
+				null, null);
+		new RTTransition("t_s1_s2", 1, null, new HashSet<RTSignalEvent>() {
+			{
+				add(event);
+			}
+		}, new GuardExpression(new VariableRef("v"), statechart), null, state1,
+				state2);
+
 		assertNull(rootRegion.getCurrentState());
-		
-		statechart.enter();		
+
+		statechart.enter();
 		assertEquals(state1, rootRegion.getCurrentState());
 
 		statechart.getVariable("v").setValue(false);
 		statechart.setEvent(event);
 		statechart.runCycle();
-		assertEquals(state1, rootRegion.getCurrentState());		
+		assertEquals(state1, rootRegion.getCurrentState());
 
 		statechart.getVariable("v").setValue(true);
 		statechart.setEvent(event);
 		statechart.runCycle();
-		assertEquals(state2, rootRegion.getCurrentState());		
+		assertEquals(state2, rootRegion.getCurrentState());
 	}
-	
-	
+
 	/**
 	 * When a transition is taken then the transition action must be performed.
 	 */
+	@Test
 	public void testTransitionWithAction() {
-		
-		final SignalEvent event = new SignalEvent("event");
+
+		final RTSignalEvent event = new RTSignalEvent("event");
 		Variable var = new Variable("v");
 		statechart.addVariable(var);
-		
-		SimpleState state2 = new SimpleState("s2", "b", rootRegion, null, null, null);
-		new Transition("t_s1_s2", 1, null, 
-				new HashSet<SignalEvent>(){{add(event);}}, 
-				null, 
-				new ActionStatement(new Assign(new VariableRef("v"), new Constant(42)), statechart), 
-				state1, state2);
-		
+
+		RTSimpleState state2 = new RTSimpleState("s2", "b", rootRegion, null,
+				null, null);
+		new RTTransition("t_s1_s2", 1, null, new HashSet<RTSignalEvent>() {
+			{
+				add(event);
+			}
+		}, null, new ActionStatement(new Assign(new VariableRef("v"),
+				new Constant(42)), statechart), state1, state2);
+
 		assertNull(rootRegion.getCurrentState());
-		
-		statechart.enter();		
+
+		statechart.enter();
 		assertEquals(state1, rootRegion.getCurrentState());
 
 		assertNull(statechart.getVariable("v").getValue());
 
 		statechart.setEvent(event);
 		statechart.runCycle();
-		assertEquals(state2, rootRegion.getCurrentState());		
-		assertEquals(42, statechart.getValue("v"));		
+		assertEquals(state2, rootRegion.getCurrentState());
+		assertEquals(42, statechart.getValue("v"));
 	}
-	
 
 }

+ 6 - 17
test-plugins/org.yakindu.sct.simulation.runtime.test/src/org/yakindu/sct/simulation/runtime/stext/builder/test/AllTests.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2010 committers of YAKINDU and others.
+ * Copyright (c) 2011 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
@@ -10,25 +10,14 @@
  */
 package org.yakindu.sct.simulation.runtime.stext.builder.test;
 
-import junit.framework.Test;
 import junit.framework.TestSuite;
 
-//import org.junit.runner.RunWith;
-//import org.junit.runners.Suite;
-//import org.junit.runners.Suite.SuiteClasses;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
 
-/**
-@RunWith(value=Suite.class)
-@SuiteClasses(value={
-		BuilderTest.class
-		}) */
+@RunWith(value = Suite.class)
+@SuiteClasses(value = { BuilderTest.class })
 public class AllTests extends TestSuite {
-	
-	public static Test suite() {
-		TestSuite suite = new AllTests();
-			suite.addTestSuite(BuilderTest.class);
-			
-		return suite;
-	}
 
 }

+ 7 - 20
test-plugins/org.yakindu.sct.simulation.runtime.test/src/org/yakindu/sct/simulation/runtime/stext/test/AllTests.java

@@ -10,28 +10,15 @@
  */
 package org.yakindu.sct.simulation.runtime.stext.test;
 
-import junit.framework.Test;
 import junit.framework.TestSuite;
 
-/**
-@RunWith(value=Suite.class)
-@SuiteClasses(value={
-		ExpressionsTest.class, 
-		FunctionsTest.class,
-		CoreFunctionsTest.class
-		}) 
-*/
-public class AllTests extends TestSuite{
-	
-	public static Test suite() {
-		TestSuite suite = new AllTests();
-		suite.addTestSuite(ExpressionsTest.class);
-		suite.addTestSuite(FunctionsTest.class);
-		suite.addTestSuite(CoreFunctionsTest.class);
-			
-		return suite;
-	}
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
 
-	
+@RunWith(value = Suite.class)
+@SuiteClasses(value = { ExpressionsTest.class, FunctionsTest.class,
+		CoreFunctionsTest.class })
+public class AllTests extends TestSuite {
 
 }

+ 451 - 188
test-plugins/org.yakindu.sct.simulation.runtime.test/src/org/yakindu/sct/simulation/runtime/stext/test/CoreFunctionsTest.java

@@ -10,356 +10,619 @@
  */
 package org.yakindu.sct.simulation.runtime.stext.test;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.fail;
 
-import junit.framework.TestCase;
-
-import org.yakindu.sct.simulation.runtime.stext.CoreFunction;
+import org.junit.Test;
 import org.yakindu.sct.simulation.runtime.EvaluationException;
+import org.yakindu.sct.simulation.runtime.stext.CoreFunction;
 import org.yakindu.sct.simulation.runtime.stext.Function;
+/**
+ * 
+ * @author axel terfloth
+ * @author andreas muelder
+ *
+ */
+public class CoreFunctionsTest {
 
-public class CoreFunctionsTest extends TestCase {
-	
+	@Test
 	public void testIntPlus() {
-		Object params[] = new Object[]{3, 2};
-		
-		Object result = Function.lookup(CoreFunction.class, "+", params).execute(params);
+		Object params[] = new Object[] { 3, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "+", params)
+				.execute(params);
 		assertEquals(5, result);
 	}
-	
+
+	@Test
 	public void testFloatPlus() {
-		Object params[] = new Object[]{3.0f, 2.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "+", params).execute(params);
+		Object params[] = new Object[] { 3.0f, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "+", params)
+				.execute(params);
+		assertEquals(5.0f, result);
+	}
+	@Test
+	public void testIntFloatPlus(){
+		Object params[] = new Object[] { 3, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "+", params)
+				.execute(params);
 		assertEquals(5.0f, result);
 	}
 	
+	@Test
+	public void testFloatIntPlus(){
+		Object params[] = new Object[] { 3.0f, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "+", params)
+				.execute(params);
+		assertEquals(5.0f, result);
+	}
+
+	@Test
 	public void testIntMin() {
-		Object params[] = new Object[]{3, 2};
-		
-		Object result = Function.lookup(CoreFunction.class, "-", params).execute(params);
+		Object params[] = new Object[] { 3, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "-", params)
+				.execute(params);
 		assertEquals(1, result);
 	}
-	
+
+	@Test
 	public void testFloatMin() {
-		Object params[] = new Object[]{3.0f, 2.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "-", params).execute(params);
+		Object params[] = new Object[] { 3.0f, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "-", params)
+				.execute(params);
+		assertEquals(1.0f, result);
+	}
+	
+	@Test
+	public void testFloatIntMin() {
+		Object params[] = new Object[] { 3.0f, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "-", params)
+				.execute(params);
 		assertEquals(1.0f, result);
 	}
 	
+	@Test
+	public void testIntFloatMin() {
+		Object params[] = new Object[] { 3, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "-", params)
+				.execute(params);
+		assertEquals(1.0f, result);
+	}
+	
+	@Test
 	public void testIntMul() {
-		Object params[] = new Object[]{3, 2};
-		
-		Object result = Function.lookup(CoreFunction.class, "*", params).execute(params);
+		Object params[] = new Object[] { 3, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "*", params)
+				.execute(params);
 		assertEquals(6, result);
 	}
 	
+
+	@Test
 	public void testIntMulNegative() {
-		Object params[] = new Object[]{-3, -2};
-		
-		Object result = Function.lookup(CoreFunction.class, "*", params).execute(params);
+		Object params[] = new Object[] { -3, -2 };
+
+		Object result = Function.lookup(CoreFunction.class, "*", params)
+				.execute(params);
 		assertEquals(6, result);
 	}
-	
+
+	@Test
 	public void testIntMulPositiveNegative() {
-		Object params[] = new Object[]{3, -2};
-		
-		Object result = Function.lookup(CoreFunction.class, "*", params).execute(params);
+		Object params[] = new Object[] { 3, -2 };
+
+		Object result = Function.lookup(CoreFunction.class, "*", params)
+				.execute(params);
 		assertEquals(-6, result);
 	}
-	
+
+	@Test
 	public void testFloatMul() {
-		Object params[] = new Object[]{3.0f, 2.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "*", params).execute(params);
+		Object params[] = new Object[] { 3.0f, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "*", params)
+				.execute(params);
 		assertEquals(6.0f, result);
 	}
-	
+
+	@Test
 	public void testFloatMulNegative() {
-		Object params[] = new Object[]{-3.0f, -2.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "*", params).execute(params);
+		Object params[] = new Object[] { -3.0f, -2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "*", params)
+				.execute(params);
 		assertEquals(6.0f, result);
 	}
-	
+
+	@Test
 	public void testFloatMulPositiveNegative() {
-		Object params[] = new Object[]{-3.0f, 2.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "*", params).execute(params);
+		Object params[] = new Object[] { -3.0f, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "*", params)
+				.execute(params);
 		assertEquals(-6.0f, result);
 	}
 	
+	@Test
+	public void testFloatIntMul() {
+		Object params[] = new Object[] { 3.0f, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "*", params)
+				.execute(params);
+		assertEquals(6.0f, result);
+	}
+	
+	@Test
+	public void testIntFloatMul() {
+		Object params[] = new Object[] { 3, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "*", params)
+				.execute(params);
+		assertEquals(6.0f, result);
+	}
+
+	@Test
 	public void testIntDiv() {
-		Object params[] = new Object[]{6, 2};
-		
-		Object result = Function.lookup(CoreFunction.class, "/", params).execute(params);
+		Object params[] = new Object[] { 6, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "/", params)
+				.execute(params);
 		assertEquals(3, result);
 	}
-	
+
+	@Test
 	public void testIntDivNotPerfect() {
-		Object params[] = new Object[]{7, 2};
-		
-		Object result = Function.lookup(CoreFunction.class, "/", params).execute(params);
+		Object params[] = new Object[] { 7, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "/", params)
+				.execute(params);
 		assertEquals(3, result);
 	}
-	
+
+	@Test
 	public void testIntDivNegative() {
-		Object params[] = new Object[]{-6, -2};
-		
-		Object result = Function.lookup(CoreFunction.class, "/", params).execute(params);
+		Object params[] = new Object[] { -6, -2 };
+
+		Object result = Function.lookup(CoreFunction.class, "/", params)
+				.execute(params);
 		assertEquals(3, result);
 	}
-	
+
+	@Test
 	public void testIntDivPositiveNegative() {
-		Object params[] = new Object[]{6, -2};
-		
-		Object result = Function.lookup(CoreFunction.class, "/", params).execute(params);
+		Object params[] = new Object[] { 6, -2 };
+
+		Object result = Function.lookup(CoreFunction.class, "/", params)
+				.execute(params);
 		assertEquals(-3, result);
 	}
-		
+
+	@Test
 	public void testIntDivByZero() {
 		try {
-			Object params[] = new Object[]{3, 0};
-		
-			Object result = Function.lookup(CoreFunction.class, "/", params).execute(params);
+			Object params[] = new Object[] { 3, 0 };
+
+			Object result = Function.lookup(CoreFunction.class, "/", params)
+					.execute(params);
 			assertEquals(6, result);
 			fail("EvaluationException expected");
-		} catch (EvaluationException e) {}
+		} catch (EvaluationException e) {
+		}
 	}
-	
+
+	@Test
 	public void testFloatDiv() {
-		Object params[] = new Object[]{6.0f, 2.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "/", params).execute(params);
+		Object params[] = new Object[] { 6.0f, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "/", params)
+				.execute(params);
 		assertEquals(3.0f, result);
 	}
-	
+
+	@Test
 	public void testFloatDivNotPerfect() {
-		Object params[] = new Object[]{7.0f, 2.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "/", params).execute(params);
+		Object params[] = new Object[] { 7.0f, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "/", params)
+				.execute(params);
 		assertEquals(3.5f, result);
 	}
-	
+
+	@Test
 	public void testFloatDivNegative() {
-		Object params[] = new Object[]{-6.0f, -2.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "/", params).execute(params);
+		Object params[] = new Object[] { -6.0f, -2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "/", params)
+				.execute(params);
 		assertEquals(3.0f, result);
 	}
-	
+
+	@Test
 	public void testFloatDivPositiveNegative() {
-		Object params[] = new Object[]{-6.0f, 2.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "/", params).execute(params);
+		Object params[] = new Object[] { -6.0f, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "/", params)
+				.execute(params);
 		assertEquals(-3.0f, result);
 	}
-	
+
+	@Test
 	public void testFloatDivByZero() {
-		Object params[] = new Object[]{6.0f, 0.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "/", params).execute(params);
+		Object params[] = new Object[] { 6.0f, 0.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "/", params)
+				.execute(params);
 		assertEquals(Float.POSITIVE_INFINITY, result);
 	}
 	
+	@Test
+	public void testFloatIntDiv() {
+		Object params[] = new Object[] { 6.0f, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "/", params)
+				.execute(params);
+		assertEquals(3.0f, result);
+	}
+	@Test
+	public void testIntFloatDiv() {
+		Object params[] = new Object[] { 6, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "/", params)
+				.execute(params);
+		assertEquals(3.0f, result);
+	}
+	
+	
+
+	@Test
 	public void testIntModulo() {
-		Object params[] = new Object[]{42, 2};
-		
-		Object result = Function.lookup(CoreFunction.class, "%", params).execute(params);
+		Object params[] = new Object[] { 42, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "%", params)
+				.execute(params);
 		assertEquals(0, result);
 	}
-	
+
+	@Test
 	public void testIntModuloNotPerfect() {
-		Object params[] = new Object[]{42, 5};
-		
-		Object result = Function.lookup(CoreFunction.class, "%", params).execute(params);
+		Object params[] = new Object[] { 42, 5 };
+
+		Object result = Function.lookup(CoreFunction.class, "%", params)
+				.execute(params);
 		assertEquals(2, result);
 	}
-	
+
+	@Test
 	public void testFloatModulo() {
-		Object params[] = new Object[]{42.0f, 2.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "%", params).execute(params);
+		Object params[] = new Object[] { 42.0f, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "%", params)
+				.execute(params);
 		assertEquals(0.0f, result);
 	}
-	
+
+	@Test
 	public void testFloatModuloNotPerfect() {
-		Object params[] = new Object[]{42.0f, 5.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "%", params).execute(params);
+		Object params[] = new Object[] { 42.0f, 5.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "%", params)
+				.execute(params);
 		assertEquals(2.0f, result);
 	}
 	
+	@Test
+	public void testFloatIntModulo() {
+		Object params[] = new Object[] { 42.0f, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "%", params)
+				.execute(params);
+		assertEquals(0.0f, result);
+	}
+
 	
+	@Test
+	public void testIntFloatModulo() {
+		Object params[] = new Object[] { 42, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "%", params)
+				.execute(params);
+		assertEquals(0.0f, result);
+	}
+
+
+	@Test
 	public void testIntLeft() {
-		Object params[] = new Object[]{42, 2};
-		
-		Object result = Function.lookup(CoreFunction.class, "<<", params).execute(params);
+		Object params[] = new Object[] { 42, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "<<", params)
+				.execute(params);
 		assertEquals(168, result);
 	}
-	
+
+	@Test
 	public void testFloatLeft() {
-		Object params[] = new Object[]{42.0f, 2.0f};
-		
+		Object params[] = new Object[] { 42.0f, 2.0f };
+
 		Object result = Function.lookup(CoreFunction.class, "<<", params);
-		assertNull(result);			
+		assertNull(result);
 	}
-	
+
+	@Test
 	public void testIntRight() {
-		Object params[] = new Object[]{42, 2};
-		
-		Object result = Function.lookup(CoreFunction.class, ">>", params).execute(params);
+		Object params[] = new Object[] { 42, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, ">>", params)
+				.execute(params);
 		assertEquals(10, result);
 	}
-	
+
+	@Test
 	public void testIntRightNull() {
-		Object params[] = new Object[]{42, 7};
-		
-		Object result = Function.lookup(CoreFunction.class, ">>", params).execute(params);
+		Object params[] = new Object[] { 42, 7 };
+
+		Object result = Function.lookup(CoreFunction.class, ">>", params)
+				.execute(params);
 		assertEquals(0, result);
 	}
-	
+
+	@Test
 	public void testFloatRight() {
-		Object params[] = new Object[]{42.0f, 2.0f};
-		
+		Object params[] = new Object[] { 42.0f, 2.0f };
+
 		Object result = Function.lookup(CoreFunction.class, "<<", params);
-		assertNull(result);			
+		assertNull(result);
 	}
-	
+
+	@Test
 	public void testIntAnd() {
-		Object params[] = new Object[]{3, 2};
-		
-		Object result = Function.lookup(CoreFunction.class, "&", params).execute(params);
+		Object params[] = new Object[] { 3, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "&", params)
+				.execute(params);
 		assertEquals(2, result);
 	}
-	
+
+	@Test
 	public void testFloatAnd() {
-		Object params[] = new Object[]{3.0f, 2.0f};
-		
+		Object params[] = new Object[] { 3.0f, 2.0f };
+
 		Object result = Function.lookup(CoreFunction.class, "&", params);
 		assertNull(result);
 	}
-	
+
+	@Test
 	public void testIntOr() {
-		Object params[] = new Object[]{3, 2};
-		
-		Object result = Function.lookup(CoreFunction.class, "|", params).execute(params);
+		Object params[] = new Object[] { 3, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "|", params)
+				.execute(params);
 		assertEquals(3, result);
 	}
-	
+
+	@Test
 	public void testFloatOr() {
-		Object params[] = new Object[]{3.0f, 2.0f};
-		
+		Object params[] = new Object[] { 3.0f, 2.0f };
+
 		Object result = Function.lookup(CoreFunction.class, "|", params);
 		assertNull(result);
 	}
-	
+
+	@Test
 	public void testIntXor() {
-		Object params[] = new Object[]{3, 2};
-		
-		Object result = Function.lookup(CoreFunction.class, "^", params).execute(params);
+		Object params[] = new Object[] { 3, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "^", params)
+				.execute(params);
 		assertEquals(1, result);
 	}
-	
+
+	@Test
 	public void testLongXor() {
 		Long l1 = new Long(3);
 		Long l2 = new Long(2);
 		Long l3 = new Long(1);
-		
-		Object params[] = new Object[]{l1, l2};
-		
-		Object result = Function.lookup(CoreFunction.class, "^", params).execute(params);
+
+		Object params[] = new Object[] { l1, l2 };
+
+		Object result = Function.lookup(CoreFunction.class, "^", params)
+				.execute(params);
 		assertEquals(l3, result);
 	}
-	
+
+	@Test
 	public void testFloatXor() {
-		Object params[] = new Object[]{3.0f, 2.0f};
-		
+		Object params[] = new Object[] { 3.0f, 2.0f };
+
 		Object result = Function.lookup(CoreFunction.class, "^", params);
 		assertNull(result);
 	}
-	
+
+	@Test
 	public void testIntEquals() {
-		Object params[] = new Object[]{3, 3};
-		
-		Object result = Function.lookup(CoreFunction.class, "==", params).execute(params);
+		Object params[] = new Object[] { 3, 3 };
+
+		Object result = Function.lookup(CoreFunction.class, "==", params)
+				.execute(params);
 		assertEquals(true, result);
 	}
-	
+
+	@Test
 	public void testIntNotEquals() {
-		Object params[] = new Object[]{3, 2};
-		
-		Object result = Function.lookup(CoreFunction.class, "==", params).execute(params);
+		Object params[] = new Object[] { 3, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "==", params)
+				.execute(params);
 		assertEquals(false, result);
 	}
-	
+
+	@Test
 	public void testFloatEquals() {
-		Object params[] = new Object[]{3.0f, 3.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "==", params).execute(params);
+		Object params[] = new Object[] { 3.0f, 3.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "==", params)
+				.execute(params);
 		assertEquals(true, result);
 	}
-	
+
+	@Test
 	public void testFloatNotEquals() {
-		Object params[] = new Object[]{3.0f, 2.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "==", params).execute(params);
+		Object params[] = new Object[] { 3.0f, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "==", params)
+				.execute(params);
 		assertEquals(false, result);
 	}
 	
-	public void testIntDifferent() {
-		Object params[] = new Object[]{3, 2};
-		
-		Object result = Function.lookup(CoreFunction.class, "!=", params).execute(params);
+	@Test
+	public void testIntFloatEquals() {
+		Object params[] = new Object[] { 3, 3.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "==", params)
+				.execute(params);
 		assertEquals(true, result);
 	}
 	
-	public void testIntNotDifferent() {
-		Object params[] = new Object[]{3, 3};
-		
-		Object result = Function.lookup(CoreFunction.class, "!=", params).execute(params);
+	@Test
+	public void testFloatIntEquals() {
+		Object params[] = new Object[] { 2.0f, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "==", params)
+				.execute(params);
+		assertEquals(true, result);
+	}
+	
+	@Test
+	public void testIntFloatNotEquals() {
+		Object params[] = new Object[] { 3, 4.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "==", params)
+				.execute(params);
 		assertEquals(false, result);
 	}
 	
+	@Test
+	public void testFloatIntNotEquals() {
+		Object params[] = new Object[] { 4.0f, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "==", params)
+				.execute(params);
+		assertEquals(false, result);
+	}
+
+	@Test
+	public void testIntDifferent() {
+		Object params[] = new Object[] { 3, 2 };
+
+		Object result = Function.lookup(CoreFunction.class, "!=", params)
+				.execute(params);
+		assertEquals(true, result);
+	}
+
+	@Test
+	public void testIntNotDifferent() {
+		Object params[] = new Object[] { 3, 3 };
+
+		Object result = Function.lookup(CoreFunction.class, "!=", params)
+				.execute(params);
+		assertEquals(false, result);
+	}
+
+	@Test
 	public void testFloatDifferent() {
-		Object params[] = new Object[]{3.0f, 2.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "!=", params).execute(params);
+		Object params[] = new Object[] { 3.0f, 2.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "!=", params)
+				.execute(params);
 		assertEquals(true, result);
 	}
-	
+
+	@Test
 	public void testFloatNotDifferent() {
-		Object params[] = new Object[]{3.0f, 3.0f};
-		
-		Object result = Function.lookup(CoreFunction.class, "!=", params).execute(params);
+		Object params[] = new Object[] { 3.0f, 3.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "!=", params)
+				.execute(params);
 		assertEquals(false, result);
 	}
 	
+	@Test
+	public void testIntFloatDifferent() {
+		Object params[] = new Object[] { 3, 4.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "!=", params)
+				.execute(params);
+		assertEquals(true, result);
+	}
+	
+	@Test
+	public void testFloatIntDifferent() {
+		Object params[] = new Object[] { 4.0f, 3 };
+
+		Object result = Function.lookup(CoreFunction.class, "!=", params)
+				.execute(params);
+		assertEquals(true, result);
+	}
+	
+
+	@Test
+	public void testIntFloatNotDifferent() {
+		Object params[] = new Object[] { 3, 3.0f };
+
+		Object result = Function.lookup(CoreFunction.class, "!=", params)
+				.execute(params);
+		assertEquals(false, result);
+	}
+	
+	@Test
+	public void testFloatIntNotDifferent() {
+		Object params[] = new Object[] { 3.0f, 3 };
+
+		Object result = Function.lookup(CoreFunction.class, "!=", params)
+				.execute(params);
+		assertEquals(false, result);
+	}
+
+	@Test
 	public void testIntBitComplement() {
-		Object params[] = new Object[]{9};
-		
-		Object result = Function.lookup(CoreFunction.class, "~", params).execute(params);
+		Object params[] = new Object[] { 9 };
+
+		Object result = Function.lookup(CoreFunction.class, "~", params)
+				.execute(params);
 		assertEquals(-10, result);
-	}	
-	
+	}
+
+	@Test
 	public void testFloatBitComplement() {
-		Object params[] = new Object[]{9.0f};
-		
+		Object params[] = new Object[] { 9.0f };
+
 		Object result = Function.lookup(CoreFunction.class, "~", params);
 		assertNull(result);
-	}	
-	
+	}
+
+	@Test
 	public void testNotTrue() {
-		Object params[] = new Object[]{true};
-		
-		Object result = Function.lookup(CoreFunction.class, "!", params).execute(params);
+		Object params[] = new Object[] { true };
+
+		Object result = Function.lookup(CoreFunction.class, "!", params)
+				.execute(params);
 		assertEquals(false, result);
 	}
-	
+
+	@Test
 	public void testNotFalse() {
-		Object params[] = new Object[]{false};
-		
-		Object result = Function.lookup(CoreFunction.class, "!", params).execute(params);
+		Object params[] = new Object[] { false };
+
+		Object result = Function.lookup(CoreFunction.class, "!", params)
+				.execute(params);
 		assertEquals(true, result);
 	}
 }