diff --git a/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java b/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java index 4ecaa136..43fcf1b4 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 00000000..e2e992a1 --- /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 aadaf6e7..00000000 --- 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 8b62e4e5..00000000 --- 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 abcef013..00000000 --- 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 03452018..3fe7c17d 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 84867cd9..00000000 --- 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 843eee10..00000000 --- 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 abdaa140..00000000 --- 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 8cc587c9..00000000 --- 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 bc0c52ad..00000000 --- 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 864535b3..00000000 --- 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 0181be72..00000000 --- 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