From 9f9a94b5cfb6ed8712ab241ccd9a8cd963653b05 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Wed, 28 Feb 2018 13:22:07 +0100 Subject: [PATCH] =?UTF-8?q?Testf=C3=A4lle=20bereinigen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../syntaxtree/factory/UnifyTypeFactory.java | 5 +- test/javFiles/Expressions.jav | 8 +++ test/typeinference/FacultyTest.java | 9 --- test/typeinference/FiniteClosureTest.java | 9 --- test/typeinference/GenericsTest.java | 10 --- test/typeinference/JavaTXCompilerTest.java | 62 ++++++++++++++++--- test/typeinference/Lambda2Test.java | 9 --- test/typeinference/Lambda3Test.java | 9 --- test/typeinference/LambdaTest.java | 9 --- test/typeinference/MatrixTest.java | 9 --- test/typeinference/RunnableTest.java | 9 --- test/typeinference/VectorTest.java | 9 --- test/typeinference/mathStrucTest.java | 9 --- 13 files changed, 64 insertions(+), 102 deletions(-) create mode 100644 test/javFiles/Expressions.jav delete mode 100644 test/typeinference/FacultyTest.java delete mode 100644 test/typeinference/FiniteClosureTest.java delete mode 100644 test/typeinference/GenericsTest.java delete mode 100644 test/typeinference/Lambda2Test.java delete mode 100644 test/typeinference/Lambda3Test.java delete mode 100644 test/typeinference/LambdaTest.java delete mode 100644 test/typeinference/MatrixTest.java delete mode 100644 test/typeinference/RunnableTest.java delete mode 100644 test/typeinference/VectorTest.java delete mode 100644 test/typeinference/mathStrucTest.java diff --git a/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java b/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java index 4ecaa1366..43fcf1b42 100644 --- a/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java +++ b/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java @@ -127,10 +127,13 @@ public class UnifyTypeFactory { UnifyPair ret = generateSmallerDotPair(UnifyTypeFactory.convert(p.TA1) , UnifyTypeFactory.convert(p.TA2)); return ret; - }else if(p.GetOperator().equals(PairOperator.EQUALSDOT)){ + }else if(p.GetOperator().equals(PairOperator.EQUALSDOT)) { UnifyPair ret = generateEqualDotPair(UnifyTypeFactory.convert(p.TA1) , UnifyTypeFactory.convert(p.TA2)); return ret; + }else if(p.GetOperator().equals(PairOperator.SMALLER)){ + return generateSmallerPair(UnifyTypeFactory.convert(p.TA1), + UnifyTypeFactory.convert(p.TA2)); }else throw new NotImplementedException(); } diff --git a/test/javFiles/Expressions.jav b/test/javFiles/Expressions.jav new file mode 100644 index 000000000..e2e992a12 --- /dev/null +++ b/test/javFiles/Expressions.jav @@ -0,0 +1,8 @@ +class Expressions{ + +void test(){ + var x = 2; + x = x + 2; +} + +} \ No newline at end of file diff --git a/test/typeinference/FacultyTest.java b/test/typeinference/FacultyTest.java deleted file mode 100644 index aadaf6e72..000000000 --- a/test/typeinference/FacultyTest.java +++ /dev/null @@ -1,9 +0,0 @@ -package typeinference; - -import java.io.File; - -public class FacultyTest extends JavaTXCompilerTest{ - public FacultyTest() { - this.fileToTest = new File(rootDirectory+"Faculty.jav"); - } -} \ No newline at end of file diff --git a/test/typeinference/FiniteClosureTest.java b/test/typeinference/FiniteClosureTest.java deleted file mode 100644 index 8b62e4e5d..000000000 --- a/test/typeinference/FiniteClosureTest.java +++ /dev/null @@ -1,9 +0,0 @@ -package typeinference; - -import java.io.File; - -public class FiniteClosureTest extends JavaTXCompilerTest{ - public FiniteClosureTest() { -// this.fileToTest = new File(rootDirectory+"fc.jav"); - } -} \ No newline at end of file diff --git a/test/typeinference/GenericsTest.java b/test/typeinference/GenericsTest.java deleted file mode 100644 index abcef0133..000000000 --- a/test/typeinference/GenericsTest.java +++ /dev/null @@ -1,10 +0,0 @@ -package typeinference; - -import java.io.File; - -//TODO: Hier gibt es einen Fehler. Das erstellte ConstraintSet stimmt nicht -public class GenericsTest extends JavaTXCompilerTest{ - public GenericsTest() { - this.fileToTest = new File(rootDirectory+"Generics.jav"); - } -} \ No newline at end of file diff --git a/test/typeinference/JavaTXCompilerTest.java b/test/typeinference/JavaTXCompilerTest.java index 03452018e..3fe7c17da 100644 --- a/test/typeinference/JavaTXCompilerTest.java +++ b/test/typeinference/JavaTXCompilerTest.java @@ -23,19 +23,57 @@ import java.util.Set; public class JavaTXCompilerTest { public static final String rootDirectory = System.getProperty("user.dir")+"/test/javFiles/"; - private static final List filesToTest = new ArrayList<>(); - protected File fileToTest = null; - public JavaTXCompilerTest(){ + @Test + public void finiteClosure() throws IOException, ClassNotFoundException { + execute(new File(rootDirectory+"fc.jav")); } @Test - public void test() throws IOException, ClassNotFoundException { - if(fileToTest != null)filesToTest.add(fileToTest); - else return; - //filesToTest.add(new File(rootDirectory+"Faculty.jav")); - //filesToTest.add(new File(rootDirectory+"mathStruc.jav")); - //filesToTest.add(new File(rootDirectory+"test.jav")); - filesToTest.add(new File(rootDirectory+"EmptyMethod.jav")); + public void lambda() throws IOException, ClassNotFoundException { + execute(new File(rootDirectory+"Lambda.jav")); + } + @Test + public void lambda2() throws IOException, ClassNotFoundException { + execute(new File(rootDirectory+"Lambda2.jav")); + } + @Test + public void lambda3() throws IOException, ClassNotFoundException { + execute(new File(rootDirectory+"Lambda3.jav")); + } + @Test + public void mathStruc() throws IOException, ClassNotFoundException { + execute(new File(rootDirectory+"mathStruc.jav")); + } + @Test + public void generics() throws IOException, ClassNotFoundException { + execute(new File(rootDirectory+"Generics.jav")); + } + @Test + public void faculty() throws IOException, ClassNotFoundException { + execute(new File(rootDirectory+"Faculty.jav")); + } + @Test + public void matrix() throws IOException, ClassNotFoundException { + execute(new File(rootDirectory+"Matrix.jav")); + } + @Test + public void vector() throws IOException, ClassNotFoundException { + execute(new File(rootDirectory+"Vector.jav")); + } + @Test + public void lambdaRunnable() throws IOException, ClassNotFoundException { + execute(new File(rootDirectory+"LambdaRunnable.jav")); + } + @Test + public void expressions() throws IOException, ClassNotFoundException { + execute(new File(rootDirectory+"Expressions.jav")); + } + + private static class TestResultSet{ + + } + + public TestResultSet execute(File fileToTest) throws IOException, ClassNotFoundException { //filesToTest.add(new File(rootDirectory+"fc.jav")); //filesToTest.add(new File(rootDirectory+"Lambda.jav")); //filesToTest.add(new File(rootDirectory+"Lambda2.jav")); @@ -45,6 +83,9 @@ public class JavaTXCompilerTest { //filesToTest.add(new File(rootDirectory+"MethodsEasy.jav")); //filesToTest.add(new File(rootDirectory+"Matrix.jav")); //filesToTest.add(new File(rootDirectory+"Import.jav")); + // //filesToTest.add(new File(rootDirectory+"Faculty.jav")); + // //filesToTest.add(new File(rootDirectory+"mathStruc.jav")); + // //filesToTest.add(new File(rootDirectory+"test.jav")); JavaTXCompiler compiler = new JavaTXCompiler(fileToTest); List results = compiler.typeInference(); @@ -68,6 +109,7 @@ public class JavaTXCompilerTest { System.out.println(s); } } + return new TestResultSet(); } static String readFile(String path, Charset encoding) diff --git a/test/typeinference/Lambda2Test.java b/test/typeinference/Lambda2Test.java deleted file mode 100644 index 84867cd92..000000000 --- a/test/typeinference/Lambda2Test.java +++ /dev/null @@ -1,9 +0,0 @@ -package typeinference; - -import java.io.File; - -public class Lambda2Test extends JavaTXCompilerTest{ - public Lambda2Test() { - this.fileToTest = new File(rootDirectory+"Lambda2.jav"); - } -} \ No newline at end of file diff --git a/test/typeinference/Lambda3Test.java b/test/typeinference/Lambda3Test.java deleted file mode 100644 index 843eee108..000000000 --- a/test/typeinference/Lambda3Test.java +++ /dev/null @@ -1,9 +0,0 @@ -package typeinference; - -import java.io.File; - -public class Lambda3Test extends JavaTXCompilerTest{ - public Lambda3Test() { - this.fileToTest = new File(rootDirectory+"Lambda3.jav"); - } -} \ No newline at end of file diff --git a/test/typeinference/LambdaTest.java b/test/typeinference/LambdaTest.java deleted file mode 100644 index abdaa1404..000000000 --- a/test/typeinference/LambdaTest.java +++ /dev/null @@ -1,9 +0,0 @@ -package typeinference; - -import java.io.File; - -public class LambdaTest extends JavaTXCompilerTest{ - public LambdaTest() { - this.fileToTest = new File(rootDirectory+"Lambda.jav"); - } -} \ No newline at end of file diff --git a/test/typeinference/MatrixTest.java b/test/typeinference/MatrixTest.java deleted file mode 100644 index 8cc587c9b..000000000 --- a/test/typeinference/MatrixTest.java +++ /dev/null @@ -1,9 +0,0 @@ -package typeinference; - -import java.io.File; - -public class MatrixTest extends JavaTXCompilerTest{ - public MatrixTest() { - this.fileToTest = new File(rootDirectory+"Matrix.jav"); - } -} \ No newline at end of file diff --git a/test/typeinference/RunnableTest.java b/test/typeinference/RunnableTest.java deleted file mode 100644 index bc0c52ad1..000000000 --- a/test/typeinference/RunnableTest.java +++ /dev/null @@ -1,9 +0,0 @@ -package typeinference; - -import java.io.File; - -public class RunnableTest extends JavaTXCompilerTest{ - public RunnableTest() { - this.fileToTest = new File(rootDirectory+"LambdaRunnable.jav"); - } -} \ No newline at end of file diff --git a/test/typeinference/VectorTest.java b/test/typeinference/VectorTest.java deleted file mode 100644 index 864535b3a..000000000 --- a/test/typeinference/VectorTest.java +++ /dev/null @@ -1,9 +0,0 @@ -package typeinference; - -import java.io.File; - -public class VectorTest extends JavaTXCompilerTest{ - public VectorTest() { - this.fileToTest = new File(rootDirectory+"Vector.jav"); - } -} \ No newline at end of file diff --git a/test/typeinference/mathStrucTest.java b/test/typeinference/mathStrucTest.java deleted file mode 100644 index 0181be72d..000000000 --- a/test/typeinference/mathStrucTest.java +++ /dev/null @@ -1,9 +0,0 @@ -package typeinference; - -import java.io.File; - -public class mathStrucTest extends JavaTXCompilerTest{ - public mathStrucTest() { - this.fileToTest = new File(rootDirectory+"mathStruc.jav"); - } -} \ No newline at end of file