From 3863968a6e961b99a5adf0d1aece986433b62605 Mon Sep 17 00:00:00 2001 From: NoName11234 <47484268+NoName11234@users.noreply.github.com> Date: Tue, 23 Jan 2024 18:59:39 +0100 Subject: [PATCH] added smallest unify test possible --- src/test/java/typeinference/UnifyTest.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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 {