1 /********************************************************************
3 * Copyright (c) 1997-2009, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
7 #include "unicode/utypes.h"
9 #if !UCONFIG_NO_COLLATION
11 #include "unicode/coll.h"
12 #include "unicode/tblcoll.h"
13 #include "unicode/unistr.h"
14 #include "unicode/sortkey.h"
17 CollationEnglishTest::CollationEnglishTest()
20 UErrorCode status
= U_ZERO_ERROR
;
21 myCollation
= Collator::createInstance(Locale::getEnglish(), status
);
24 CollationEnglishTest::~CollationEnglishTest()
29 static const UChar testSourceCases
[][CollationEnglishTest::MAX_TOKEN_LEN
] = {
30 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, 0},
31 {(UChar
)0x0062 /* 'b' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x006B /* 'k' */, (UChar
)0x002D /* '-' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0069 /* 'i' */, (UChar
)0x0072 /* 'r' */, (UChar
)0x0064 /* 'd' */, 0},
32 {(UChar
)0x0062 /* 'b' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x006B /* 'k' */, (UChar
)0x0020 /* ' ' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0069 /* 'i' */, (UChar
)0x0072 /* 'r' */, (UChar
)0x0064 /* 'd' */, 0},
33 {(UChar
)0x0062 /* 'b' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x006B /* 'k' */, (UChar
)0x002D /* '-' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0069 /* 'i' */, (UChar
)0x0072 /* 'r' */, (UChar
)0x0064 /* 'd' */, 0},
34 {(UChar
)0x0048 /* 'H' */, (UChar
)0x0065 /* 'e' */, (UChar
)0x006C /* 'l' */, (UChar
)0x006C /* 'l' */, (UChar
)0x006F /* 'o' */, 0},
35 {(UChar
)0x0041 /* 'A' */, (UChar
)0x0042 /* 'B' */, (UChar
)0x0043 /* 'C' */, 0},
36 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
37 {(UChar
)0x0062 /* 'b' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x006B /* 'k' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0069 /* 'i' */, (UChar
)0x0072 /* 'r' */, (UChar
)0x0064 /* 'd' */, 0},
38 {(UChar
)0x0062 /* 'b' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x006B /* 'k' */, (UChar
)0x002D /* '-' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0069 /* 'i' */, (UChar
)0x0072 /* 'r' */, (UChar
)0x0064 /* 'd' */, 0},
39 {(UChar
)0x0062 /* 'b' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x006B /* 'k' */, (UChar
)0x002D /* '-' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0069 /* 'i' */, (UChar
)0x0072 /* 'r' */, (UChar
)0x0064 /* 'd' */, 0},
40 {(UChar
)0x0070 /* 'p' */, 0x00EA, (UChar
)0x0063 /* 'c' */, (UChar
)0x0068 /* 'h' */, (UChar
)0x0065 /* 'e' */, 0},
41 {(UChar
)0x0070 /* 'p' */, 0x00E9, (UChar
)0x0063 /* 'c' */, (UChar
)0x0068 /* 'h' */, 0x00E9, 0},
42 {0x00C4, (UChar
)0x0042 /* 'B' */, 0x0308, (UChar
)0x0043 /* 'C' */, 0x0308, 0},
43 {(UChar
)0x0061 /* 'a' */, 0x0308, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
44 {(UChar
)0x0070 /* 'p' */, 0x00E9, (UChar
)0x0063 /* 'c' */, (UChar
)0x0068 /* 'h' */, (UChar
)0x0065 /* 'e' */, (UChar
)0x0072 /* 'r' */, 0},
45 {(UChar
)0x0072 /* 'r' */, (UChar
)0x006F /* 'o' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0065 /* 'e' */, (UChar
)0x0073 /* 's' */, 0},
46 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
47 {(UChar
)0x0041 /* 'A' */, 0},
48 {(UChar
)0x0041 /* 'A' */, 0},
49 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, 0},
50 {(UChar
)0x0074 /* 't' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x006F /* 'o' */, (UChar
)0x006D /* 'm' */, (UChar
)0x0070 /* 'p' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0072 /* 'r' */, (UChar
)0x0065 /* 'e' */, (UChar
)0x0070 /* 'p' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0069 /* 'i' */, (UChar
)0x006E /* 'n' */, 0},
51 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, 0},
52 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0023 /* '#' */, (UChar
)0x0062 /* 'b' */, 0},
53 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0023 /* '#' */, (UChar
)0x0062 /* 'b' */, 0},
54 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
55 {(UChar
)0x0041 /* 'A' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x0064 /* 'd' */, (UChar
)0x0061 /* 'a' */, 0},
56 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x0064 /* 'd' */, (UChar
)0x0061 /* 'a' */, 0},
57 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x0064 /* 'd' */, (UChar
)0x0061 /* 'a' */, 0},
58 {0x00E6, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x0064 /* 'd' */, (UChar
)0x0061 /* 'a' */, 0},
59 {0x00E4, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x0064 /* 'd' */, (UChar
)0x0061 /* 'a' */, 0},
60 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
61 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
62 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
63 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
64 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
65 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x0048 /* 'H' */, (UChar
)0x0063 /* 'c' */, 0},
66 {(UChar
)0x0061 /* 'a' */, 0x0308, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
67 {(UChar
)0x0074 /* 't' */, (UChar
)0x0068 /* 'h' */, (UChar
)0x0069 /* 'i' */, 0x0302, (UChar
)0x0073 /* 's' */, 0},
68 {(UChar
)0x0070 /* 'p' */, 0x00EA, (UChar
)0x0063 /* 'c' */, (UChar
)0x0068 /* 'h' */, (UChar
)0x0065 /* 'e' */},
69 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
70 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
71 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
72 {(UChar
)0x0061 /* 'a' */, 0x00E6, (UChar
)0x0063 /* 'c' */, 0},
73 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
74 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
75 {(UChar
)0x0061 /* 'a' */, 0x00E6, (UChar
)0x0063 /* 'c' */, 0},
76 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
77 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
78 {(UChar
)0x0070 /* 'p' */, 0x00E9, (UChar
)0x0063 /* 'c' */, (UChar
)0x0068 /* 'h' */, 0x00E9, 0} // 49
81 static const UChar testTargetCases
[][CollationEnglishTest::MAX_TOKEN_LEN
] = {
82 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
83 {(UChar
)0x0062 /* 'b' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x006B /* 'k' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0069 /* 'i' */, (UChar
)0x0072 /* 'r' */, (UChar
)0x0064 /* 'd' */, 0},
84 {(UChar
)0x0062 /* 'b' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x006B /* 'k' */, (UChar
)0x002D /* '-' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0069 /* 'i' */, (UChar
)0x0072 /* 'r' */, (UChar
)0x0064 /* 'd' */, 0},
85 {(UChar
)0x0062 /* 'b' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x006B /* 'k' */, 0},
86 {(UChar
)0x0068 /* 'h' */, (UChar
)0x0065 /* 'e' */, (UChar
)0x006C /* 'l' */, (UChar
)0x006C /* 'l' */, (UChar
)0x006F /* 'o' */, 0},
87 {(UChar
)0x0041 /* 'A' */, (UChar
)0x0042 /* 'B' */, (UChar
)0x0043 /* 'C' */, 0},
88 {(UChar
)0x0041 /* 'A' */, (UChar
)0x0042 /* 'B' */, (UChar
)0x0043 /* 'C' */, 0},
89 {(UChar
)0x0062 /* 'b' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x006B /* 'k' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0069 /* 'i' */, (UChar
)0x0072 /* 'r' */, (UChar
)0x0064 /* 'd' */, (UChar
)0x0073 /* 's' */, 0},
90 {(UChar
)0x0062 /* 'b' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x006B /* 'k' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0069 /* 'i' */, (UChar
)0x0072 /* 'r' */, (UChar
)0x0064 /* 'd' */, (UChar
)0x0073 /* 's' */, 0},
91 {(UChar
)0x0062 /* 'b' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x006B /* 'k' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0069 /* 'i' */, (UChar
)0x0072 /* 'r' */, (UChar
)0x0064 /* 'd' */, 0},
92 {(UChar
)0x0070 /* 'p' */, 0x00E9, (UChar
)0x0063 /* 'c' */, (UChar
)0x0068 /* 'h' */, 0x00E9, 0},
93 {(UChar
)0x0070 /* 'p' */, 0x00E9, (UChar
)0x0063 /* 'c' */, (UChar
)0x0068 /* 'h' */, (UChar
)0x0065 /* 'e' */, (UChar
)0x0072 /* 'r' */, 0},
94 {0x00C4, (UChar
)0x0042 /* 'B' */, 0x0308, (UChar
)0x0043 /* 'C' */, 0x0308, 0},
95 {(UChar
)0x0041 /* 'A' */, 0x0308, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
96 {(UChar
)0x0070 /* 'p' */, 0x00E9, (UChar
)0x0063 /* 'c' */, (UChar
)0x0068 /* 'h' */, (UChar
)0x0065 /* 'e' */, 0},
97 {(UChar
)0x0072 /* 'r' */, (UChar
)0x006F /* 'o' */, 0x0302, (UChar
)0x006C /* 'l' */, (UChar
)0x0065 /* 'e' */, 0},
98 {(UChar
)0x0041 /* 'A' */, 0x00E1, (UChar
)0x0063 /* 'c' */, (UChar
)0x0064 /* 'd' */, 0},
99 {(UChar
)0x0041 /* 'A' */, 0x00E1, (UChar
)0x0063 /* 'c' */, (UChar
)0x0064 /* 'd' */, 0},
100 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
101 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
102 {(UChar
)0x0054 /* 'T' */, (UChar
)0x0043 /* 'C' */, (UChar
)0x006F /* 'o' */, (UChar
)0x006D /* 'm' */, (UChar
)0x0070 /* 'p' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0072 /* 'r' */, (UChar
)0x0065 /* 'e' */, (UChar
)0x0050 /* 'P' */, (UChar
)0x006C /* 'l' */, (UChar
)0x0061 /* 'a' */, (UChar
)0x0069 /* 'i' */, (UChar
)0x006E /* 'n' */, 0},
103 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0042 /* 'B' */, (UChar
)0x0063 /* 'c' */, 0},
104 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0023 /* '#' */, (UChar
)0x0042 /* 'B' */, 0},
105 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0026 /* '&' */, (UChar
)0x0062 /* 'b' */, 0},
106 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0023 /* '#' */, (UChar
)0x0063 /* 'c' */, 0},
107 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x0064 /* 'd' */, (UChar
)0x0061 /* 'a' */, 0},
108 {0x00C4, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x0064 /* 'd' */, (UChar
)0x0061 /* 'a' */, 0},
109 {0x00E4, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x0064 /* 'd' */, (UChar
)0x0061 /* 'a' */, 0},
110 {0x00C4, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x0064 /* 'd' */, (UChar
)0x0061 /* 'a' */, 0},
111 {0x00C4, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, (UChar
)0x0064 /* 'd' */, (UChar
)0x0061 /* 'a' */, 0},
112 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0023 /* '#' */, (UChar
)0x0063 /* 'c' */, 0},
113 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
114 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x003D /* '=' */, (UChar
)0x0063 /* 'c' */, 0},
115 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0064 /* 'd' */, 0},
116 {0x00E4, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
117 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0043 /* 'C' */, (UChar
)0x0048 /* 'H' */, (UChar
)0x0063 /* 'c' */, 0},
118 {0x00E4, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
119 {(UChar
)0x0074 /* 't' */, (UChar
)0x0068 /* 'h' */, 0x00EE, (UChar
)0x0073 /* 's' */, 0},
120 {(UChar
)0x0070 /* 'p' */, 0x00E9, (UChar
)0x0063 /* 'c' */, (UChar
)0x0068 /* 'h' */, 0x00E9, 0},
121 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0042 /* 'B' */, (UChar
)0x0043 /* 'C' */, 0},
122 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0062 /* 'b' */, (UChar
)0x0064 /* 'd' */, 0},
123 {0x00E4, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
124 {(UChar
)0x0061 /* 'a' */, 0x00C6, (UChar
)0x0063 /* 'c' */, 0},
125 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0042 /* 'B' */, (UChar
)0x0064 /* 'd' */, 0},
126 {0x00E4, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
127 {(UChar
)0x0061 /* 'a' */, 0x00C6, (UChar
)0x0063 /* 'c' */, 0},
128 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0042 /* 'B' */, (UChar
)0x0064 /* 'd' */, 0},
129 {0x00E4, (UChar
)0x0062 /* 'b' */, (UChar
)0x0063 /* 'c' */, 0},
130 {(UChar
)0x0070 /* 'p' */, 0x00EA, (UChar
)0x0063 /* 'c' */, (UChar
)0x0068 /* 'h' */, (UChar
)0x0065 /* 'e' */, 0} // 49
133 static const Collator::EComparisonResult results
[] = {
135 Collator::LESS
, /*Collator::GREATER,*/
143 Collator::LESS
, /*Collator::GREATER,*/ /* 10 */
153 Collator::LESS
, /* 20 */
160 /* Test Tertiary > 26 */
164 Collator::LESS
, /* 30 */
171 /* test identical > 36 */
174 /* test primary > 38 */
176 Collator::EQUAL
, /* 40 */
180 /* test secondary > 43 */
189 static const UChar testBugs
[][CollationEnglishTest::MAX_TOKEN_LEN
] = {
202 // 0x0300 is grave, 0x0301 is acute
203 // the order of elements in this array must be different than the order in CollationFrenchTest
204 static const UChar testAcute
[][CollationEnglishTest::MAX_TOKEN_LEN
] = {
206 {0x65, 0x65, 0x0301, 0},
207 {0x65, 0x65, 0x0301, 0x0300, 0},
208 {0x65, 0x65, 0x0300, 0},
209 {0x65, 0x65, 0x0300, 0x0301, 0},
210 {0x65, 0x0301, 0x65, 0},
211 {0x65, 0x0301, 0x65, 0x0301, 0},
212 {0x65, 0x0301, 0x65, 0x0301, 0x0300, 0},
213 {0x65, 0x0301, 0x65, 0x0300, 0},
214 {0x65, 0x0301, 0x65, 0x0300, 0x0301, 0},
215 {0x65, 0x0301, 0x0300, 0x65, 0},
216 {0x65, 0x0301, 0x0300, 0x65, 0x0301, 0},
217 {0x65, 0x0301, 0x0300, 0x65, 0x0301, 0x0300, 0},
218 {0x65, 0x0301, 0x0300, 0x65, 0x0300, 0},
219 {0x65, 0x0301, 0x0300, 0x65, 0x0300, 0x0301, 0},
220 {0x65, 0x0300, 0x65, 0},
221 {0x65, 0x0300, 0x65, 0x0301, 0},
222 {0x65, 0x0300, 0x65, 0x0301, 0x0300, 0},
223 {0x65, 0x0300, 0x65, 0x0300, 0},
224 {0x65, 0x0300, 0x65, 0x0300, 0x0301, 0},
225 {0x65, 0x0300, 0x0301, 0x65, 0},
226 {0x65, 0x0300, 0x0301, 0x65, 0x0301, 0},
227 {0x65, 0x0300, 0x0301, 0x65, 0x0301, 0x0300, 0},
228 {0x65, 0x0300, 0x0301, 0x65, 0x0300, 0},
229 {0x65, 0x0300, 0x0301, 0x65, 0x0300, 0x0301, 0}
232 static const UChar testMore
[][CollationEnglishTest::MAX_TOKEN_LEN
] = {
233 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0065 /* 'e' */, 0},
236 {(UChar
)0x0061 /* 'a' */, (UChar
)0x0066 /* 'f' */, 0},
237 {(UChar
)0x006F /* 'o' */, (UChar
)0x0065 /* 'e' */, 0},
240 {(UChar
)0x006F /* 'o' */, (UChar
)0x0066 /* 'f' */, 0},
243 void CollationEnglishTest::TestTertiary(/* char* par */)
246 myCollation
->setStrength(Collator::TERTIARY
);
247 for (i
= 0; i
< 38 ; i
++)
249 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
253 for (i
= 0; i
< 10; i
++)
255 for (j
= i
+1; j
< 10; j
++)
257 doTest(myCollation
, testBugs
[i
], testBugs
[j
], Collator::LESS
);
261 //test more interesting cases
262 Collator::EComparisonResult expected
;
263 const int32_t testMoreSize
= (int32_t)(sizeof(testMore
) / sizeof(testMore
[0]));
264 for (i
= 0; i
< testMoreSize
; i
++)
266 for (j
= 0; j
< testMoreSize
; j
++)
269 expected
= Collator::LESS
;
271 expected
= Collator::EQUAL
;
273 expected
= Collator::GREATER
;
274 doTest(myCollation
, testMore
[i
], testMore
[j
], expected
);
280 void CollationEnglishTest::TestPrimary(/* char* par */)
283 myCollation
->setStrength(Collator::PRIMARY
);
284 for (i
= 38; i
< 43 ; i
++)
286 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
290 void CollationEnglishTest::TestSecondary(/* char* par */)
293 myCollation
->setStrength(Collator::SECONDARY
);
294 for (i
= 43; i
< 49 ; i
++)
296 doTest(myCollation
, testSourceCases
[i
], testTargetCases
[i
], results
[i
]);
299 //test acute and grave ordering (compare to french collation)
301 Collator::EComparisonResult expected
;
302 const int32_t testAcuteSize
= (int32_t)(sizeof(testAcute
) / sizeof(testAcute
[0]));
303 for (i
= 0; i
< testAcuteSize
; i
++)
305 for (j
= 0; j
< testAcuteSize
; j
++)
308 expected
= Collator::LESS
;
310 expected
= Collator::EQUAL
;
312 expected
= Collator::GREATER
;
313 doTest(myCollation
, testAcute
[i
], testAcute
[j
], expected
);
318 void CollationEnglishTest::runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* /*par*/ )
320 if (exec
) logln("TestSuite CollationEnglishTest: ");
323 case 0: name
= "TestPrimary"; if (exec
) TestPrimary(/* par */); break;
324 case 1: name
= "TestSecondary"; if (exec
) TestSecondary(/* par */); break;
325 case 2: name
= "TestTertiary"; if (exec
) TestTertiary(/* par */); break;
326 default: name
= ""; break;
329 dataerrln("Collator couldn't be instantiated!");
334 #endif /* #if !UCONFIG_NO_COLLATION */