summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/ai/fdsolver/SolverTest.java
blob: 3798423bc9358d70a70e1c5b760ac9aab8a2042b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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());
	}
}