tests/spec/unit/general/assert_bad_2.mzn
raw| 1 | /*** |
| 2 | !Test |
| 3 | expected: !Error |
| 4 | type: AssertionError |
| 5 | ***/ |
| 6 | |
| 7 | array [1..10] of int: a = |
| 8 | [i | i in 1..10]; |
| 9 | |
| 10 | % Function style assertion. |
| 11 | % |
| 12 | test odd(int: x) = (x mod 2 = 1); |
| 13 | |
| 14 | array [1..10] of int: b = |
| 15 | [assert(odd(2 * a[i]), "that's odd...", 2 * a[i]) | i in 1..10]; |
| 16 | |
| 17 | var 1..10: x; |
| 18 | |
| 19 | constraint b[x] = max(b); |
| 20 | |
| 21 | solve satisfy; |