Improve log of test

This commit is contained in:
Till Schnell 2021-04-08 18:45:14 +02:00
parent 044d9a1860
commit 5f7829191c

View File

@ -33,6 +33,7 @@ public class TestInferWildcardsJavaTx
} }
private ReplaceTypeparamVisitor generateTph (JavaTXCompiler javaTXCompiler) { private ReplaceTypeparamVisitor generateTph (JavaTXCompiler javaTXCompiler) {
System.out.println("\nReplacements:");
Map<File, SourceFile> sourceFiles = javaTXCompiler.getSourceFiles(); Map<File, SourceFile> sourceFiles = javaTXCompiler.getSourceFiles();
ReplaceTypeparamVisitor visitor = new ReplaceTypeparamVisitor(); ReplaceTypeparamVisitor visitor = new ReplaceTypeparamVisitor();
sourceFiles.entrySet().forEach(e -> e.getValue().accept(visitor)); sourceFiles.entrySet().forEach(e -> e.getValue().accept(visitor));
@ -40,6 +41,7 @@ public class TestInferWildcardsJavaTx
} }
private ConstraintSet getGeneratedConstraints (ReplaceTypeparamVisitor visitor) { private ConstraintSet getGeneratedConstraints (ReplaceTypeparamVisitor visitor) {
System.out.println("\nGenerated TPH:");
Map<TypePlaceholder, RefType> tphMap = visitor.getTphMap(); Map<TypePlaceholder, RefType> tphMap = visitor.getTphMap();
System.out.println(tphMap); System.out.println(tphMap);
return ConstraintsGenerationUtils.generateConstraints(tphMap); return ConstraintsGenerationUtils.generateConstraints(tphMap);
@ -47,6 +49,7 @@ public class TestInferWildcardsJavaTx
private ConstraintSet<Pair> combineConstraints (JavaTXCompiler javaTXCompiler, ConstraintSet generatedConstraints) private ConstraintSet<Pair> combineConstraints (JavaTXCompiler javaTXCompiler, ConstraintSet generatedConstraints)
throws ClassNotFoundException, IOException { throws ClassNotFoundException, IOException {
System.out.println("\nGenerated Constraints:");
ConstraintSet<Pair> constraints = javaTXCompiler.getConstraints(); ConstraintSet<Pair> constraints = javaTXCompiler.getConstraints();
constraints.addAll(generatedConstraints); constraints.addAll(generatedConstraints);
@ -57,6 +60,7 @@ public class TestInferWildcardsJavaTx
@Test @Test
public void testSingle () throws Exception { public void testSingle () throws Exception {
System.out.println("\n--------- Test Single --------------\n");
JavaTXCompiler javaTXCompiler = getCompiler("TestClassWildcardsSingle.java"); JavaTXCompiler javaTXCompiler = getCompiler("TestClassWildcardsSingle.java");
// Manipulate AST // Manipulate AST
@ -67,7 +71,7 @@ public class TestInferWildcardsJavaTx
// System.out.println(generatedConstraints); // System.out.println(generatedConstraints);
// Constraints // Constraints
ConstraintSet<Pair> constraints = combineConstraints(javaTXCompiler, generatedConstraints); combineConstraints(javaTXCompiler, generatedConstraints);
// List<ResultSet> typeInference = javaTXCompiler.typeInference(); // List<ResultSet> typeInference = javaTXCompiler.typeInference();
// System.out.println(typeInference); // System.out.println(typeInference);
@ -76,6 +80,7 @@ public class TestInferWildcardsJavaTx
@Test @Test
public void testNested () throws Exception { public void testNested () throws Exception {
System.out.println("\n--------- Test Nested --------------\n");
JavaTXCompiler javaTXCompiler = getCompiler("TestClassWildcardsNested.java"); JavaTXCompiler javaTXCompiler = getCompiler("TestClassWildcardsNested.java");
// Manipulate AST // Manipulate AST
@ -86,14 +91,12 @@ public class TestInferWildcardsJavaTx
// System.out.println(generatedConstraints); // System.out.println(generatedConstraints);
// Constraints // Constraints
ConstraintSet<Pair> constraints = combineConstraints(javaTXCompiler, generatedConstraints); combineConstraints(javaTXCompiler, generatedConstraints);
// List<ResultSet> typeInference = javaTXCompiler.typeInference();
// System.out.println(typeInference);
} }
@Test @Test
public void testMap () throws Exception { public void testMap () throws Exception {
System.out.println("\n--------- Test Map --------------\n");
JavaTXCompiler javaTXCompiler = getCompiler("TestClassWildcardsMap.java"); JavaTXCompiler javaTXCompiler = getCompiler("TestClassWildcardsMap.java");
// Manipulate AST // Manipulate AST
@ -104,14 +107,12 @@ public class TestInferWildcardsJavaTx
// System.out.println(generatedConstraints); // System.out.println(generatedConstraints);
// Constraints // Constraints
ConstraintSet<Pair> constraints = combineConstraints(javaTXCompiler, generatedConstraints); combineConstraints(javaTXCompiler, generatedConstraints);
// List<ResultSet> typeInference = javaTXCompiler.typeInference();
// System.out.println(typeInference);
} }
@Test @Test
public void testMapNested () throws Exception { public void testMapNested () throws Exception {
System.out.println("\n--------- Test Map Nested --------------\n");
JavaTXCompiler javaTXCompiler = getCompiler("TestClassWildcardsMapNested.java"); JavaTXCompiler javaTXCompiler = getCompiler("TestClassWildcardsMapNested.java");
// Manipulate AST // Manipulate AST
@ -122,10 +123,7 @@ public class TestInferWildcardsJavaTx
// System.out.println(generatedConstraints); // System.out.println(generatedConstraints);
// Constraints // Constraints
ConstraintSet<Pair> constraints = combineConstraints(javaTXCompiler, generatedConstraints); combineConstraints(javaTXCompiler, generatedConstraints);
// List<ResultSet> typeInference = javaTXCompiler.typeInference();
// System.out.println(typeInference);
} }
} }