Debian Codegraph @

tests/spec/unit/optional/opt_math_abs.mzn

raw
1 /***
2 !Test
3 solvers: [gecode]
4 options:
5 all_solutions: true
6 expected: !Result
7 solution: !Solution
8 ***/
9
10 var opt -1..1: x;
11 var opt int: abs_x :: output = abs(x);
12
13 output let {
14 constraint assert(
15 fix(abs_x) >= 0 /\ (fix(x) = fix(abs_x) \/ fix(x) = -fix(abs_x)) /\ fix(abs_x) = abs(fix(x)),
16 "incorrect value for abs(x) (x = \(x), abs(x) = \(abs_x))"
17 );
18 } in "Ok";