renamed: src/test/java/insertGenerics/AllTests.java -> src/test/java/insertGenerics/TestMutualRecursion.java

modified:   src/test/java/insertGenerics/TestTPHsAndGenerics.java
	modified:   src/test/java/insertGenerics/TestVector.java
Tests angepasst an die GeneratedGenerics
This commit is contained in:
pl@gohorb.ba-horb.de 2021-03-25 18:56:38 +01:00
parent bc378f2fe9
commit 705d0b6a73
3 changed files with 44 additions and 25 deletions

View File

@ -31,7 +31,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class AllTests {
public class TestMutualRecursion {
private static final String rootDirectory = System.getProperty("user.dir")+"/src/test/resources/insertGenericsJav/";
private String pathToClassFile = System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/";
@ -41,7 +41,7 @@ public class AllTests {
private static String className;
@Test
public void TestMutualRecursion() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
public void TestMutualRecursion1() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
className = "TestMutualRecursion";
JavaTXCompiler compiler = new JavaTXCompiler(new File(rootDirectory+className+".jav"));
List<ResultSet> results = compiler.typeInference();
@ -98,12 +98,6 @@ public class AllTests {
execute(new File(rootDirectory+className+".jav"));
}
@Test
public void TestContraVariant() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
className = "TestContraVariant";
execute(new File(rootDirectory+className+".jav"));
}
private static class TestResultSet{
}

View File

@ -56,26 +56,50 @@ public class TestTPHsAndGenerics {
List<GenericGenratorResultForSourceFile> simplifyResultsForAllSourceFiles = compiler.getGeneratedGenericResultsForAllSourceFiles(results);
List<ClassConstraint> classConstraintsTest = new ArrayList<>();
classConstraintsTest.add(new ClassConstraint("UD", "DZP", Relation.EXTENDS));
classConstraintsTest.add(new ClassConstraint("DZP", "ETW", Relation.EXTENDS));
classConstraintsTest.add(new ClassConstraint("ETW", "java/lang/Object", Relation.EXTENDS));
HashMap<String, List<MethodConstraint>> methodConstraintsWithPositionTest = new HashMap<>();
List<MethodConstraint> lmc;
lmc = new ArrayList<>();
lmc.add(new MethodConstraint("AI", "AE", Relation.EXTENDS));
lmc.add(new MethodConstraint("AD", "AI", Relation.EXTENDS));
lmc.add(new MethodConstraint("AB", "AM", Relation.EXTENDS));
lmc.add(new MethodConstraint("AE", "java/lang/Object", Relation.EXTENDS));
lmc.add(new MethodConstraint("AM", "java/lang/Object", Relation.EXTENDS));
methodConstraintsWithPositionTest.put("TPH ABm(TPH ABTPH AD)", lmc);
lmc = new ArrayList<>();
lmc.add(new MethodConstraint("V", "UD", Relation.EXTENDS));
methodConstraintsWithPositionTest.put("TPH ETWid2(TPH V)", lmc);
lmc = new ArrayList<>();
lmc.add(new MethodConstraint("AM", "java/lang/Object", Relation.EXTENDS));
methodConstraintsWithPositionTest.put("TPH AIm2(TPH AMTPH AI)", lmc);
FamilyOfGeneratedGenerics fogg = compiler.fogg;
List<MethodConstraint> lmc;
lmc = new ArrayList<>();
if (fogg.allConstraints.contains((new MethodConstraint("DZP", "ETW", Relation.EXTENDS)))) {
classConstraintsTest.add(new ClassConstraint("UD", "DZP", Relation.EXTENDS));
classConstraintsTest.add(new ClassConstraint("DZP", "ETW", Relation.EXTENDS));
classConstraintsTest.add(new ClassConstraint("ETW", "java/lang/Object", Relation.EXTENDS));
lmc.add(new MethodConstraint("AI", "AE", Relation.EXTENDS));
lmc.add(new MethodConstraint("AD", "AI", Relation.EXTENDS));
lmc.add(new MethodConstraint("AB", "AM", Relation.EXTENDS));
lmc.add(new MethodConstraint("AE", "java/lang/Object", Relation.EXTENDS));
lmc.add(new MethodConstraint("AM", "java/lang/Object", Relation.EXTENDS));
methodConstraintsWithPositionTest.put("TPH ABm(TPH ABTPH AD)", lmc);
lmc = new ArrayList<>();
lmc.add(new MethodConstraint("V", "UD", Relation.EXTENDS));
methodConstraintsWithPositionTest.put("TPH ETWid2(TPH V)", lmc);
lmc = new ArrayList<>();
lmc.add(new MethodConstraint("AM", "java/lang/Object", Relation.EXTENDS));
methodConstraintsWithPositionTest.put("TPH AIm2(TPH AMTPH AI)", lmc);
}
else {
classConstraintsTest.add(new ClassConstraint("ETW", "DZP", Relation.EXTENDS));
classConstraintsTest.add(new ClassConstraint("DZP", "U", Relation.EXTENDS));
classConstraintsTest.add(new ClassConstraint("ETW", "java/lang/Object", Relation.EXTENDS));
lmc.add(new MethodConstraint("AI", "AE", Relation.EXTENDS));
lmc.add(new MethodConstraint("AD", "AI", Relation.EXTENDS));
lmc.add(new MethodConstraint("AB", "AM", Relation.EXTENDS));
lmc.add(new MethodConstraint("AE", "java/lang/Object", Relation.EXTENDS));
lmc.add(new MethodConstraint("AM", "java/lang/Object", Relation.EXTENDS));
methodConstraintsWithPositionTest.put("TPH ABm(TPH ABTPH AD)", lmc);
lmc = new ArrayList<>();
lmc.add(new MethodConstraint("V", "ETW", Relation.EXTENDS));
methodConstraintsWithPositionTest.put("TPH ETWid2(TPH V)", lmc);
lmc = new ArrayList<>();
lmc.add(new MethodConstraint("AM", "java/lang/Object", Relation.EXTENDS));
methodConstraintsWithPositionTest.put("TPH AIm2(TPH AMTPH AI)", lmc);
}
Set<ClassConstraint> computedClassCons = new HashSet<>(fogg.classConstraints);
Set<ClassConstraint> expectedClassCons = new HashSet<>(classConstraintsTest);

View File

@ -63,6 +63,7 @@ public class TestVector {
lmc.add(new MethodConstraint("ZU", "java/lang/Object", Relation.EXTENDS));
methodConstraintsWithPositionTest.put("voidm(java/util/Vectorjava/util/Vector)", lmc);
lmc = new ArrayList<>();
lmc.add(new MethodConstraint("W", "java/lang/Object", Relation.EXTENDS));
methodConstraintsWithPositionTest.put("TPH Wid(TPH W)", lmc);
FamilyOfGeneratedGenerics fogg = compiler.fogg;