Debian Codegraph @

tests/spec/unit/general/test_mod_bounds.mzn

raw
1 /***
2 !Test
3 solvers: [gecode]
4 expected: !Result
5 solution: !Solution
6 b: !Range 0..2
7 c: !Range -2..2
8 d: !Range -2..0
9 ***/
10 var 1..10: x;
11 var -10..10: y;
12 var -10..-1: z;
13
14 var -2..3: a;
15
16 any: b :: output = compute_mod_bounds(x, a);
17 any: c :: output = compute_mod_bounds(y, a);
18 any: d :: output = compute_mod_bounds(z, a);
19
20 constraint forall (i in dom(x), j in dom(a) where j != 0) (assert(i mod j in b, "\(i) mod \(j) = \(i mod j) but bounds is \(b)"));
21 constraint forall (i in dom(y), j in dom(a) where j != 0) (assert(i mod j in c, "\(i) mod \(j) = \(i mod j) but bounds is \(c)"));
22 constraint forall (i in dom(z), j in dom(a) where j != 0) (assert(i mod j in d, "\(i) mod \(j) = \(i mod j) but bounds is \(d)"));