Skip to content

Commit 0903036

Browse files
committed
Add tests on reifying table constraints
1 parent 610fb9f commit 0903036

File tree

1 file changed

+26
-0
lines changed
  • solver/src/test/java/org/chocosolver/solver/constraints/nary

1 file changed

+26
-0
lines changed

solver/src/test/java/org/chocosolver/solver/constraints/nary/TableTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,4 +838,30 @@ public void testRnd() {
838838
Assert.assertEquals(model.getSolver().findAllSolutions().size(), 255);
839839
}
840840

841+
@Test(groups = "1s", timeOut = 60000, dataProvider = "algos")
842+
public void testReify(String a) {
843+
Model model = new Model();
844+
IntVar x = model.intVar("x", 0, 6);
845+
IntVar y = model.intVar("y", 1, 5);
846+
IntVar z = model.intVar("y", 2, 4);
847+
848+
x.in(3).post();
849+
y.in(2).post();
850+
z.in(4).post();
851+
852+
Tuples tuples = new Tuples();
853+
tuples.add(2, 2, 2);
854+
tuples.add(3, 3, 3);
855+
tuples.add(4, 4, 4);
856+
857+
BoolVar r = model.table(new IntVar[]{x, y, z}, tuples, a).reify();
858+
859+
try {
860+
model.getSolver().propagate();
861+
} catch (ContradictionException e) {
862+
Assert.fail();
863+
}
864+
Assert.assertTrue(r.isInstantiatedTo(0));
865+
}
866+
841867
}

0 commit comments

Comments
 (0)