Debian Codegraph @

tests/spec/unit/compilation/test_zip_unzip.mzn

raw
1 /***
2 !Test
3 solvers: [gecode]
4 expected: !Result
5 solution: !Solution
6 ***/
7
8 array[2..4] of int: a = [2:2, 3:3, 4:4];
9 array[2..4] of bool: b = [2:true, 3:false, 4:true];
10
11 array[2..4] of tuple(int, bool): z = zip(a, b);
12 tuple(array[2..4] of int, array[2..4] of bool): u = unzip(z);
13
14 constraint assert(z[2] = (2, true) /\ z[3] = (3, false) /\ z[4] = (4, true), "Error");
15 constraint assert(u.1 = a /\ u.2 = b, "Error");
16 constraint assert(index_set(z) = index_set(a), "Error");
17
18 output ["OK"];