tests/spec/unit/optional/opt_math_neg.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: neg_x :: output = -x; |
| 12 | |
| 13 | output let { |
| 14 | constraint assert( |
| 15 | fix(x) + fix(neg_x) = 0 /\ fix(x) = -fix(neg_x), |
| 16 | "incorrect value for -x (x = \(x), -x = \(neg_x))" |
| 17 | ); |
| 18 | } in "Ok"; |