forked from JavaTX/JavaCompilerCore
Testfälle bereinigen
This commit is contained in:
parent
b66d06a165
commit
9f9a94b5cf
@ -127,10 +127,13 @@ public class UnifyTypeFactory {
|
|||||||
UnifyPair ret = generateSmallerDotPair(UnifyTypeFactory.convert(p.TA1)
|
UnifyPair ret = generateSmallerDotPair(UnifyTypeFactory.convert(p.TA1)
|
||||||
, UnifyTypeFactory.convert(p.TA2));
|
, UnifyTypeFactory.convert(p.TA2));
|
||||||
return ret;
|
return ret;
|
||||||
}else if(p.GetOperator().equals(PairOperator.EQUALSDOT)){
|
}else if(p.GetOperator().equals(PairOperator.EQUALSDOT)) {
|
||||||
UnifyPair ret = generateEqualDotPair(UnifyTypeFactory.convert(p.TA1)
|
UnifyPair ret = generateEqualDotPair(UnifyTypeFactory.convert(p.TA1)
|
||||||
, UnifyTypeFactory.convert(p.TA2));
|
, UnifyTypeFactory.convert(p.TA2));
|
||||||
return ret;
|
return ret;
|
||||||
|
}else if(p.GetOperator().equals(PairOperator.SMALLER)){
|
||||||
|
return generateSmallerPair(UnifyTypeFactory.convert(p.TA1),
|
||||||
|
UnifyTypeFactory.convert(p.TA2));
|
||||||
}else throw new NotImplementedException();
|
}else throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
test/javFiles/Expressions.jav
Normal file
8
test/javFiles/Expressions.jav
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
class Expressions{
|
||||||
|
|
||||||
|
void test(){
|
||||||
|
var x = 2;
|
||||||
|
x = x + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,9 +0,0 @@
|
|||||||
package typeinference;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class FacultyTest extends JavaTXCompilerTest{
|
|
||||||
public FacultyTest() {
|
|
||||||
this.fileToTest = new File(rootDirectory+"Faculty.jav");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package typeinference;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class FiniteClosureTest extends JavaTXCompilerTest{
|
|
||||||
public FiniteClosureTest() {
|
|
||||||
// this.fileToTest = new File(rootDirectory+"fc.jav");
|
|
||||||
}
|
|
||||||
}
|
|
@ -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");
|
|
||||||
}
|
|
||||||
}
|
|
@ -23,19 +23,57 @@ import java.util.Set;
|
|||||||
public class JavaTXCompilerTest {
|
public class JavaTXCompilerTest {
|
||||||
|
|
||||||
public static final String rootDirectory = System.getProperty("user.dir")+"/test/javFiles/";
|
public static final String rootDirectory = System.getProperty("user.dir")+"/test/javFiles/";
|
||||||
private static final List<File> filesToTest = new ArrayList<>();
|
|
||||||
protected File fileToTest = null;
|
|
||||||
|
|
||||||
public JavaTXCompilerTest(){
|
@Test
|
||||||
|
public void finiteClosure() throws IOException, ClassNotFoundException {
|
||||||
|
execute(new File(rootDirectory+"fc.jav"));
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
public void test() throws IOException, ClassNotFoundException {
|
public void lambda() throws IOException, ClassNotFoundException {
|
||||||
if(fileToTest != null)filesToTest.add(fileToTest);
|
execute(new File(rootDirectory+"Lambda.jav"));
|
||||||
else return;
|
}
|
||||||
//filesToTest.add(new File(rootDirectory+"Faculty.jav"));
|
@Test
|
||||||
//filesToTest.add(new File(rootDirectory+"mathStruc.jav"));
|
public void lambda2() throws IOException, ClassNotFoundException {
|
||||||
//filesToTest.add(new File(rootDirectory+"test.jav"));
|
execute(new File(rootDirectory+"Lambda2.jav"));
|
||||||
filesToTest.add(new File(rootDirectory+"EmptyMethod.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+"fc.jav"));
|
||||||
//filesToTest.add(new File(rootDirectory+"Lambda.jav"));
|
//filesToTest.add(new File(rootDirectory+"Lambda.jav"));
|
||||||
//filesToTest.add(new File(rootDirectory+"Lambda2.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+"MethodsEasy.jav"));
|
||||||
//filesToTest.add(new File(rootDirectory+"Matrix.jav"));
|
//filesToTest.add(new File(rootDirectory+"Matrix.jav"));
|
||||||
//filesToTest.add(new File(rootDirectory+"Import.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);
|
JavaTXCompiler compiler = new JavaTXCompiler(fileToTest);
|
||||||
|
|
||||||
List<ResultSet> results = compiler.typeInference();
|
List<ResultSet> results = compiler.typeInference();
|
||||||
@ -68,6 +109,7 @@ public class JavaTXCompilerTest {
|
|||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return new TestResultSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
static String readFile(String path, Charset encoding)
|
static String readFile(String path, Charset encoding)
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
package typeinference;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class Lambda2Test extends JavaTXCompilerTest{
|
|
||||||
public Lambda2Test() {
|
|
||||||
this.fileToTest = new File(rootDirectory+"Lambda2.jav");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package typeinference;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class Lambda3Test extends JavaTXCompilerTest{
|
|
||||||
public Lambda3Test() {
|
|
||||||
this.fileToTest = new File(rootDirectory+"Lambda3.jav");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package typeinference;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class LambdaTest extends JavaTXCompilerTest{
|
|
||||||
public LambdaTest() {
|
|
||||||
this.fileToTest = new File(rootDirectory+"Lambda.jav");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package typeinference;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class MatrixTest extends JavaTXCompilerTest{
|
|
||||||
public MatrixTest() {
|
|
||||||
this.fileToTest = new File(rootDirectory+"Matrix.jav");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package typeinference;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class RunnableTest extends JavaTXCompilerTest{
|
|
||||||
public RunnableTest() {
|
|
||||||
this.fileToTest = new File(rootDirectory+"LambdaRunnable.jav");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package typeinference;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class VectorTest extends JavaTXCompilerTest{
|
|
||||||
public VectorTest() {
|
|
||||||
this.fileToTest = new File(rootDirectory+"Vector.jav");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package typeinference;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class mathStrucTest extends JavaTXCompilerTest{
|
|
||||||
public mathStrucTest() {
|
|
||||||
this.fileToTest = new File(rootDirectory+"mathStruc.jav");
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user