| 1 |
/*** |
| 2 |
!Test |
| 3 |
solvers: [gecode] |
| 4 |
expected: !Result |
| 5 |
status: SATISFIED |
| 6 |
solution: !Solution |
| 7 |
bool_output: 3 |
| 8 |
int_output: 1 |
| 9 |
float_output: 2 |
| 10 |
indexed_output: 4 |
| 11 |
enumed_output: "TWO" |
| 12 |
***/ |
| 13 |
|
| 14 |
% Base cases |
| 15 |
array[int] of int: bool_array = [false, false, true, true]; |
| 16 |
var int: bool_output ::add_to_output = arg_max(bool_array); |
| 17 |
|
| 18 |
array[int] of int: int_array = [-4,-5,-4]; |
| 19 |
var int: int_output ::add_to_output = arg_max(int_array); |
| 20 |
|
| 21 |
array[int] of float: float_array = [1.4, 4.3, 2.3, 4.2]; |
| 22 |
var int: float_output ::add_to_output = arg_max(float_array); |
| 23 |
|
| 24 |
% Test using arrays not starting at 1 |
| 25 |
array[3..5] of int: indexed_array = array1d(3..5, [4,5,3]); |
| 26 |
var int: indexed_output ::add_to_output = arg_max(indexed_array); |
| 27 |
|
| 28 |
% Test using an enum as index |
| 29 |
enum TENUM = {ONE, TWO, THREE}; |
| 30 |
array[TENUM] of bool: enumed_array = [false, true, false]; |
| 31 |
var TENUM: enumed_output ::add_to_output = arg_max(enumed_array); |