diff --git a/src/test/java/inferWildcards/TestInferWildcardsJavaTx.java b/src/test/java/inferWildcards/TestInferWildcardsJavaTx.java deleted file mode 100644 index 374e5ea4..00000000 --- a/src/test/java/inferWildcards/TestInferWildcardsJavaTx.java +++ /dev/null @@ -1,147 +0,0 @@ -package inferWildcards; - -import java.io.File; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import de.dhbwstuttgart.core.JavaTXCompiler; -import de.dhbwstuttgart.inferWildcards.ConstraintsGenerationUtils; -import de.dhbwstuttgart.inferWildcards.TypePlaceholderReplaceUtils; -import de.dhbwstuttgart.syntaxtree.type.RefType; -import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; -import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; -import de.dhbwstuttgart.typeinference.constraints.Pair; -import de.dhbwstuttgart.typeinference.result.ResultSet; - -public class TestInferWildcardsJavaTx -{ - - private String resourcePath; - - @Before - public void setup () { - resourcePath = System.getProperty("user.dir") + "/src/test/resources/inferWildcards"; - } - - private JavaTXCompiler getCompiler (String filename) throws ClassNotFoundException, IOException { - File[] files1 = { new File(resourcePath + "/" + filename) }; - return new JavaTXCompiler(files1); - } - - private static Map generateTph (JavaTXCompiler javaTXCompiler) { - System.out.println("\nReplacements:"); - - return TypePlaceholderReplaceUtils.generateTypePlaceholder(javaTXCompiler); - } - - private static ConstraintSet getGeneratedConstraints (Map tphMap) { - System.out.println("\nGenerated TPH:"); - System.out.println(tphMap); - - return ConstraintsGenerationUtils.generateConstraints(tphMap); - } - - private static ConstraintSet combineConstraints (JavaTXCompiler javaTXCompiler, - ConstraintSet generatedConstraints) - throws ClassNotFoundException, IOException { - System.out.println("\nGenerated Constraints:"); - ConstraintSet constraints = javaTXCompiler.getConstraints(); - constraints.addAll(generatedConstraints); - - System.out.println(constraints); - - return constraints; - } - - @Test - public void testFields () throws Exception { - System.out.println("\n--------- Test Fields --------------\n"); - JavaTXCompiler javaTXCompiler = getCompiler("TestClassWildcardsFields.java"); - - // Manipulate AST - Map tphMap = generateTph(javaTXCompiler); - - // Generate Constraints - ConstraintSet generatedConstraints = getGeneratedConstraints(tphMap); - // System.out.println(generatedConstraints); - - // Constraints - combineConstraints(javaTXCompiler, generatedConstraints); - - List typeInference = javaTXCompiler.typeInference(); - System.out.println(typeInference); - } - - @Test - public void testSingle () throws Exception { - System.out.println("\n--------- Test Single --------------\n"); - JavaTXCompiler javaTXCompiler = getCompiler("TestClassWildcardsSingle.java"); - - // Manipulate AST - Map tphMap = generateTph(javaTXCompiler); - - // Generate Constraints - ConstraintSet generatedConstraints = getGeneratedConstraints(tphMap); - // System.out.println(generatedConstraints); - - // Constraints - combineConstraints(javaTXCompiler, generatedConstraints); - - List typeInference = javaTXCompiler.typeInference(); - System.out.println(typeInference); - } - - - @Test - public void testNested () throws Exception { - System.out.println("\n--------- Test Nested --------------\n"); - JavaTXCompiler javaTXCompiler = getCompiler("TestClassWildcardsNested.java"); - - // Manipulate AST - Map tphMap = generateTph(javaTXCompiler); - - // Generate Constraints - ConstraintSet generatedConstraints = getGeneratedConstraints(tphMap); - // System.out.println(generatedConstraints); - - // Constraints - combineConstraints(javaTXCompiler, generatedConstraints); - } - - @Test - public void testMap () throws Exception { - System.out.println("\n--------- Test Map --------------\n"); - JavaTXCompiler javaTXCompiler = getCompiler("TestClassWildcardsMap.java"); - - // Manipulate AST - Map tphMap = generateTph(javaTXCompiler); - - // Generate Constraints - ConstraintSet generatedConstraints = getGeneratedConstraints(tphMap); - // System.out.println(generatedConstraints); - - // Constraints - combineConstraints(javaTXCompiler, generatedConstraints); - } - - @Test - public void testMapNested () throws Exception { - System.out.println("\n--------- Test Map Nested --------------\n"); - JavaTXCompiler javaTXCompiler = getCompiler("TestClassWildcardsMapNested.java"); - - // Manipulate AST - Map tphMap = generateTph(javaTXCompiler); - - // Generate Constraints - ConstraintSet generatedConstraints = getGeneratedConstraints(tphMap); - // System.out.println(generatedConstraints); - - // Constraints - combineConstraints(javaTXCompiler, generatedConstraints); - } - -}