forked from JavaTX/JavaCompilerCore
d19a79bd63
(muss noch getestet werden)
66 lines
2.7 KiB
Java
66 lines
2.7 KiB
Java
package unify;
|
|
|
|
import org.junit.Test;
|
|
|
|
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
|
import de.dhbwstuttgart.typeinference.unify.model.MPair;
|
|
import de.dhbwstuttgart.typeinference.unify.model.MPair.PairOperator;
|
|
import de.dhbwstuttgart.typeinference.unifynew.TypeFactory;
|
|
|
|
public class FiniteClosureTest {
|
|
|
|
@Test
|
|
public void testGreater() {
|
|
IFiniteClosure fc = new FiniteClosureBuilder().getCollectionExample();
|
|
TypeFactory tf = new TypeFactory();
|
|
|
|
System.out.println("\n\n----- Greater Test -----");
|
|
System.out.println("Greater(LinkedList<T>) = " + fc.greater(tf.getSimpleType("LinkedList", "T")));
|
|
System.out.println("Greater(TreeSet<T>) = " + fc.greater(tf.getSimpleType("TreeSet", "T")));
|
|
System.out.println("Greater(Collection) = " + fc.greater(tf.getSimpleType("Collection")));
|
|
}
|
|
|
|
@Test
|
|
public void testGrArg() {
|
|
IFiniteClosure fc = new FiniteClosureBuilder().getCollectionExample();
|
|
TypeFactory tf = new TypeFactory();
|
|
|
|
System.out.println("\n\n----- GrArg Test -----");
|
|
System.out.println("GrArg(List<T>) = " + fc.grArg(tf.getSimpleType("List", "T")));
|
|
System.out.println("GrArg(? extends List<T>) = " + fc.grArg(tf.getExtendsType(tf.getSimpleType("List", "T"))));
|
|
System.out.println("GrArg(? super List<T>) = " + fc.grArg(tf.getSuperType(tf.getSimpleType("List", "T"))));
|
|
}
|
|
|
|
@Test
|
|
public void testSmaller() {
|
|
FiniteClosureBuilder fcb = new FiniteClosureBuilder();
|
|
TypeFactory tf = new TypeFactory();
|
|
|
|
fcb.add(tf.getSimpleType("Integer"), tf.getSimpleType("Number"));
|
|
IFiniteClosure fc = fcb.getCollectionExample();
|
|
|
|
System.out.println("\n\n----- Smaller Test -----");
|
|
System.out.println("Smaller(List<? extends Number>) = " + fc.smaller(tf.getSimpleType("List", tf.getExtendsType(tf.getSimpleType("Number")))));
|
|
System.out.println("Smaller(List<T>) = " + fc.smaller(tf.getSimpleType("List", "T")));
|
|
System.out.println("Smaller(TreeSet<T>) = " + fc.smaller(tf.getSimpleType("TreeSet", "T")));
|
|
System.out.println("Smaller(Collection) = " + fc.smaller(tf.getSimpleType("Collection")));
|
|
}
|
|
|
|
@Test
|
|
public void testSmArg() {
|
|
IFiniteClosure fc = new FiniteClosureBuilder().getCollectionExample();
|
|
TypeFactory tf = new TypeFactory();
|
|
|
|
System.out.println("\n\n----- SmArg Test -----");
|
|
System.out.println("SmArg(List<T>) = " + fc.smArg(tf.getSimpleType("List", "T")));
|
|
System.out.println("SmArg(? extends List<T>) = " + fc.smArg(tf.getExtendsType(tf.getSimpleType("List", "T"))));
|
|
System.out.println("SmArg(? super List<T>) = " + fc.smArg(tf.getSuperType(tf.getSimpleType("List", "T"))));
|
|
}
|
|
|
|
@Test
|
|
public void testGetGenericType() {
|
|
|
|
// TODO
|
|
}
|
|
}
|