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

Share project "org.yakindu.sct.model.stext.test" into "https://svn.codespot.com/a/eclipselabs.org/yakindu"

Andreas Mülder 13 лет назад
Родитель
Сommit
95be6a9787

+ 7 - 0
test-plugins/org.yakindu.sct.model.stext.test/.classpath

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

+ 28 - 0
test-plugins/org.yakindu.sct.model.stext.test/.project

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.yakindu.sct.model.stext.test</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

+ 8 - 0
test-plugins/org.yakindu.sct.model.stext.test/.settings/org.eclipse.jdt.core.prefs

@@ -0,0 +1,8 @@
+#Tue Mar 27 16:34:02 CEST 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5

+ 11 - 0
test-plugins/org.yakindu.sct.model.stext.test/META-INF/MANIFEST.MF

@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SText Tests
+Bundle-SymbolicName: org.yakindu.sct.model.stext.test
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: YAKINDU
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.xtext.junit4;bundle-version="2.0.1",
+ org.yakindu.sct.model.sgraph;bundle-version="1.0.0",
+ org.yakindu.sct.model.stext;bundle-version="1.0.0",
+ org.junit;bundle-version="4.8.2"

+ 4 - 0
test-plugins/org.yakindu.sct.model.stext.test/build.properties

@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .

+ 81 - 0
test-plugins/org.yakindu.sct.model.stext.test/pom.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.yakindu.sct</groupId>
+		<artifactId>org.yakindu.sct.releng</artifactId>
+		<version>1.0.0-SNAPSHOT</version>
+		<relativePath>../org.yakindu.sct.releng/pom.xml</relativePath>
+	</parent>
+	<artifactId>org.yakindu.sct.model.stext.test</artifactId>
+	<groupId>org.yakindu.sct.plugins</groupId>
+	<packaging>eclipse-test-plugin</packaging>
+	
+	<profiles>
+		<profile>
+			<id>CI</id>
+			<!-- Test failures are collected by jenkins and evaluated for instable builds -->
+			<properties>
+				<testFailureIgnore>true</testFailureIgnore>
+			</properties>
+		</profile>
+		<profile>
+			<id>macosx</id>
+			<activation>
+				<os>
+					<family>mac</family>
+				</os>
+			</activation>
+			<properties>
+				<test.vmargs>-Xmx512m -XX:MaxPermSize=256m -XstartOnFirstThread</test.vmargs>
+			</properties>
+		</profile>
+		<profile>
+			<id>other-os</id>
+			<activation>
+				<os>
+					<family>!mac</family>
+				</os>
+			</activation>
+			<properties>
+				<test.vmargs>-Xmx512m -XX:MaxPermSize=256m</test.vmargs>
+			</properties>
+		</profile>
+	</profiles>
+	
+	<properties>
+		<testFailureIgnore>false</testFailureIgnore>
+	</properties>
+	
+	<build>
+		<sourceDirectory>src</sourceDirectory>
+		<plugins>
+			<plugin>
+				<groupId>org.eclipse.tycho</groupId>
+				<artifactId>tycho-surefire-plugin</artifactId>
+				<version>${tycho-version}</version>
+				<configuration>
+					<useUIHarness>false</useUIHarness>
+					<useUIThread>false</useUIThread>
+					<testFailureIgnore>${testFailureIgnore}</testFailureIgnore>
+					<argLine>${test.vmargs}</argLine>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.eclipse.tycho</groupId>
+				<artifactId>tycho-source-plugin</artifactId>
+				<version>${tycho-version}</version>
+				<executions>
+					<execution>
+						<id>plugin-source</id>
+						<goals>
+							<goal>plugin-source</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+</project>

+ 36 - 0
test-plugins/org.yakindu.sct.model.stext.test/src-gen/org/yakindu/sct/model/stext/STextInjectorProvider.java

@@ -0,0 +1,36 @@
+/*
+* generated by Xtext
+*/
+package org.yakindu.sct.model.stext;
+
+import org.eclipse.xtext.junit.GlobalRegistries;
+import org.eclipse.xtext.junit.GlobalRegistries.GlobalStateMemento;
+import org.eclipse.xtext.junit4.IInjectorProvider;
+import org.eclipse.xtext.junit4.IRegistryConfigurator;
+
+import com.google.inject.Injector;
+
+public class STextInjectorProvider implements IInjectorProvider, IRegistryConfigurator {
+	private GlobalStateMemento globalStateMemento;
+	private Injector injector;
+
+	static {
+		GlobalRegistries.initializeDefaults();
+	}
+	
+	public Injector getInjector() {
+		if (injector == null) {
+			this.injector = new STextStandaloneSetup().createInjectorAndDoEMFRegistration();
+		}
+		return injector;
+	}
+	
+	public void restoreRegistry() {
+		globalStateMemento.restoreGlobalState();
+	}
+
+	public void setupRegistry() {
+		globalStateMemento = GlobalRegistries.makeCopyOfGlobalState();
+	}
+	
+}

+ 16 - 0
test-plugins/org.yakindu.sct.model.stext.test/src-gen/org/yakindu/sct/model/stext/STextUiInjectorProvider.java

@@ -0,0 +1,16 @@
+/*
+* generated by Xtext
+*/
+package org.yakindu.sct.model.stext;
+
+import org.eclipse.xtext.junit4.IInjectorProvider;
+
+import com.google.inject.Injector;
+
+public class STextUiInjectorProvider implements IInjectorProvider {
+	
+	public Injector getInjector() {
+		return org.yakindu.sct.model.stext.ui.internal.STextActivator.getInstance().getInjector("org.yakindu.sct.model.stext.SText");
+	}
+	
+}

+ 30 - 0
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/STextInjectorProvider.java

@@ -0,0 +1,30 @@
+/**
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.model.stext.test;
+
+import org.eclipse.xtext.junit4.IInjectorProvider;
+import org.yakindu.sct.model.stext.STextRuntimeModule;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class STextInjectorProvider implements IInjectorProvider {
+
+	public Injector getInjector() {
+		return Guice.createInjector(new STextRuntimeModule());
+	}
+
+}

+ 624 - 0
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/StaticTypeAnalyzerTest.java

@@ -0,0 +1,624 @@
+/**
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.model.stext.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.StringReader;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.ParserRule;
+import org.eclipse.xtext.XtextFactory;
+import org.eclipse.xtext.junit4.InjectWith;
+import org.eclipse.xtext.junit4.XtextRunner;
+import org.eclipse.xtext.parser.IParseResult;
+import org.eclipse.xtext.parser.IParser;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.yakindu.base.types.Type;
+import org.yakindu.sct.model.sgraph.Statement;
+import org.yakindu.sct.model.stext.validation.ErrorAcceptor;
+import org.yakindu.sct.model.stext.validation.ITypeAnalyzer;
+import org.yakindu.sct.model.stext.validation.TypeCheckException;
+
+import com.google.inject.Inject;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+@RunWith(XtextRunner.class)
+@InjectWith(STextInjectorProvider.class)
+public class StaticTypeAnalyzerTest {
+
+	@Inject
+	private ITypeAnalyzer analyzer;
+	@Inject
+	IParser parser;
+	@Rule
+	public ExpectedException exception = ExpectedException.none();
+
+	@Before
+	public void setup() {
+		analyzer.setErrorAcceptor(new ErrorAcceptor());
+	}
+
+	// Unary
+	@Test
+	public void testUnarySuccess() {
+		// int
+		assertTrue(analyzer.isInteger(inferType("1")));
+		assertTrue(analyzer.isInteger(inferType("-1")));
+		assertTrue(analyzer.isInteger(inferType("0")));
+		// real
+		assertTrue(analyzer.isReal(inferType("1.0")));
+		assertTrue(analyzer.isReal(inferType("-1.0")));
+		assertTrue(analyzer.isReal(inferType("0.0")));
+		// string
+		assertTrue(analyzer.isString(inferType("'42'")));
+		// boolean
+		assertTrue(analyzer.isBoolean(inferType("true")));
+		assertTrue(analyzer.isBoolean(inferType("false")));
+	}
+
+	// Add
+	@Test
+	public void testAddSuccess() {
+		assertTrue(analyzer.isInteger(inferType("1 + 2")));
+		assertTrue(analyzer.isReal(inferType("1.0 + 2")));
+		assertTrue(analyzer.isReal(inferType("2 + 1.0")));
+		assertTrue(analyzer.isInteger(inferType("1 + 2 + 3.0")));
+	}
+
+	@Test
+	public void testAddException1() {
+		expectOperatorPlusException();
+		inferType("true + 5");
+	}
+
+	@Test
+	public void testAddException2() {
+		expectOperatorPlusException();
+		inferType("false + 5");
+	}
+
+	@Test
+	public void testAddException3() {
+		expectOperatorPlusException();
+		inferType("5 + false");
+	}
+
+	@Test
+	public void testAddException4() {
+		expectOperatorPlusException();
+		inferType("true + (3 * 5)");
+	}
+
+	@Test
+	public void testAddException5() {
+		expectOperatorPlusException();
+		inferType("(3 * 5) + true");
+	}
+
+	@Test
+	public void testAddException6() {
+		expectOperatorPlusException();
+		inferType("3.0 +  true");
+	}
+
+	@Test
+	public void testAddException7() {
+		expectOperatorPlusException();
+		inferType("3.0 + 'string'");
+	}
+
+	// substract
+	@Test
+	public void testSubstractSuccess() {
+		assertTrue(analyzer.isInteger(inferType("1 - 2")));
+		assertTrue(analyzer.isReal(inferType("1.0 - 2")));
+		assertTrue(analyzer.isReal(inferType("2 - 1.0")));
+		assertTrue(analyzer.isInteger(inferType("1 - 2 - 3.0")));
+	}
+
+	@Test
+	public void testSubstractException1() {
+		expectOperatorSubstractException();
+		inferType("true - 5");
+	}
+
+	@Test
+	public void testSubstractException2() {
+		expectOperatorSubstractException();
+		inferType("false - 5");
+	}
+
+	@Test
+	public void testSubstractException3() {
+		expectOperatorSubstractException();
+		inferType("5 - false");
+	}
+
+	@Test
+	public void testSubstractException4() {
+		expectOperatorSubstractException();
+		inferType("true - (3 * 5)");
+	}
+
+	@Test
+	public void testSubstractException5() {
+		expectOperatorSubstractException();
+		inferType("(3 * 5) - true");
+	}
+
+	@Test
+	public void testSubstractException6() {
+		expectOperatorSubstractException();
+		inferType("3.0 -  true");
+	}
+
+	@Test
+	public void testSubstractException7() {
+		expectOperatorSubstractException();
+		inferType("3.0 -  'string'");
+	}
+
+	// multiply
+	@Test
+	public void testMultiplySuccess() {
+		assertTrue(analyzer.isInteger(inferType("1 * 2")));
+		assertTrue(analyzer.isReal(inferType("1.0 * 2")));
+		assertTrue(analyzer.isReal(inferType("2 * 1.0")));
+		assertTrue(analyzer.isInteger(inferType("1 * 2 * 3.0")));
+	}
+
+	@Test
+	public void testMultiplyException1() {
+		expectOperatorMultiplyException();
+		inferType("true * 5");
+	}
+
+	@Test
+	public void testMultiplyException2() {
+		expectOperatorMultiplyException();
+		inferType("false * 5");
+	}
+
+	@Test
+	public void testMultiplyException3() {
+		expectOperatorMultiplyException();
+		inferType("5 * false");
+	}
+
+	@Test
+	public void testMultiplyException4() {
+		expectOperatorMultiplyException();
+		inferType("true * (3 - 5)");
+	}
+
+	@Test
+	public void testMultiplyException5() {
+		expectOperatorMultiplyException();
+		inferType("(3 + 5) * true");
+	}
+
+	@Test
+	public void testMultiplyException6() {
+		expectOperatorMultiplyException();
+		inferType("3.0 *  true");
+	}
+
+	@Test
+	public void testMultiplyException7() {
+		expectOperatorMultiplyException();
+		inferType("3.0 *  'string'");
+	}
+
+	// divide
+	@Test
+	public void testDivideSuccess() {
+		assertTrue(analyzer.isInteger(inferType("1 / 2")));
+		assertTrue(analyzer.isReal(inferType("1.0 / 2")));
+		assertTrue(analyzer.isReal(inferType("2 / 1.0")));
+		assertTrue(analyzer.isInteger(inferType("1 / 2 / 3.0")));
+	}
+
+	@Test
+	public void testDivideException1() {
+		expectOperatorDivideException();
+		inferType("true / 5");
+	}
+
+	@Test
+	public void testDivideException2() {
+		expectOperatorDivideException();
+		inferType("false / 5");
+	}
+
+	@Test
+	public void testDivideException3() {
+		expectOperatorDivideException();
+		inferType("5 / false");
+	}
+
+	@Test
+	public void testDivideException4() {
+		expectOperatorDivideException();
+		inferType("true / (3 - 5)");
+	}
+
+	@Test
+	public void testDivideException5() {
+		expectOperatorDivideException();
+		inferType("(3 + 5) / true");
+	}
+
+	@Test
+	public void testDivideException6() {
+		expectOperatorDivideException();
+		inferType("3.0 /  true");
+	}
+
+	@Test
+	public void testDivideException7() {
+		expectOperatorDivideException();
+		inferType("3.0 /  'string'");
+	}
+
+	// mod
+	@Test
+	public void testModSuccess() {
+		assertTrue(analyzer.isInteger(inferType("1 % 2")));
+		assertTrue(analyzer.isReal(inferType("1.0 % 2")));
+		assertTrue(analyzer.isReal(inferType("2 % 1.0")));
+		assertTrue(analyzer.isInteger(inferType("1 % 2 % 3.0")));
+	}
+
+	@Test
+	public void testModException1() {
+		expectOperatorModException();
+		inferType("true % 5");
+	}
+
+	@Test
+	public void testModException2() {
+		expectOperatorModException();
+		inferType("false % 5");
+	}
+
+	@Test
+	public void testModException3() {
+		expectOperatorModException();
+		inferType("5 % false");
+	}
+
+	@Test
+	public void testModException4() {
+		expectOperatorModException();
+		inferType("true % (3 - 5)");
+	}
+
+	@Test
+	public void testModException5() {
+		expectOperatorModException();
+		inferType("(3 + 5) % true");
+	}
+
+	@Test
+	public void testModException6() {
+		expectOperatorModException();
+		inferType("3.0 % true");
+	}
+
+	@Test
+	public void testModException7() {
+		expectOperatorModException();
+		inferType("3.0 % 'string'");
+	}
+
+	// Logical And Or Not
+	@Test
+	public void testLogicalSuccess() {
+		assertTrue(analyzer.isBoolean(inferType("true || false")));
+		assertTrue(analyzer.isBoolean(inferType("true || false && true")));
+		assertTrue(analyzer
+				.isBoolean(inferType("true || true &&( false || true)")));
+		assertTrue(analyzer.isBoolean(inferType("!true")));
+		assertTrue(analyzer.isBoolean(inferType("!true && !false")));
+	}
+
+	@Test
+	public void testLogicalException1() {
+		expectLogicalAndException();
+		inferType("true && 5");
+	}
+
+	@Test
+	public void testLogicalException2() {
+		expectLogicalOrException();
+		inferType("false || 5");
+	}
+
+	@Test
+	public void testLogicalException3() {
+		expectLogicalAndException();
+		inferType("5 && false");
+	}
+
+	@Test
+	public void testLogicalException4() {
+		expectLogicalAndException();
+		inferType("true && (3 - 5)");
+	}
+
+	@Test
+	public void testLogicalException5() {
+		expectLogicalOrException();
+		inferType("(3 + 5) || true");
+	}
+
+	@Test
+	public void testLogicalException6() {
+		expectLogicalAndException();
+		inferType("3.0 &&  true");
+	}
+
+	@Test
+	public void testLogicalException7() {
+		expectLogicalNotException();
+		inferType("!3");
+	}
+
+	@Test
+	public void testLogicalException8() {
+		expectLogicalNotException();
+		inferType("!1.2");
+	}
+
+	@Test
+	public void testLogicalException9() {
+		expectLogicalNotException();
+		inferType("!'Test'");
+	}
+
+	// LogicalRelation 
+	@Test
+	public void testLogicalRelationSuccess() {
+		assertTrue(analyzer.isBoolean(inferType("5 < 3")));
+		assertTrue(analyzer.isBoolean(inferType("5.0 < 3")));
+
+		assertTrue(analyzer.isBoolean(inferType("5 <= 3")));
+		assertTrue(analyzer.isBoolean(inferType("5.0 <= 3")));
+
+		assertTrue(analyzer.isBoolean(inferType("5 > 3")));
+		assertTrue(analyzer.isBoolean(inferType("5.0 >= 3")));
+
+		assertTrue(analyzer.isBoolean(inferType("5 == 3")));
+		assertTrue(analyzer.isBoolean(inferType("'string' == 'string'")));
+		assertTrue(analyzer.isBoolean(inferType("5.0 == 3")));
+		assertTrue(analyzer.isBoolean(inferType("true == false")));
+
+		assertTrue(analyzer.isBoolean(inferType("5 != 3")));
+		assertTrue(analyzer.isBoolean(inferType("'string' != 'string'")));
+		assertTrue(analyzer.isBoolean(inferType("5.0 != 3")));
+		assertTrue(analyzer.isBoolean(inferType("true != false")));
+	}
+
+	@Test
+	public void testLogicalRelationSmallerException1() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands real and boolean for operator '<'");
+		inferType("3.0 < true");
+	}
+
+	@Test
+	public void testLogicalRelationSmallerException2() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands string and integer for operator '<'");
+		inferType("'string' < 5");
+	}
+
+	@Test
+	public void testLogicalRelationSmallerException3() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands real and boolean for operator '<'");
+		inferType("1.0 < false");
+	}
+
+	@Test
+	public void testLogicalRelationSmallerEqualsException1() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands real and boolean for operator '<='");
+		inferType("3.0 <= true");
+	}
+
+	@Test
+	public void testLogicalRelationSmallerEqualException2() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands string and integer for operator '<='");
+		inferType("'string' <= 5");
+	}
+
+	@Test
+	public void testLogicalRelationSmallerEqualException3() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands real and boolean for operator '<='");
+		inferType("1.0 <= false");
+	}
+
+	@Test
+	public void testLogicalRelationGreaterException1() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands real and boolean for operator '>'");
+		inferType("3.0 > true");
+	}
+
+	@Test
+	public void testLogicalRelationGreaterException2() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands string and integer for operator '>'");
+		inferType("'string' > 5");
+	}
+
+	@Test
+	public void testLogicalRelationGreaterException3() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands real and boolean for operator '>'");
+		inferType("1.0 > false");
+	}
+
+	@Test
+	public void testLogicalRelationGreaterEqualsException1() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands real and boolean for operator '>='");
+		inferType("3.0 >= true");
+	}
+
+	@Test
+	public void testLogicalRelationGreaterEqualException2() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands string and integer for operator '>='");
+		inferType("'string' >= 5");
+	}
+
+	@Test
+	public void testLogicalRelationGreaterEqualException3() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands real and boolean for operator '>='");
+		inferType("1.0 >= false");
+	}
+
+	@Test
+	public void testLogicalRelationEqualsException1() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands real and boolean for operator '=='");
+		inferType("3.0 == true");
+	}
+
+	@Test
+	public void testLogicalRelationEqualException2() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands string and integer for operator '=='");
+		inferType("'string' == 5");
+	}
+
+	@Test
+	public void testLogicalRelationEqualException3() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands real and boolean for operator '=='");
+		inferType("1.0 == false");
+	}
+
+	@Test
+	public void testLogicalRelationNotEqualsException1() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands real and boolean for operator '!='");
+		inferType("3.0 != true");
+	}
+
+	@Test
+	public void testLogicalRelationNotEqualException2() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands string and integer for operator '!='");
+		inferType("'string' != 5");
+	}
+
+	@Test
+	public void testLogicalRelationNotEqualException3() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("Incompatible operands real and boolean for operator '!='");
+		inferType("1.0 != false");
+	}
+
+	@Test
+	public void testComplexExpressionsSuccess() {
+		analyzer.isBoolean(inferType("((((3 * 7) + 5) % 2) > 97) || false"));
+		analyzer.isBoolean(inferType("!true != false && (3 > (7 * 5 + 3))"));
+	}
+
+	// TODO: BitwiseOrExpression, BitwiseAndExpression, BitwiseXOrExpression
+
+	/**
+	 * Convenience from here...
+	 */
+	private void expectOperatorPlusException() {
+		exception.expect(TypeCheckException.class);
+		exception.expectMessage("operator '+' can only be applied to numbers!");
+	}
+
+	private void expectOperatorSubstractException() {
+		exception.expect(TypeCheckException.class);
+		exception.expectMessage("operator '-' can only be applied to numbers!");
+	}
+
+	private void expectOperatorMultiplyException() {
+		exception.expect(TypeCheckException.class);
+		exception.expectMessage("operator '*' can only be applied to numbers!");
+	}
+
+	private void expectOperatorDivideException() {
+		exception.expect(TypeCheckException.class);
+		exception.expectMessage("operator '/' can only be applied to numbers!");
+	}
+
+	private void expectOperatorModException() {
+		exception.expect(TypeCheckException.class);
+		exception.expectMessage("operator '%' can only be applied to numbers!");
+	}
+
+	private void expectLogicalAndException() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("operator '&&' can only be applied to boolean values!");
+	}
+
+	private void expectLogicalOrException() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("operator '||' can only be applied to boolean values!");
+	}
+
+	private void expectLogicalNotException() {
+		exception.expect(TypeCheckException.class);
+		exception
+				.expectMessage("operator '!' can only be applied to boolean values!");
+	}
+
+	protected Type inferType(String expression) {
+		ParserRule rule = XtextFactory.eINSTANCE.createParserRule();
+		rule.setName("Expression");
+		IParseResult parse = parser.parse(rule, new StringReader(expression));
+		EObject statement = parse.getRootASTElement();
+		return analyzer.inferType((Statement) statement);
+	}
+
+}