diff --git a/src/test/java/typeinference/UnifyTest.java b/src/test/java/typeinference/UnifyTest.java index b28a5b99b..469a81dc9 100644 --- a/src/test/java/typeinference/UnifyTest.java +++ b/src/test/java/typeinference/UnifyTest.java @@ -91,6 +91,32 @@ public class UnifyTest { Set> solution = unifyAlgo.unify(undConstraints, oderConstraints, finiteClosure, new NullWriter(), false, urm, tasks); System.out.println(solution.size()); } + + @Test + public void smallUnifyTest(){ + UnifyType type1 = new PlaceholderType("a"); + UnifyType type2 = new ReferenceType("Integer"); + UnifyPair pair1 = new UnifyPair(type1, type2, PairOperator.SMALLERDOT); + + Set undConstraints = new HashSet<>(); + undConstraints.add(pair1); + + List>> oderConstraints = new ArrayList<>(); + + Set constraints = new HashSet<>(); + type1 = new ReferenceType("Object"); + type2 = new ReferenceType("Integer"); + constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER)); + + IFiniteClosure finiteClosure = new FiniteClosure(constraints, new NullWriter()); + + TypeUnify unifyAlgo = new TypeUnify(); + ConstraintSet< Pair> cons = new ConstraintSet<>(); + UnifyResultModel urm = new UnifyResultModel(cons, finiteClosure); + UnifyTaskModel tasks = new UnifyTaskModel(); + Set> solution = unifyAlgo.unify(undConstraints, oderConstraints, finiteClosure, new NullWriter(), false, urm, tasks); + System.out.println(solution.size()); + } /* @Test public void finiteClosure() throws IOException, ClassNotFoundException {