Created first FD-Solver test
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@385 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
25e6f3ec46
commit
ce1b716e12
6 changed files with 105 additions and 0 deletions
28
test/jrummikub/ai/fdsolver/SolverTest.java
Normal file
28
test/jrummikub/ai/fdsolver/SolverTest.java
Normal file
|
@ -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<Integer> x = new Var<Integer>(solver, Arrays.asList(1, 2, 3));
|
||||
Var<Integer> 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());
|
||||
}
|
||||
}
|
Reference in a new issue