Delete outdated test class
This commit is contained in:
parent
1509e21214
commit
f698c967c0
@ -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<TypePlaceholder, RefType> generateTph (JavaTXCompiler javaTXCompiler) {
|
|
||||||
System.out.println("\nReplacements:");
|
|
||||||
|
|
||||||
return TypePlaceholderReplaceUtils.generateTypePlaceholder(javaTXCompiler);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ConstraintSet<Pair> getGeneratedConstraints (Map<TypePlaceholder, RefType> tphMap) {
|
|
||||||
System.out.println("\nGenerated TPH:");
|
|
||||||
System.out.println(tphMap);
|
|
||||||
|
|
||||||
return ConstraintsGenerationUtils.generateConstraints(tphMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ConstraintSet<Pair> combineConstraints (JavaTXCompiler javaTXCompiler,
|
|
||||||
ConstraintSet<Pair> generatedConstraints)
|
|
||||||
throws ClassNotFoundException, IOException {
|
|
||||||
System.out.println("\nGenerated Constraints:");
|
|
||||||
ConstraintSet<Pair> 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<TypePlaceholder, RefType> tphMap = generateTph(javaTXCompiler);
|
|
||||||
|
|
||||||
// Generate Constraints
|
|
||||||
ConstraintSet<Pair> generatedConstraints = getGeneratedConstraints(tphMap);
|
|
||||||
// System.out.println(generatedConstraints);
|
|
||||||
|
|
||||||
// Constraints
|
|
||||||
combineConstraints(javaTXCompiler, generatedConstraints);
|
|
||||||
|
|
||||||
List<ResultSet> 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<TypePlaceholder, RefType> tphMap = generateTph(javaTXCompiler);
|
|
||||||
|
|
||||||
// Generate Constraints
|
|
||||||
ConstraintSet<Pair> generatedConstraints = getGeneratedConstraints(tphMap);
|
|
||||||
// System.out.println(generatedConstraints);
|
|
||||||
|
|
||||||
// Constraints
|
|
||||||
combineConstraints(javaTXCompiler, generatedConstraints);
|
|
||||||
|
|
||||||
List<ResultSet> 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<TypePlaceholder, RefType> tphMap = generateTph(javaTXCompiler);
|
|
||||||
|
|
||||||
// Generate Constraints
|
|
||||||
ConstraintSet<Pair> 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<TypePlaceholder, RefType> tphMap = generateTph(javaTXCompiler);
|
|
||||||
|
|
||||||
// Generate Constraints
|
|
||||||
ConstraintSet<Pair> 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<TypePlaceholder, RefType> tphMap = generateTph(javaTXCompiler);
|
|
||||||
|
|
||||||
// Generate Constraints
|
|
||||||
ConstraintSet<Pair> generatedConstraints = getGeneratedConstraints(tphMap);
|
|
||||||
// System.out.println(generatedConstraints);
|
|
||||||
|
|
||||||
// Constraints
|
|
||||||
combineConstraints(javaTXCompiler, generatedConstraints);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user