Debian Codegraph @

tests/spec/unit/types/tuple_comprehensions.mzn

raw
1 /***
2 !Test
3 solvers: [gecode]
4 expected: !Result
5 status: SATISFIED
6 solution: !Solution
7 simple: [[2, true], [1, false], [0, true], [1, false], [2, true]]
8 indexed: [[4, true], [6, true], [8, true], [9, false], [11, false]]
9 ***/
10
11 array[_] of tuple(int, bool): simple ::output = [
12 (abs(i), abs(i) mod 2 = 0) | i in -2..2
13 ];
14
15 enum Some = {iA, iB, iC, iD, iE};
16 array[_] of int: some_map = [iA: 4, iB: 6, iC: 8, iD: 9, iE: 11];
17
18 array[_] of tuple(int, bool): indexed ::output = [
19 i: (some_map[i], some_map[i] mod 2 = 0) | i in Some
20 ]