This source file includes following definitions.
- test_strncmp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 static void
20 test_strncmp (void)
21 {
22 {
23 static const UNIT input1[] = { 0 };
24 static const UNIT input2[] = { 0 };
25 ASSERT (U_STRNCMP (input1, input2, 0) == 0);
26 ASSERT (U_STRNCMP (input1, input2, 1) == 0);
27 ASSERT (U_STRNCMP (input1, input2, 1000000) == 0);
28 }
29 {
30 static const UNIT input1[] = { 0 };
31 static const UNIT input2[] = { 'f', 'o', 'o', 0 };
32 ASSERT (U_STRNCMP (input1, input2, 0) == 0);
33 ASSERT (U_STRNCMP (input1, input2, 1) < 0);
34 ASSERT (U_STRNCMP (input2, input1, 1) > 0);
35 ASSERT (U_STRNCMP (input1, input2, 3) < 0);
36 ASSERT (U_STRNCMP (input2, input1, 3) > 0);
37 ASSERT (U_STRNCMP (input1, input2, 4) < 0);
38 ASSERT (U_STRNCMP (input2, input1, 4) > 0);
39 ASSERT (U_STRNCMP (input1, input2, 1000000) < 0);
40 ASSERT (U_STRNCMP (input2, input1, 1000000) > 0);
41 }
42 {
43 static const UNIT input1[] = { 'f', 'o', 'o', 0 };
44 static const UNIT input2[] = { 'f', 'o', 'o', 0 };
45 ASSERT (U_STRNCMP (input1, input2, 0) == 0);
46 ASSERT (U_STRNCMP (input1, input2, 1) == 0);
47 ASSERT (U_STRNCMP (input1, input2, 2) == 0);
48 ASSERT (U_STRNCMP (input1, input2, 3) == 0);
49 ASSERT (U_STRNCMP (input1, input2, 4) == 0);
50 ASSERT (U_STRNCMP (input1, input2, 1000000) == 0);
51 }
52 {
53 static const UNIT input1[] = { 'f', 'o', 'o', 0 };
54 static const UNIT input2[] = { 'b', 'a', 'r', 0 };
55 ASSERT (U_STRNCMP (input1, input2, 0) == 0);
56 ASSERT (U_STRNCMP (input1, input2, 1) > 0);
57 ASSERT (U_STRNCMP (input2, input1, 1) < 0);
58 ASSERT (U_STRNCMP (input1, input2, 2) > 0);
59 ASSERT (U_STRNCMP (input2, input1, 2) < 0);
60 ASSERT (U_STRNCMP (input1, input2, 1000000) > 0);
61 ASSERT (U_STRNCMP (input2, input1, 1000000) < 0);
62 }
63 {
64 static const UNIT input1[] = { 'f', 'o', 'o', 0 };
65 static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 };
66 ASSERT (U_STRNCMP (input1, input2, 0) == 0);
67 ASSERT (U_STRNCMP (input1, input2, 1) == 0);
68 ASSERT (U_STRNCMP (input1, input2, 2) == 0);
69 ASSERT (U_STRNCMP (input1, input2, 3) == 0);
70 ASSERT (U_STRNCMP (input1, input2, 4) < 0);
71 ASSERT (U_STRNCMP (input2, input1, 4) > 0);
72 ASSERT (U_STRNCMP (input1, input2, 1000000) < 0);
73 ASSERT (U_STRNCMP (input2, input1, 1000000) > 0);
74 }
75 {
76 static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h', 0 };
77 static const UNIT input2[] = { 'o', 'o', 'p', 's', 0 };
78 ASSERT (U_STRNCMP (input1, input2, 0) == 0);
79 ASSERT (U_STRNCMP (input1, input2, 1) == 0);
80 ASSERT (U_STRNCMP (input1, input2, 2) == 0);
81 ASSERT (U_STRNCMP (input1, input2, 3) < 0);
82 ASSERT (U_STRNCMP (input2, input1, 3) > 0);
83 ASSERT (U_STRNCMP (input1, input2, 4) < 0);
84 ASSERT (U_STRNCMP (input2, input1, 4) > 0);
85 ASSERT (U_STRNCMP (input1, input2, 5) < 0);
86 ASSERT (U_STRNCMP (input2, input1, 5) > 0);
87 ASSERT (U_STRNCMP (input1, input2, 6) < 0);
88 ASSERT (U_STRNCMP (input2, input1, 6) > 0);
89 ASSERT (U_STRNCMP (input1, input2, 1000000) < 0);
90 ASSERT (U_STRNCMP (input2, input1, 1000000) > 0);
91 }
92 }