58 lines
2.3 KiB
Java
58 lines
2.3 KiB
Java
package unify;
|
|
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
import org.junit.Test;
|
|
|
|
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
|
import de.dhbwstuttgart.typinference.unify.model.MPair;
|
|
import de.dhbwstuttgart.typinference.unify.model.Type;
|
|
|
|
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() {
|
|
IFiniteClosure fc = new FiniteClosureBuilder().getCollectionExample();
|
|
TypeFactory tf = new TypeFactory();
|
|
|
|
System.out.println("\n\n----- Smaller Test -----");
|
|
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"))));
|
|
}
|
|
}
|