Unify Test anfügen

This commit is contained in:
JanUlrich 2016-04-12 12:14:31 +02:00
parent b0aeaae80e
commit f4d0dbf95d

View File

@ -614,6 +614,55 @@ public class UnifyTest extends Unify {
System.out.println(actual);
}
@Test
public void unifyTestVoid() {
/*
* Constraints Set mit "void" Typen
*/
TypeFactory tf = new TypeFactory();
FiniteClosureBuilder fcb = new FiniteClosureBuilder();
UnifyType tphT1 = tf.getPlaceholderType("T1");
UnifyType tphT2 = tf.getPlaceholderType("T2");
UnifyType tphT3 = tf.getPlaceholderType("T3");
UnifyType tphT4 = tf.getPlaceholderType("T4");
UnifyType tphT5 = tf.getPlaceholderType("T4");
UnifyType integer = tf.getSimpleType("java.lang.Integer");
UnifyType voidType = tf.getSimpleType("void");
UnifyType bool = tf.getSimpleType("java.lang.Boolean");
UnifyType object = tf.getSimpleType("Object");
UnifyType main = tf.getSimpleType("Main");
UnifyType ol = tf.getSimpleType("OL");
fcb.add(integer, object);
fcb.add(main, object);
fcb.add(bool, object);
fcb.add(voidType, object);
fcb.add(ol, object);
IFiniteClosure fc = fcb.getFiniteClosure();
Set<UnifyPair> eq = new HashSet<UnifyPair>();
eq.add(new UnifyPair(tphT1, integer, PairOperator.SMALLERDOT));
eq.add(new UnifyPair(integer, integer, PairOperator.SMALLERDOT));
eq.add(new UnifyPair(tphT1, tphT2, PairOperator.SMALLERDOT));
eq.add(new UnifyPair(tphT2, integer, PairOperator.SMALLERDOT));
eq.add(new UnifyPair(tphT3, bool, PairOperator.SMALLERDOT));
eq.add(new UnifyPair(voidType, tphT4, PairOperator.SMALLERDOT));
eq.add(new UnifyPair(ol, object, PairOperator.SMALLERDOT));
eq.add(new UnifyPair(voidType, voidType, PairOperator.SMALLERDOT));
eq.add(new UnifyPair(ol, tphT5, PairOperator.SMALLERDOT));
eq.add(new UnifyPair(tphT5, ol, PairOperator.SMALLERDOT));
Set<Set<UnifyPair>> expected = new HashSet<>();
Set<Set<UnifyPair>> actual = unify(eq, fc);
System.out.println("Test Void:");
System.out.println(actual);
}
@Test
public void unifyTestSubclasses() {
/*