summaryrefslogtreecommitdiff
path: root/tests/sort/test.data.pl
blob: 8198edabe49d3be62ec0730f44beca28940c6efe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#test   options   input   expected-output   expected-return-code
#
("1a", '', "A\nB\nC\n", "A\nB\nC\n", 0);
#
("2a", '-c', "A\nB\nC\n", '', 0);
("2b", '-c', "A\nC\nB\n", '', 1);
# This should fail because there are duplicate keys
("2c", '-cu', "A\nA\n", '', 1);
("2d", '-cu', "A\nB\n", '', 0);
("2e", '-cu', "A\nB\nB\n", '', 1);
("2f", '-cu', "B\nA\nB\n", '', 1);
#
("3a", '-k1', "B\nA\n", "A\nB\n",  0);
("3b", '-k1,1', "B\nA\n", "A\nB\n",  0);
("3c", '-k1 -k2', "A b\nA a\n", "A a\nA b\n",  0);
# FIXME: fail with a diagnostic when -k specifies field == 0
("3d", '-k0', "", "",  1);
# FIXME: fail with a diagnostic when -k specifies character == 0
("3e", '-k1.0', "", "",  1);
#
("4a", '-nc', "2\n11\n", "",  0);
("4b", '-n', "11\n2\n", "2\n11\n", 0);
("4c", '-k1n', "11\n2\n", "2\n11\n", 0);
("4d", '-k1', "11\n2\n", "11\n2\n", 0);
("4e", '-k2', "ignored B\nz-ig A\n", "z-ig A\nignored B\n", 0);
#
("5a", '-k1,2', "A B\nA A\n", "A A\nA B\n", 0);
("5b", '-k1,2', "A B A\nA A Z\n", "A A Z\nA B A\n", 0);
("5c", '-k1 -k2', "A B A\nA A Z\n", "A A Z\nA B A\n", 0);
("5d", '-k2,2', "A B A\nA A Z\n", "A A Z\nA B A\n", 0);
("5e", '-k2,2', "A B Z\nA A A\n", "A A A\nA B Z\n", 0);
("5f", '-k2,2', "A B A\nA A Z\n", "A A Z\nA B A\n", 0);
#
("6a", '-k 1,2', "A B\nA A\n", "A A\nA B\n", 0);
("6b", '-k 1,2', "A B A\nA A Z\n", "A A Z\nA B A\n", 0);
("6c", '-k 1 -k 2', "A B A\nA A Z\n", "A A Z\nA B A\n", 0);
("6d", '-k 2,2', "A B A\nA A Z\n", "A A Z\nA B A\n", 0);
("6e", '-k 2,2', "A B Z\nA A A\n", "A A A\nA B Z\n", 0);
("6f", '-k 2,2', "A B A\nA A Z\n", "A A Z\nA B A\n", 0);