This source file includes following definitions.
- test_ascii
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 static void
20 test_ascii (int (*my_casecmp) (const UNIT *, size_t, const UNIT *, size_t, const char *, uninorm_t, int *),
21 uninorm_t nf)
22 {
23
24 {
25 int cmp;
26
27 ASSERT (my_casecmp (NULL, 0, NULL, 0, NULL, nf, &cmp) == 0);
28 ASSERT (cmp == 0);
29 }
30 {
31 static const UNIT input[] = { 'x', 'y' };
32 int cmp;
33
34 ASSERT (my_casecmp (input, SIZEOF (input), NULL, 0, NULL, nf, &cmp) == 0);
35 ASSERT (cmp == 1);
36
37 ASSERT (my_casecmp (NULL, 0, input, SIZEOF (input), NULL, nf, &cmp) == 0);
38 ASSERT (cmp == -1);
39
40 ASSERT (my_casecmp (input, SIZEOF (input), input, SIZEOF (input), NULL, nf, &cmp) == 0);
41 ASSERT (cmp == 0);
42 }
43
44
45 {
46 static const UNIT input1[] = { 'A', 'm', 'e', 'r', 'i', 'c', 'a' };
47 static const UNIT input2[] = { 'A', 'm', 'i', 'g', 'o' };
48 int cmp;
49
50 ASSERT (my_casecmp (input1, SIZEOF (input1), input2, SIZEOF (input2), NULL, nf, &cmp) == 0);
51 ASSERT (cmp == -1);
52
53 ASSERT (my_casecmp (input2, SIZEOF (input2), input1, SIZEOF (input1), NULL, nf, &cmp) == 0);
54 ASSERT (cmp == 1);
55 }
56
57
58 {
59 static const UNIT input1[] = { 'R', 'e', 'a', 'g', 'a', 'n' };
60 static const UNIT input2[] = { 'R', 'e', 'a', 'g', 'a', 'n', 'o', 'm', 'i', 'c', 's' };
61 int cmp;
62
63 ASSERT (my_casecmp (input1, SIZEOF (input1), input2, SIZEOF (input2), NULL, nf, &cmp) == 0);
64 ASSERT (cmp == -1);
65
66 ASSERT (my_casecmp (input2, SIZEOF (input2), input1, SIZEOF (input1), NULL, nf, &cmp) == 0);
67 ASSERT (cmp == 1);
68 }
69 }