From ce1b716e128bef53b140344bf1e58960fa32cba6 Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Wed, 8 Jun 2011 16:23:18 +0200 Subject: Created first FD-Solver test git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@385 72836036-5685-4462-b002-a69064685172 --- test/jrummikub/ai/fdsolver/SolverTest.java | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/jrummikub/ai/fdsolver/SolverTest.java (limited to 'test/jrummikub') diff --git a/test/jrummikub/ai/fdsolver/SolverTest.java b/test/jrummikub/ai/fdsolver/SolverTest.java new file mode 100644 index 0000000..3798423 --- /dev/null +++ b/test/jrummikub/ai/fdsolver/SolverTest.java @@ -0,0 +1,28 @@ +package jrummikub.ai.fdsolver; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; + +import org.junit.Test; + +public class SolverTest { + @Test + public void test() { + Solver solver = new Solver(); + + Var x = new Var(solver, Arrays.asList(1, 2, 3)); + Var y = Var.range(solver, 1,13); + + Constraints.lessThan(solver, y, x); + + while(solver.solve()) { + solver.push(); + Constraints.lessThan(solver, x, x.getValue()); + } + solver.pop(); + + assertEquals(2, (int)x.getValue()); + assertEquals(1, (int)y.getValue()); + } +} -- cgit v1.2.3