Debian Codegraph @

tests/spec/unit/general/assert_good.mzn

raw
1 /***
2 !Test
3 expected: !Result
4 status: SATISFIED
5 solution: !Solution
6 x: 10
7 ***/
8
9 array [1..10] of int: a =
10 [i | i in 1..10];
11
12 % Predicate style assertion.
13 %
14 constraint assert(forall (i in 1..9) (a[i] < a[i + 1]), "a not increasing");
15
16 % Function style assertion.
17 %
18 test even(int: x) = (x mod 2 = 0);
19
20 array [1..10] of int: b =
21 [assert(even(2 * a[i]), "that's odd...", 2 * a[i]) | i in 1..10];
22
23 var 1..10: x;
24
25 constraint b[x] = max(b);
26
27 solve satisfy;