1/********************************************************************
2 * COPYRIGHT:
3 * Copyright (c) 1997-2011, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
6
7/**
8 * Collation regression tests.
9 * (So we'll have no regrets later)
10 */
11
12#ifndef _REGCOLL
13#define _REGCOLL
14
15#include "unicode/utypes.h"
16
17#if !UCONFIG_NO_COLLATION
18
19#include "unicode/coleitr.h"
20#include "tscoll.h"
21
22class CollationRegressionTest: public IntlTestCollator
23{
24public:
25
26    // If this is too small for the test data, just increase it.
27    // Just don't make it too large, otherwise the executable will get too big
28    enum EToken_Len { MAX_TOKEN_LEN = 32 };
29
30    CollationRegressionTest();
31    virtual ~CollationRegressionTest();
32
33    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
34
35    // @bug 4048446
36    //
37    // CollationElementIterator.reset() doesn't work
38    //
39    void Test4048446(/* char* par */);
40
41    // @bug 4051866
42    //
43    // Collator -> rules -> Collator round-trip broken for expanding characters
44    //
45    void Test4051866(/* char* par */);
46
47    // @bug 4053636
48    //
49    // Collator thinks "black-bird" == "black"
50    //
51    void Test4053636(/* char* par */);
52
53
54    // @bug 4054238
55    //
56    // CollationElementIterator will not work correctly if the associated
57    // Collator object's mode is changed
58    //
59    void Test4054238(/* char* par */);
60
61    // @bug 4054734
62    //
63    // Collator.IDENTICAL documented but not implemented
64    //
65    void Test4054734(/* char* par */);
66
67    // @bug 4054736
68    //
69    // Full Decomposition mode not implemented
70    //
71    void Test4054736(/* char* par */);
72
73    // @bug 4058613
74    //
75    // Collator.getInstance() causes an ArrayIndexOutofBoundsException for Korean
76    //
77    void Test4058613(/* char* par */);
78
79    // @bug 4059820
80    //
81    // RuleBasedCollator.getRules does not return the exact pattern as input
82    // for expanding character sequences
83    //
84    void Test4059820(/* char* par */);
85
86    // @bug 4060154
87    //
88    // MergeCollation::fixEntry broken for "& H < \u0131, \u0130, i, I"
89    //
90    void Test4060154(/* char* par */);
91
92    // @bug 4062418
93    //
94    // Secondary/Tertiary comparison incorrect in French Secondary
95    //
96    void Test4062418(/* char* par */);
97
98    // @bug 4065540
99    //
100    // Collator.compare() method broken if either string contains spaces
101    //
102    void Test4065540(/* char* par */);
103
104    // @bug 4066189
105    //
106    // Unicode characters need to be recursively decomposed to get the
107    // correct result. For example,
108    // u1EB1 -> \u0103 + \u0300 -> a + \u0306 + \u0300.
109    //
110    void Test4066189(/* char* par */);
111
112    // @bug 4066696
113    //
114    // French secondary collation checking at the end of compare iteration fails
115    //
116    void Test4066696(/* char* par */);
117
118
119    // @bug 4076676
120    //
121    // Bad canonicalization of same-class combining characters
122    //
123    void Test4076676(/* char* par */);
124
125
126    // @bug 4078588
127    //
128    // RuleBasedCollator breaks on "< a < bb" rule
129    //
130    void Test4078588(/* char* par */);
131
132    // @bug 4079231
133    //
134    // RuleBasedCollator.equals(null) throws NullPointerException
135    //
136    void Test4079231(/* char* par */);
137
138    // @bug 4081866
139    //
140    // Combining characters in different classes not reordered properly.
141    //
142    void Test4081866(/* char* par */);
143
144    // @bug 4087241
145    //
146    // string comparison errors in Scandinavian collators
147    //
148    void Test4087241(/* char* par */);
149
150    // @bug 4087243
151    //
152    // CollationKey takes ignorable strings into account when it shouldn't
153    //
154    void Test4087243(/* char* par */);
155
156    // @bug 4092260
157    //
158    // Mu/micro conflict
159    // Micro symbol and greek lowercase letter Mu should sort identically
160    //
161    void Test4092260(/* char* par */);
162
163    // @bug 4095316
164    //
165    void Test4095316(/* char* par */);
166
167    // @bug 4101940
168    //
169    void Test4101940(/* char* par */);
170
171    // @bug 4103436
172    //
173    // Collator.compare not handling spaces properly
174    //
175    void Test4103436(/* char* par */);
176
177    // @bug 4114076
178    //
179    // Collation not Unicode conformant with Hangul syllables
180    //
181    void Test4114076(/* char* par */);
182
183
184    // @bug 4114077
185    //
186    // Collation with decomposition off doesn't work for Europe
187    //
188    void Test4114077(/* char* par */);
189
190    // @bug 4124632
191    //
192    // Collator.getCollationKey was hanging on certain character sequences
193    //
194    void Test4124632(/* char* par */);
195
196    // @bug 4132736
197    //
198    // sort order of french words with multiple accents has errors
199    //
200    void Test4132736(/* char* par */);
201
202    // @bug 4133509
203    //
204    // The sorting using java.text.CollationKey is not in the exact order
205    //
206    void Test4133509(/* char* par */);
207
208    // @bug 4139572
209    //
210    // getCollationKey throws exception for spanish text
211    // Cannot reproduce this bug on 1.2, however it DOES fail on 1.1.6
212    //
213    void Test4139572(/* char* par */);
214
215    // @bug 4141640
216    //
217    // Support for Swedish gone in 1.1.6 (Can't create Swedish collator)
218    //
219    void Test4141640(/* char* par */);
220
221    // @bug 4146160
222    //
223    // RuleBasedCollator doesn't use getCollationElementIterator internally
224    //
225    void Test4146160(/* char* par */);
226
227    // Ticket 7189
228    //
229    // nextSortKeyPart incorrect for EO_S1 collation
230    //
231    void TestT7189();
232
233    // Ticket 8624
234    //
235    // Tertiary value compression problem with case first option enabled
236    //
237    void TestCaseFirstCompression();
238
239private:
240    //------------------------------------------------------------------------
241    // Internal utilities
242    //
243    void compareArray(Collator &c,
244                    const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN],
245                    int32_t testCount);
246
247    void assertEqual(CollationElementIterator &i1, CollationElementIterator &i2);
248
249
250    RuleBasedCollator *en_us;
251
252    void caseFirstCompressionSub(Collator *col, UnicodeString opt);
253};
254
255#endif /* #if !UCONFIG_NO_COLLATION */
256
257#endif
258