1 /********************************************************************
3 * Copyright (c) 1997-2008, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
7 #include "unicode/utypes.h"
9 #if !UCONFIG_NO_NORMALIZATION
11 #include "unicode/uchar.h"
12 #include "unicode/normlzr.h"
13 #include "unicode/uniset.h"
14 #include "unicode/usetiter.h"
15 #include "unicode/schriter.h"
20 #define LENGTHOF(array) ((int32_t)(sizeof(array)/sizeof((array)[0])))
21 #define ARRAY_LENGTH(array) LENGTHOF(array)
23 #define CASE(id,test) case id: \
27 logln((UnicodeString)""); \
32 static UErrorCode status
= U_ZERO_ERROR
;
34 void BasicNormalizerTest::runIndexedTest(int32_t index
, UBool exec
,
35 const char* &name
, char* /*par*/) {
38 CASE(1,TestCompatDecomp
);
39 CASE(2,TestCanonCompose
);
40 CASE(3,TestCompatCompose
);
42 CASE(5,TestHangulDecomp
);
43 CASE(6,TestHangulCompose
);
45 CASE(8,TestCompositionExclusion
);
46 CASE(9,TestZeroIndex
);
47 CASE(10,TestVerisign
);
48 CASE(11,TestPreviousNext
);
49 CASE(12,TestNormalizerAPI
);
50 CASE(13,TestConcatenate
);
51 CASE(14,FindFoldFCDExceptions
);
53 CASE(16,TestSkippable
);
54 default: name
= ""; break;
59 * Convert Java-style strings with \u Unicode escapes into UnicodeString objects
61 static UnicodeString
str(const char *input
)
63 UnicodeString
str(input
, ""); // Invariant conversion
64 return str
.unescape();
68 BasicNormalizerTest::BasicNormalizerTest()
71 // Input Decomposed Composed
73 canonTests
[0][0] = str("cat"); canonTests
[0][1] = str("cat"); canonTests
[0][2] = str("cat");
75 canonTests
[1][0] = str("\\u00e0ardvark"); canonTests
[1][1] = str("a\\u0300ardvark"); canonTests
[1][2] = str("\\u00e0ardvark");
77 canonTests
[2][0] = str("\\u1e0a"); canonTests
[2][1] = str("D\\u0307"); canonTests
[2][2] = str("\\u1e0a"); // D-dot_above
79 canonTests
[3][0] = str("D\\u0307"); canonTests
[3][1] = str("D\\u0307"); canonTests
[3][2] = str("\\u1e0a"); // D dot_above
81 canonTests
[4][0] = str("\\u1e0c\\u0307"); canonTests
[4][1] = str("D\\u0323\\u0307"); canonTests
[4][2] = str("\\u1e0c\\u0307"); // D-dot_below dot_above
83 canonTests
[5][0] = str("\\u1e0a\\u0323"); canonTests
[5][1] = str("D\\u0323\\u0307"); canonTests
[5][2] = str("\\u1e0c\\u0307"); // D-dot_above dot_below
85 canonTests
[6][0] = str("D\\u0307\\u0323"); canonTests
[6][1] = str("D\\u0323\\u0307"); canonTests
[6][2] = str("\\u1e0c\\u0307"); // D dot_below dot_above
87 canonTests
[7][0] = str("\\u1e10\\u0307\\u0323"); canonTests
[7][1] = str("D\\u0327\\u0323\\u0307"); canonTests
[7][2] = str("\\u1e10\\u0323\\u0307"); // D dot_below cedilla dot_above
89 canonTests
[8][0] = str("D\\u0307\\u0328\\u0323"); canonTests
[8][1] = str("D\\u0328\\u0323\\u0307"); canonTests
[8][2] = str("\\u1e0c\\u0328\\u0307"); // D dot_above ogonek dot_below
91 canonTests
[9][0] = str("\\u1E14"); canonTests
[9][1] = str("E\\u0304\\u0300"); canonTests
[9][2] = str("\\u1E14"); // E-macron-grave
93 canonTests
[10][0] = str("\\u0112\\u0300"); canonTests
[10][1] = str("E\\u0304\\u0300"); canonTests
[10][2] = str("\\u1E14"); // E-macron + grave
95 canonTests
[11][0] = str("\\u00c8\\u0304"); canonTests
[11][1] = str("E\\u0300\\u0304"); canonTests
[11][2] = str("\\u00c8\\u0304"); // E-grave + macron
97 canonTests
[12][0] = str("\\u212b"); canonTests
[12][1] = str("A\\u030a"); canonTests
[12][2] = str("\\u00c5"); // angstrom_sign
99 canonTests
[13][0] = str("\\u00c5"); canonTests
[13][1] = str("A\\u030a"); canonTests
[13][2] = str("\\u00c5"); // A-ring
101 canonTests
[14][0] = str("\\u00C4ffin"); canonTests
[14][1] = str("A\\u0308ffin"); canonTests
[14][2] = str("\\u00C4ffin");
103 canonTests
[15][0] = str("\\u00C4\\uFB03n"); canonTests
[15][1] = str("A\\u0308\\uFB03n"); canonTests
[15][2] = str("\\u00C4\\uFB03n");
105 canonTests
[16][0] = str("Henry IV"); canonTests
[16][1] = str("Henry IV"); canonTests
[16][2] = str("Henry IV");
107 canonTests
[17][0] = str("Henry \\u2163"); canonTests
[17][1] = str("Henry \\u2163"); canonTests
[17][2] = str("Henry \\u2163");
109 canonTests
[18][0] = str("\\u30AC"); canonTests
[18][1] = str("\\u30AB\\u3099"); canonTests
[18][2] = str("\\u30AC"); // ga (Katakana)
111 canonTests
[19][0] = str("\\u30AB\\u3099"); canonTests
[19][1] = str("\\u30AB\\u3099"); canonTests
[19][2] = str("\\u30AC"); // ka + ten
113 canonTests
[20][0] = str("\\uFF76\\uFF9E"); canonTests
[20][1] = str("\\uFF76\\uFF9E"); canonTests
[20][2] = str("\\uFF76\\uFF9E"); // hw_ka + hw_ten
115 canonTests
[21][0] = str("\\u30AB\\uFF9E"); canonTests
[21][1] = str("\\u30AB\\uFF9E"); canonTests
[21][2] = str("\\u30AB\\uFF9E"); // ka + hw_ten
117 canonTests
[22][0] = str("\\uFF76\\u3099"); canonTests
[22][1] = str("\\uFF76\\u3099"); canonTests
[22][2] = str("\\uFF76\\u3099"); // hw_ka + ten
119 canonTests
[23][0] = str("A\\u0300\\u0316"); canonTests
[23][1] = str("A\\u0316\\u0300"); canonTests
[23][2] = str("\\u00C0\\u0316");
122 // Input Decomposed Composed
123 compatTests
[0][0] = str("cat"); compatTests
[0][1] = str("cat"); compatTests
[0][2] = str("cat") ;
125 compatTests
[1][0] = str("\\uFB4f"); compatTests
[1][1] = str("\\u05D0\\u05DC"); compatTests
[1][2] = str("\\u05D0\\u05DC"); // Alef-Lamed vs. Alef, Lamed
127 compatTests
[2][0] = str("\\u00C4ffin"); compatTests
[2][1] = str("A\\u0308ffin"); compatTests
[2][2] = str("\\u00C4ffin") ;
129 compatTests
[3][0] = str("\\u00C4\\uFB03n"); compatTests
[3][1] = str("A\\u0308ffin"); compatTests
[3][2] = str("\\u00C4ffin") ; // ffi ligature -> f + f + i
131 compatTests
[4][0] = str("Henry IV"); compatTests
[4][1] = str("Henry IV"); compatTests
[4][2] = str("Henry IV") ;
133 compatTests
[5][0] = str("Henry \\u2163"); compatTests
[5][1] = str("Henry IV"); compatTests
[5][2] = str("Henry IV") ;
135 compatTests
[6][0] = str("\\u30AC"); compatTests
[6][1] = str("\\u30AB\\u3099"); compatTests
[6][2] = str("\\u30AC") ; // ga (Katakana)
137 compatTests
[7][0] = str("\\u30AB\\u3099"); compatTests
[7][1] = str("\\u30AB\\u3099"); compatTests
[7][2] = str("\\u30AC") ; // ka + ten
139 compatTests
[8][0] = str("\\uFF76\\u3099"); compatTests
[8][1] = str("\\u30AB\\u3099"); compatTests
[8][2] = str("\\u30AC") ; // hw_ka + ten
141 /* These two are broken in Unicode 2.1.2 but fixed in 2.1.5 and later */
142 compatTests
[9][0] = str("\\uFF76\\uFF9E"); compatTests
[9][1] = str("\\u30AB\\u3099"); compatTests
[9][2] = str("\\u30AC") ; // hw_ka + hw_ten
144 compatTests
[10][0] = str("\\u30AB\\uFF9E"); compatTests
[10][1] = str("\\u30AB\\u3099"); compatTests
[10][2] = str("\\u30AC") ; // ka + hw_ten
146 /* Hangul Canonical */
147 // Input Decomposed Composed
148 hangulCanon
[0][0] = str("\\ud4db"); hangulCanon
[0][1] = str("\\u1111\\u1171\\u11b6"); hangulCanon
[0][2] = str("\\ud4db") ;
150 hangulCanon
[1][0] = str("\\u1111\\u1171\\u11b6"), hangulCanon
[1][1] = str("\\u1111\\u1171\\u11b6"), hangulCanon
[1][2] = str("\\ud4db");
153 BasicNormalizerTest::~BasicNormalizerTest()
157 void BasicNormalizerTest::TestPrevious()
159 Normalizer
* norm
= new Normalizer("", UNORM_NFD
);
161 logln("testing decomp...");
163 for (i
= 0; i
< ARRAY_LENGTH(canonTests
); i
++) {
164 backAndForth(norm
, canonTests
[i
][0]);
167 logln("testing compose...");
168 norm
->setMode(UNORM_NFC
);
169 for (i
= 0; i
< ARRAY_LENGTH(canonTests
); i
++) {
170 backAndForth(norm
, canonTests
[i
][0]);
176 void BasicNormalizerTest::TestDecomp()
178 Normalizer
* norm
= new Normalizer("", UNORM_NFD
);
179 iterateTest(norm
, canonTests
, ARRAY_LENGTH(canonTests
), 1);
180 staticTest(UNORM_NFD
, 0, canonTests
, ARRAY_LENGTH(canonTests
), 1);
184 void BasicNormalizerTest::TestCompatDecomp()
186 Normalizer
* norm
= new Normalizer("", UNORM_NFKD
);
187 iterateTest(norm
, compatTests
, ARRAY_LENGTH(compatTests
), 1);
189 staticTest(UNORM_NFKD
, 0,
190 compatTests
, ARRAY_LENGTH(compatTests
), 1);
194 void BasicNormalizerTest::TestCanonCompose()
196 Normalizer
* norm
= new Normalizer("", UNORM_NFC
);
197 iterateTest(norm
, canonTests
, ARRAY_LENGTH(canonTests
), 2);
199 staticTest(UNORM_NFC
, 0, canonTests
,
200 ARRAY_LENGTH(canonTests
), 2);
204 void BasicNormalizerTest::TestCompatCompose()
206 Normalizer
* norm
= new Normalizer("", UNORM_NFKC
);
207 iterateTest(norm
, compatTests
, ARRAY_LENGTH(compatTests
), 2);
209 staticTest(UNORM_NFKC
, 0,
210 compatTests
, ARRAY_LENGTH(compatTests
), 2);
215 //-------------------------------------------------------------------------------
217 void BasicNormalizerTest::TestHangulCompose()
219 // Make sure that the static composition methods work
220 logln("Canonical composition...");
221 staticTest(UNORM_NFC
, 0, hangulCanon
, ARRAY_LENGTH(hangulCanon
), 2);
222 logln("Compatibility composition...");
224 // Now try iterative composition....
225 logln("Static composition...");
226 Normalizer
* norm
= new Normalizer("", UNORM_NFC
);
227 iterateTest(norm
, hangulCanon
, ARRAY_LENGTH(hangulCanon
), 2);
228 norm
->setMode(UNORM_NFKC
);
230 // And finally, make sure you can do it in reverse too
231 logln("Reverse iteration...");
232 norm
->setMode(UNORM_NFC
);
233 for (uint32_t i
= 0; i
< ARRAY_LENGTH(hangulCanon
); i
++) {
234 backAndForth(norm
, hangulCanon
[i
][0]);
239 void BasicNormalizerTest::TestHangulDecomp()
241 // Make sure that the static decomposition methods work
242 logln("Canonical decomposition...");
243 staticTest(UNORM_NFD
, 0, hangulCanon
, ARRAY_LENGTH(hangulCanon
), 1);
244 logln("Compatibility decomposition...");
246 // Now the iterative decomposition methods...
247 logln("Iterative decomposition...");
248 Normalizer
* norm
= new Normalizer("", UNORM_NFD
);
249 iterateTest(norm
, hangulCanon
, ARRAY_LENGTH(hangulCanon
), 1);
250 norm
->setMode(UNORM_NFKD
);
252 // And finally, make sure you can do it in reverse too
253 logln("Reverse iteration...");
254 norm
->setMode(UNORM_NFD
);
255 for (uint32_t i
= 0; i
< ARRAY_LENGTH(hangulCanon
); i
++) {
256 backAndForth(norm
, hangulCanon
[i
][0]);
262 * The Tibetan vowel sign AA, 0f71, was messed up prior to Unicode version 2.1.9.
264 void BasicNormalizerTest::TestTibetan(void) {
265 UnicodeString decomp
[1][3];
266 decomp
[0][0] = str("\\u0f77");
267 decomp
[0][1] = str("\\u0f77");
268 decomp
[0][2] = str("\\u0fb2\\u0f71\\u0f80");
270 UnicodeString compose
[1][3];
271 compose
[0][0] = str("\\u0fb2\\u0f71\\u0f80");
272 compose
[0][1] = str("\\u0fb2\\u0f71\\u0f80");
273 compose
[0][2] = str("\\u0fb2\\u0f71\\u0f80");
275 staticTest(UNORM_NFD
, 0, decomp
, ARRAY_LENGTH(decomp
), 1);
276 staticTest(UNORM_NFKD
, 0, decomp
, ARRAY_LENGTH(decomp
), 2);
277 staticTest(UNORM_NFC
, 0, compose
, ARRAY_LENGTH(compose
), 1);
278 staticTest(UNORM_NFKC
, 0, compose
, ARRAY_LENGTH(compose
), 2);
282 * Make sure characters in the CompositionExclusion.txt list do not get
285 void BasicNormalizerTest::TestCompositionExclusion(void) {
286 // This list is generated from CompositionExclusion.txt.
287 // Update whenever the normalizer tables are updated. Note
288 // that we test all characters listed, even those that can be
289 // derived from the Unicode DB and are therefore commented
291 // ### TODO read composition exclusion from source/data/unidata file
292 // and test against that
293 UnicodeString EXCLUDED
= str(
294 "\\u0340\\u0341\\u0343\\u0344\\u0374\\u037E\\u0387\\u0958"
295 "\\u0959\\u095A\\u095B\\u095C\\u095D\\u095E\\u095F\\u09DC"
296 "\\u09DD\\u09DF\\u0A33\\u0A36\\u0A59\\u0A5A\\u0A5B\\u0A5E"
297 "\\u0B5C\\u0B5D\\u0F43\\u0F4D\\u0F52\\u0F57\\u0F5C\\u0F69"
298 "\\u0F73\\u0F75\\u0F76\\u0F78\\u0F81\\u0F93\\u0F9D\\u0FA2"
299 "\\u0FA7\\u0FAC\\u0FB9\\u1F71\\u1F73\\u1F75\\u1F77\\u1F79"
300 "\\u1F7B\\u1F7D\\u1FBB\\u1FBE\\u1FC9\\u1FCB\\u1FD3\\u1FDB"
301 "\\u1FE3\\u1FEB\\u1FEE\\u1FEF\\u1FF9\\u1FFB\\u1FFD\\u2000"
302 "\\u2001\\u2126\\u212A\\u212B\\u2329\\u232A\\uF900\\uFA10"
303 "\\uFA12\\uFA15\\uFA20\\uFA22\\uFA25\\uFA26\\uFA2A\\uFB1F"
304 "\\uFB2A\\uFB2B\\uFB2C\\uFB2D\\uFB2E\\uFB2F\\uFB30\\uFB31"
305 "\\uFB32\\uFB33\\uFB34\\uFB35\\uFB36\\uFB38\\uFB39\\uFB3A"
306 "\\uFB3B\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46"
307 "\\uFB47\\uFB48\\uFB49\\uFB4A\\uFB4B\\uFB4C\\uFB4D\\uFB4E"
309 for (int32_t i
=0; i
<EXCLUDED
.length(); ++i
) {
310 UnicodeString
a(EXCLUDED
.charAt(i
));
313 Normalizer::normalize(a
, UNORM_NFKD
, 0, b
, status
);
314 Normalizer::normalize(b
, UNORM_NFC
, 0, c
, status
);
316 errln("FAIL: " + hex(a
) + " x DECOMP_COMPAT => " +
317 hex(b
) + " x COMPOSE => " +
319 } else if (verbose
) {
320 logln("Ok: " + hex(a
) + " x DECOMP_COMPAT => " +
321 hex(b
) + " x COMPOSE => " +
328 * Test for a problem that showed up just before ICU 1.6 release
329 * having to do with combining characters with an index of zero.
330 * Such characters do not participate in any canonical
331 * decompositions. However, having an index of zero means that
332 * they all share one typeMask[] entry, that is, they all have to
333 * map to the same canonical class, which is not the case, in
336 void BasicNormalizerTest::TestZeroIndex(void) {
337 const char* DATA
[] = {
338 // Expect col1 x COMPOSE_COMPAT => col2
339 // Expect col2 x DECOMP => col3
340 "A\\u0316\\u0300", "\\u00C0\\u0316", "A\\u0316\\u0300",
341 "A\\u0300\\u0316", "\\u00C0\\u0316", "A\\u0316\\u0300",
342 "A\\u0327\\u0300", "\\u00C0\\u0327", "A\\u0327\\u0300",
343 "c\\u0321\\u0327", "c\\u0321\\u0327", "c\\u0321\\u0327",
344 "c\\u0327\\u0321", "\\u00E7\\u0321", "c\\u0327\\u0321",
346 int32_t DATA_length
= (int32_t)(sizeof(DATA
) / sizeof(DATA
[0]));
348 for (int32_t i
=0; i
<DATA_length
; i
+=3) {
349 UErrorCode status
= U_ZERO_ERROR
;
350 UnicodeString
a(DATA
[i
], "");
353 Normalizer::normalize(a
, UNORM_NFKC
, 0, b
, status
);
354 UnicodeString
exp(DATA
[i
+1], "");
355 exp
= exp
.unescape();
357 logln((UnicodeString
)"Ok: " + hex(a
) + " x COMPOSE_COMPAT => " + hex(b
));
359 errln((UnicodeString
)"FAIL: " + hex(a
) + " x COMPOSE_COMPAT => " + hex(b
) +
360 ", expect " + hex(exp
));
362 Normalizer::normalize(b
, UNORM_NFD
, 0, a
, status
);
363 exp
= UnicodeString(DATA
[i
+2], "").unescape();
365 logln((UnicodeString
)"Ok: " + hex(b
) + " x DECOMP => " + hex(a
));
367 errln((UnicodeString
)"FAIL: " + hex(b
) + " x DECOMP => " + hex(a
) +
368 ", expect " + hex(exp
));
374 * Run a few specific cases that are failing for Verisign.
376 void BasicNormalizerTest::TestVerisign(void) {
379 > 05B8 05B9 05B1 0591 05C3 05B0 05AC 059F
380 > Their output (supposedly from ICU):
381 > 05B8 05B1 05B9 0591 05C3 05B0 05AC 059F
382 > My output from charlint:
383 > 05B1 05B8 05B9 0591 05C3 05B0 05AC 059F
385 05B8 05B9 05B1 0591 05C3 05B0 05AC 059F => 05B1 05B8 05B9 0591 05C3 05B0
388 U+05B8 18 E HEBREW POINT QAMATS
389 U+05B9 19 F HEBREW POINT HOLAM
390 U+05B1 11 HEBREW POINT HATAF SEGOL
391 U+0591 220 HEBREW ACCENT ETNAHTA
392 U+05C3 0 HEBREW PUNCTUATION SOF PASUQ
393 U+05B0 10 HEBREW POINT SHEVA
394 U+05AC 230 HEBREW ACCENT ILUY
395 U+059F 230 HEBREW ACCENT QARNEY PARA
397 U+05B1 11 HEBREW POINT HATAF SEGOL
398 U+05B8 18 HEBREW POINT QAMATS
399 U+05B9 19 HEBREW POINT HOLAM
400 U+0591 220 HEBREW ACCENT ETNAHTA
401 U+05C3 0 HEBREW PUNCTUATION SOF PASUQ
402 U+05B0 10 HEBREW POINT SHEVA
403 U+05AC 230 HEBREW ACCENT ILUY
404 U+059F 230 HEBREW ACCENT QARNEY PARA
407 U+05B8 18 HEBREW POINT QAMATS
408 U+05B1 11 HEBREW POINT HATAF SEGOL
409 U+05B9 19 HEBREW POINT HOLAM
410 U+0591 220 HEBREW ACCENT ETNAHTA
411 U+05C3 0 HEBREW PUNCTUATION SOF PASUQ
412 U+05B0 10 HEBREW POINT SHEVA
413 U+05AC 230 HEBREW ACCENT ILUY
414 U+059F 230 HEBREW ACCENT QARNEY PARA
418 >0592 05B7 05BC 05A5 05B0 05C0 05C4 05AD
419 >Their output (supposedly from ICU):
420 >0592 05B0 05B7 05BC 05A5 05C0 05AD 05C4
421 >My output from charlint:
422 >05B0 05B7 05BC 05A5 0592 05C0 05AD 05C4
424 0592 05B7 05BC 05A5 05B0 05C0 05C4 05AD => 05B0 05B7 05BC 05A5 0592 05C0
427 U+0592 230 HEBREW ACCENT SEGOL
428 U+05B7 17 HEBREW POINT PATAH
429 U+05BC 21 HEBREW POINT DAGESH OR MAPIQ
430 U+05A5 220 HEBREW ACCENT MERKHA
431 U+05B0 10 HEBREW POINT SHEVA
432 U+05C0 0 HEBREW PUNCTUATION PASEQ
433 U+05C4 230 HEBREW MARK UPPER DOT
434 U+05AD 222 HEBREW ACCENT DEHI
436 U+05B0 10 HEBREW POINT SHEVA
437 U+05B7 17 HEBREW POINT PATAH
438 U+05BC 21 HEBREW POINT DAGESH OR MAPIQ
439 U+05A5 220 HEBREW ACCENT MERKHA
440 U+0592 230 HEBREW ACCENT SEGOL
441 U+05C0 0 HEBREW PUNCTUATION PASEQ
442 U+05AD 222 HEBREW ACCENT DEHI
443 U+05C4 230 HEBREW MARK UPPER DOT
446 U+0592 230 HEBREW ACCENT SEGOL
447 U+05B0 10 HEBREW POINT SHEVA
448 U+05B7 17 HEBREW POINT PATAH
449 U+05BC 21 HEBREW POINT DAGESH OR MAPIQ
450 U+05A5 220 HEBREW ACCENT MERKHA
451 U+05C0 0 HEBREW PUNCTUATION PASEQ
452 U+05AD 222 HEBREW ACCENT DEHI
453 U+05C4 230 HEBREW MARK UPPER DOT
455 UnicodeString data
[2][3];
456 data
[0][0] = str("\\u05B8\\u05B9\\u05B1\\u0591\\u05C3\\u05B0\\u05AC\\u059F");
457 data
[0][1] = str("\\u05B1\\u05B8\\u05B9\\u0591\\u05C3\\u05B0\\u05AC\\u059F");
458 data
[0][2] = str("");
459 data
[1][0] = str("\\u0592\\u05B7\\u05BC\\u05A5\\u05B0\\u05C0\\u05C4\\u05AD");
460 data
[1][1] = str("\\u05B0\\u05B7\\u05BC\\u05A5\\u0592\\u05C0\\u05AD\\u05C4");
461 data
[1][2] = str("");
463 staticTest(UNORM_NFD
, 0, data
, ARRAY_LENGTH(data
), 1);
464 staticTest(UNORM_NFC
, 0, data
, ARRAY_LENGTH(data
), 1);
467 //------------------------------------------------------------------------
468 // Internal utilities
471 UnicodeString
BasicNormalizerTest::hex(UChar ch
) {
472 UnicodeString result
;
473 return appendHex(ch
, 4, result
);
476 UnicodeString
BasicNormalizerTest::hex(const UnicodeString
& s
) {
477 UnicodeString result
;
478 for (int i
= 0; i
< s
.length(); ++i
) {
479 if (i
!= 0) result
+= (UChar
)0x2c/*,*/;
480 appendHex(s
[i
], 4, result
);
486 inline static void insert(UnicodeString
& dest
, int pos
, UChar32 ch
)
488 dest
.replace(pos
, 0, ch
);
491 void BasicNormalizerTest::backAndForth(Normalizer
* iter
, const UnicodeString
& input
)
494 iter
->setText(input
, status
);
496 // Run through the iterator forwards and stick it into a StringBuffer
497 UnicodeString forward
;
498 for (ch
= iter
->first(); ch
!= iter
->DONE
; ch
= iter
->next()) {
502 // Now do it backwards
503 UnicodeString reverse
;
504 for (ch
= iter
->last(); ch
!= iter
->DONE
; ch
= iter
->previous()) {
505 insert(reverse
, 0, ch
);
508 if (forward
!= reverse
) {
509 errln("Forward/reverse mismatch for input " + hex(input
)
510 + ", forward: " + hex(forward
) + ", backward: " + hex(reverse
));
514 void BasicNormalizerTest::staticTest(UNormalizationMode mode
, int options
,
515 UnicodeString tests
[][3], int length
,
518 for (int i
= 0; i
< length
; i
++)
520 UnicodeString
& input
= tests
[i
][0];
521 UnicodeString
& expect
= tests
[i
][outCol
];
523 logln("Normalizing '" + input
+ "' (" + hex(input
) + ")" );
525 UnicodeString output
;
526 Normalizer::normalize(input
, mode
, options
, output
, status
);
528 if (output
!= expect
) {
529 errln(UnicodeString("ERROR: case ") + i
+ " normalized " + hex(input
) + "\n"
530 + " expected " + hex(expect
) + "\n"
531 + " static got " + hex(output
) );
536 void BasicNormalizerTest::iterateTest(Normalizer
* iter
,
537 UnicodeString tests
[][3], int length
,
540 for (int i
= 0; i
< length
; i
++)
542 UnicodeString
& input
= tests
[i
][0];
543 UnicodeString
& expect
= tests
[i
][outCol
];
545 logln("Normalizing '" + input
+ "' (" + hex(input
) + ")" );
547 iter
->setText(input
, status
);
548 assertEqual(input
, expect
, iter
, UnicodeString("ERROR: case ") + i
+ " ");
552 void BasicNormalizerTest::assertEqual(const UnicodeString
& input
,
553 const UnicodeString
& expected
,
555 const UnicodeString
& errPrefix
)
557 UnicodeString result
;
559 for (UChar32 ch
= iter
->first(); ch
!= iter
->DONE
; ch
= iter
->next()) {
562 if (result
!= expected
) {
563 errln(errPrefix
+ "normalized " + hex(input
) + "\n"
564 + " expected " + hex(expected
) + "\n"
565 + " iterate got " + hex(result
) );
569 // helper class for TestPreviousNext()
570 // simple UTF-32 character iterator
571 class UChar32Iterator
{
573 UChar32Iterator(const UChar32
*text
, int32_t len
, int32_t index
) :
574 s(text
), length(len
), i(index
) {}
609 BasicNormalizerTest::TestPreviousNext(const UChar
*src
, int32_t srcLength
,
610 const UChar32
*expect
, int32_t expectLength
,
611 const int32_t *expectIndex
, // its length=expectLength+1
612 int32_t srcMiddle
, int32_t expectMiddle
,
614 UNormalizationMode mode
,
617 Normalizer
iter(src
, srcLength
, mode
);
619 // test getStaticClassID and getDynamicClassID
620 if(iter
.getDynamicClassID() != Normalizer::getStaticClassID()) {
621 errln("getStaticClassID != getDynamicClassID for Normalizer.");
624 UChar32Iterator
iter32(expect
, expectLength
, expectMiddle
);
629 // initially set the indexes into the middle of the strings
630 iter
.setIndexOnly(srcMiddle
);
632 // move around and compare the iteration code points with
634 const char *move
=moves
;
635 while((m
=*move
++)!=0) {
638 c2
=iter32
.previous();
642 } else /* m=='+' */ {
649 // copy the moves until the current (m) move, and terminate
651 uprv_strcpy(history
, moves
);
652 history
[move
-moves
]=0;
653 errln("error: mismatch in Normalizer iteration (%s) at %s: "
654 "got c1=U+%04lx != expected c2=U+%04lx\n",
655 name
, history
, c1
, c2
);
660 if(iter
.getIndex()!=expectIndex
[iter32
.getIndex()]) {
661 // copy the moves until the current (m) move, and terminate
663 uprv_strcpy(history
, moves
);
664 history
[move
-moves
]=0;
665 errln("error: index mismatch in Normalizer iteration (%s) at %s: "
666 "Normalizer index %ld expected %ld\n",
667 name
, history
, iter
.getIndex(), expectIndex
[iter32
.getIndex()]);
674 BasicNormalizerTest::TestPreviousNext() {
675 // src and expect strings
676 static const UChar src
[]={
677 UTF16_LEAD(0x2f999), UTF16_TRAIL(0x2f999),
678 UTF16_LEAD(0x1d15f), UTF16_TRAIL(0x1d15f),
682 static const UChar32 expect
[]={
689 // expected src indexes corresponding to expect indexes
690 static const int32_t expectIndex
[]={
695 6 // behind last character
698 // src and expect strings for regression test for j2911
699 static const UChar src_j2911
[]={
700 UTF16_LEAD(0x2f999), UTF16_TRAIL(0x2f999),
701 0xdd00, 0xd900, // unpaired surrogates - regression test for j2911
705 static const UChar32 expect_j2911
[]={
707 0xdd00, 0xd900, // unpaired surrogates - regression test for j2911
712 // expected src indexes corresponding to expect indexes
713 static const int32_t expectIndex_j2911
[]={
718 8 // behind last character
721 // initial indexes into the src and expect strings
722 // for both sets of test data
731 // - for previous(), 0 for current(), + for next()
732 // for both sets of test data
733 static const char *const moves
="0+0+0--0-0-+++0--+++++++0--------";
735 TestPreviousNext(src
, LENGTHOF(src
),
736 expect
, LENGTHOF(expect
),
738 SRC_MIDDLE
, EXPECT_MIDDLE
,
739 moves
, UNORM_NFD
, "basic");
741 TestPreviousNext(src_j2911
, LENGTHOF(src_j2911
),
742 expect_j2911
, LENGTHOF(expect_j2911
),
744 SRC_MIDDLE
, EXPECT_MIDDLE
,
745 moves
, UNORM_NFKC
, "j2911");
747 // try again from different "middle" indexes
748 TestPreviousNext(src
, LENGTHOF(src
),
749 expect
, LENGTHOF(expect
),
751 SRC_MIDDLE_2
, EXPECT_MIDDLE_2
,
752 moves
, UNORM_NFD
, "basic_2");
754 TestPreviousNext(src_j2911
, LENGTHOF(src_j2911
),
755 expect_j2911
, LENGTHOF(expect_j2911
),
757 SRC_MIDDLE_2
, EXPECT_MIDDLE_2
,
758 moves
, UNORM_NFKC
, "j2911_2");
761 void BasicNormalizerTest::TestConcatenate() {
762 static const char *const
764 /* mode, left, right, result */
777 /* ### TODO: add more interesting cases */
780 "\\u0340\\u0341\\u0343\\u0344\\u0374\\u037E\\u0387\\u0958"
781 "\\u0959\\u095A\\u095B\\u095C\\u095D\\u095E\\u095F\\u09DC"
782 "\\u09DD\\u09DF\\u0A33\\u0A36\\u0A59\\u0A5A\\u0A5B\\u0A5E"
783 "\\u0B5C\\u0B5D\\u0F43\\u0F4D\\u0F52\\u0F57\\u0F5C\\u0F69"
784 "\\u0F73\\u0F75\\u0F76\\u0F78\\u0F81\\u0F93\\u0F9D\\u0FA2"
785 "\\u0FA7\\u0FAC\\u0FB9\\u1F71\\u1F73\\u1F75\\u1F77\\u1F79"
786 "\\u1F7B\\u1F7D\\u1FBB\\u1FBE\\u1FC9\\u1FCB\\u1FD3\\u1FDB",
788 "\\u1FE3\\u1FEB\\u1FEE\\u1FEF\\u1FF9\\u1FFB\\u1FFD\\u2000"
789 "\\u2001\\u2126\\u212A\\u212B\\u2329\\u232A\\uF900\\uFA10"
790 "\\uFA12\\uFA15\\uFA20\\uFA22\\uFA25\\uFA26\\uFA2A\\uFB1F"
791 "\\uFB2A\\uFB2B\\uFB2C\\uFB2D\\uFB2E\\uFB2F\\uFB30\\uFB31"
792 "\\uFB32\\uFB33\\uFB34\\uFB35\\uFB36\\uFB38\\uFB39\\uFB3A"
793 "\\uFB3B\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46"
794 "\\uFB47\\uFB48\\uFB49\\uFB4A\\uFB4B\\uFB4C\\uFB4D\\uFB4E",
796 "\\u0340\\u0341\\u0343\\u0344\\u0374\\u037E\\u0387\\u0958"
797 "\\u0959\\u095A\\u095B\\u095C\\u095D\\u095E\\u095F\\u09DC"
798 "\\u09DD\\u09DF\\u0A33\\u0A36\\u0A59\\u0A5A\\u0A5B\\u0A5E"
799 "\\u0B5C\\u0B5D\\u0F43\\u0F4D\\u0F52\\u0F57\\u0F5C\\u0F69"
800 "\\u0F73\\u0F75\\u0F76\\u0F78\\u0F81\\u0F93\\u0F9D\\u0FA2"
801 "\\u0FA7\\u0FAC\\u0FB9\\u1F71\\u1F73\\u1F75\\u1F77\\u1F79"
802 "\\u1F7B\\u1F7D\\u1FBB\\u1FBE\\u1FC9\\u1FCB\\u1FD3\\u0399"
803 "\\u0301\\u03C5\\u0308\\u0301\\u1FEB\\u1FEE\\u1FEF\\u1FF9"
804 "\\u1FFB\\u1FFD\\u2000\\u2001\\u2126\\u212A\\u212B\\u2329"
805 "\\u232A\\uF900\\uFA10\\uFA12\\uFA15\\uFA20\\uFA22\\uFA25"
806 "\\uFA26\\uFA2A\\uFB1F\\uFB2A\\uFB2B\\uFB2C\\uFB2D\\uFB2E"
807 "\\uFB2F\\uFB30\\uFB31\\uFB32\\uFB33\\uFB34\\uFB35\\uFB36"
808 "\\uFB38\\uFB39\\uFB3A\\uFB3B\\uFB3C\\uFB3E\\uFB40\\uFB41"
809 "\\uFB43\\uFB44\\uFB46\\uFB47\\uFB48\\uFB49\\uFB4A\\uFB4B"
810 "\\uFB4C\\uFB4D\\uFB4E"
814 UnicodeString left
, right
, expect
, result
, r
;
815 UErrorCode errorCode
;
816 UNormalizationMode mode
;
819 /* test concatenation */
820 for(i
=0; i
<(int32_t)(sizeof(cases
)/sizeof(cases
[0])); ++i
) {
821 switch(*cases
[i
][0]) {
822 case 'C': mode
=UNORM_NFC
; break;
823 case 'D': mode
=UNORM_NFD
; break;
824 case 'c': mode
=UNORM_NFKC
; break;
825 case 'd': mode
=UNORM_NFKD
; break;
826 default: mode
=UNORM_NONE
; break;
829 left
=UnicodeString(cases
[i
][1], "").unescape();
830 right
=UnicodeString(cases
[i
][2], "").unescape();
831 expect
=UnicodeString(cases
[i
][3], "").unescape();
833 //result=r=UnicodeString();
834 errorCode
=U_ZERO_ERROR
;
836 r
=Normalizer::concatenate(left
, right
, result
, mode
, 0, errorCode
);
837 if(U_FAILURE(errorCode
) || /*result!=r ||*/ result
!=expect
) {
838 errln("error in Normalizer::concatenate(), cases[] fails with "+
839 UnicodeString(u_errorName(errorCode
))+", result==expect: expected: "+
840 hex(expect
)+" =========> got: " + hex(result
));
844 /* test error cases */
846 /* left.getBuffer()==result.getBuffer() */
847 result
=r
=expect
=UnicodeString("zz", "");
848 errorCode
=U_UNEXPECTED_TOKEN
;
849 r
=Normalizer::concatenate(left
, right
, result
, mode
, 0, errorCode
);
850 if(errorCode
!=U_UNEXPECTED_TOKEN
|| result
!=r
|| !result
.isBogus()) {
851 errln("error in Normalizer::concatenate(), violates UErrorCode protocol");
855 errorCode
=U_ZERO_ERROR
;
856 r
=Normalizer::concatenate(left
, right
, result
, mode
, 0, errorCode
);
857 if(errorCode
!=U_ILLEGAL_ARGUMENT_ERROR
|| result
!=r
|| !result
.isBogus()) {
858 errln("error in Normalizer::concatenate(), does not detect left.isBogus()");
862 // reference implementation of Normalizer::compare
864 ref_norm_compare(const UnicodeString
&s1
, const UnicodeString
&s2
, uint32_t options
, UErrorCode
&errorCode
) {
865 UnicodeString r1
, r2
, t1
, t2
;
866 int32_t normOptions
=(int32_t)(options
>>UNORM_COMPARE_NORM_OPTIONS_SHIFT
);
868 if(options
&U_COMPARE_IGNORE_CASE
) {
869 Normalizer::decompose(s1
, FALSE
, normOptions
, r1
, errorCode
);
870 Normalizer::decompose(s2
, FALSE
, normOptions
, r2
, errorCode
);
872 r1
.foldCase(options
);
873 r2
.foldCase(options
);
879 Normalizer::decompose(r1
, FALSE
, normOptions
, t1
, errorCode
);
880 Normalizer::decompose(r2
, FALSE
, normOptions
, t2
, errorCode
);
882 if(options
&U_COMPARE_CODE_POINT_ORDER
) {
883 return t1
.compareCodePointOrder(t2
);
885 return t1
.compare(t2
);
889 // test wrapper for Normalizer::compare, sets UNORM_INPUT_IS_FCD appropriately
891 _norm_compare(const UnicodeString
&s1
, const UnicodeString
&s2
, uint32_t options
, UErrorCode
&errorCode
) {
892 int32_t normOptions
=(int32_t)(options
>>UNORM_COMPARE_NORM_OPTIONS_SHIFT
);
894 if( UNORM_YES
==Normalizer::quickCheck(s1
, UNORM_FCD
, normOptions
, errorCode
) &&
895 UNORM_YES
==Normalizer::quickCheck(s2
, UNORM_FCD
, normOptions
, errorCode
)) {
896 options
|=UNORM_INPUT_IS_FCD
;
899 return Normalizer::compare(s1
, s2
, options
, errorCode
);
902 // reference implementation of UnicodeString::caseCompare
904 ref_case_compare(const UnicodeString
&s1
, const UnicodeString
&s2
, uint32_t options
) {
905 UnicodeString t1
, t2
;
910 t1
.foldCase(options
);
911 t2
.foldCase(options
);
913 if(options
&U_COMPARE_CODE_POINT_ORDER
) {
914 return t1
.compareCodePointOrder(t2
);
916 return t1
.compare(t2
);
920 // reduce an integer to -1/0/1
921 static inline int32_t
922 _sign(int32_t value
) {
926 return (value
>>31)|1;
931 _signString(int32_t value
) {
934 } else if(value
==0) {
936 } else /* value>0 */ {
942 BasicNormalizerTest::TestCompare() {
943 // test Normalizer::compare and unorm_compare (thinly wrapped by the former)
944 // by comparing it with its semantic equivalent
945 // since we trust the pieces, this is sufficient
947 // test each string with itself and each other
948 // each time with all options
949 static const char *const
951 // some cases from NormalizationTest.txt
953 "D\\u031B\\u0307\\u0323",
954 "\\u1E0C\\u031B\\u0307",
955 "D\\u031B\\u0323\\u0307",
956 "d\\u031B\\u0323\\u0307",
963 // Angstrom sign = A ring
971 "a\\u059A\\u0316\\u302A\\u032Fb",
972 "a\\u302A\\u0316\\u032F\\u059Ab",
973 "a\\u302A\\u0316\\u032F\\u059Ab",
974 "A\\u059A\\u0316\\u302A\\u032Fb",
976 // from ICU case folding tests
978 "A\\u00df\\u00b5\\ufb03\\U0001040c\\u0131",
979 "ass\\u03bcffi\\U00010434i",
980 "\\u0061\\u0042\\u0131\\u03a3\\u00df\\ufb03\\ud93f\\udfff",
981 "\\u0041\\u0062\\u0069\\u03c3\\u0073\\u0053\\u0046\\u0066\\u0049\\ud93f\\udfff",
982 "\\u0041\\u0062\\u0131\\u03c3\\u0053\\u0073\\u0066\\u0046\\u0069\\ud93f\\udfff",
983 "\\u0041\\u0062\\u0069\\u03c3\\u0073\\u0053\\u0046\\u0066\\u0049\\ud93f\\udffd",
985 // U+d800 U+10001 see implementation comment in unorm_cmpEquivFold
986 // vs. U+10000 at bottom - code point order
988 "\\ud800\\ud800\\udc01",
991 // other code point order tests from ustrtest.cpp
994 "\\u20ac\\ud800\\udc00",
999 "\\uff61\\ud800\\udc02",
1003 // long strings, see cnormtst.c/TestNormCoverage()
1004 // equivalent if case-insensitive
1006 "\\uAD8B\\uAD8B\\uAD8B\\uAD8B"
1007 "\\U0001d15e\\U0001d157\\U0001d165\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e"
1008 "\\U0001d15e\\U0001d157\\U0001d165\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e"
1009 "\\U0001d15e\\U0001d157\\U0001d165\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e"
1010 "\\U0001d157\\U0001d165\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e"
1011 "\\U0001d157\\U0001d165\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e"
1012 "aaaaaaaaaaaaaaaaaazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
1013 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
1014 "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
1015 "ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
1016 "\\uAD8B\\uAD8B\\uAD8B\\uAD8B"
1017 "d\\u031B\\u0307\\u0323",
1019 "\\u1100\\u116f\\u11aa\\uAD8B\\uAD8B\\u1100\\u116f\\u11aa"
1020 "\\U0001d157\\U0001d165\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e"
1021 "\\U0001d157\\U0001d165\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e"
1022 "\\U0001d157\\U0001d165\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e"
1023 "\\U0001d15e\\U0001d157\\U0001d165\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e"
1024 "\\U0001d15e\\U0001d157\\U0001d165\\U0001d15e\\U0001d15e\\U0001d15e\\U0001d15e"
1025 "aaaaaaaaaaAAAAAAAAZZZZZZZZZZZZZZZZzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
1026 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
1027 "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
1028 "ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
1029 "\\u1100\\u116f\\u11aa\\uAD8B\\uAD8B\\u1100\\u116f\\u11aa"
1030 "\\u1E0C\\u031B\\u0307",
1032 // some strings that may make a difference whether the compare function
1033 // case-folds or decomposes first
1035 "\\u0360\\u0345\\u0334",
1036 "\\u0360\\u03b9\\u0334",
1038 "\\u0360\\u1f80\\u0334",
1039 "\\u0360\\u03b1\\u0313\\u03b9\\u0334",
1041 "\\u0360\\u1ffc\\u0334",
1042 "\\u0360\\u03c9\\u03b9\\u0334",
1044 "a\\u0360\\u0345\\u0360\\u0345b",
1045 "a\\u0345\\u0360\\u0345\\u0360b",
1047 // interesting cases for canonical caseless match with turkic i handling
1052 // strings with post-Unicode 3.2 normalization or normalization corrections
1054 "\\u00e4\\u193b\\U0002f868",
1055 "\\u0061\\u193b\\u0308\\u36fc",
1062 UnicodeString s
[100]; // at least as many items as in strings[] !
1064 // all combinations of options
1065 // UNORM_INPUT_IS_FCD is set automatically if both input strings fulfill FCD conditions
1066 // set UNORM_UNICODE_3_2 in one additional combination
1067 static const struct {
1072 { U_COMPARE_CODE_POINT_ORDER
, "c.p. order" },
1073 { U_COMPARE_IGNORE_CASE
, "ignore case" },
1074 { U_COMPARE_CODE_POINT_ORDER
|U_COMPARE_IGNORE_CASE
, "c.p. order & ignore case" },
1075 { U_COMPARE_IGNORE_CASE
|U_FOLD_CASE_EXCLUDE_SPECIAL_I
, "ignore case & special i" },
1076 { U_COMPARE_CODE_POINT_ORDER
|U_COMPARE_IGNORE_CASE
|U_FOLD_CASE_EXCLUDE_SPECIAL_I
, "c.p. order & ignore case & special i" },
1077 { UNORM_UNICODE_3_2
<<UNORM_COMPARE_NORM_OPTIONS_SHIFT
, "Unicode 3.2" }
1080 int32_t i
, j
, k
, count
=LENGTHOF(strings
);
1081 int32_t result
, refResult
;
1083 UErrorCode errorCode
;
1085 // create the UnicodeStrings
1086 for(i
=0; i
<count
; ++i
) {
1087 s
[i
]=UnicodeString(strings
[i
], "").unescape();
1090 // test them each with each other
1091 for(i
=0; i
<count
; ++i
) {
1092 for(j
=i
; j
<count
; ++j
) {
1093 for(k
=0; k
<LENGTHOF(opt
); ++k
) {
1094 // test Normalizer::compare
1095 errorCode
=U_ZERO_ERROR
;
1096 result
=_norm_compare(s
[i
], s
[j
], opt
[k
].options
, errorCode
);
1097 refResult
=ref_norm_compare(s
[i
], s
[j
], opt
[k
].options
, errorCode
);
1098 if(_sign(result
)!=_sign(refResult
)) {
1099 errln("Normalizer::compare(%d, %d, %s)%s should be %s %s",
1100 i
, j
, opt
[k
].name
, _signString(result
), _signString(refResult
),
1101 U_SUCCESS(errorCode
) ? "" : u_errorName(errorCode
));
1104 // test UnicodeString::caseCompare - same internal implementation function
1105 if(opt
[k
].options
&U_COMPARE_IGNORE_CASE
) {
1106 errorCode
=U_ZERO_ERROR
;
1107 result
=s
[i
].caseCompare(s
[j
], opt
[k
].options
);
1108 refResult
=ref_case_compare(s
[i
], s
[j
], opt
[k
].options
);
1109 if(_sign(result
)!=_sign(refResult
)) {
1110 errln("UniStr::caseCompare(%d, %d, %s)%s should be %s %s",
1111 i
, j
, opt
[k
].name
, _signString(result
), _signString(refResult
),
1112 U_SUCCESS(errorCode
) ? "" : u_errorName(errorCode
));
1119 // test cases with i and I to make sure Turkic works
1120 static const UChar iI
[]={ 0x49, 0x69, 0x130, 0x131 };
1121 USerializedSet sset
;
1124 UnicodeString s1
, s2
;
1127 // collect all sets into one for contiguous output
1128 for(i
=0; i
<LENGTHOF(iI
); ++i
) {
1129 if(unorm_getCanonStartSet(iI
[i
], &sset
)) {
1130 count
=uset_getSerializedRangeCount(&sset
);
1131 for(j
=0; j
<count
; ++j
) {
1132 uset_getSerializedRange(&sset
, j
, &start
, &end
);
1133 set
.add(start
, end
);
1138 // test all of these precomposed characters
1139 UnicodeSetIterator
it(set
);
1140 while(it
.nextRange() && !it
.isString()) {
1141 start
=it
.getCodepoint();
1142 end
=it
.getCodepointEnd();
1145 errorCode
=U_ZERO_ERROR
;
1146 Normalizer::decompose(s1
, FALSE
, 0, s2
, errorCode
);
1147 if(U_FAILURE(errorCode
)) {
1148 errln("Normalizer::decompose(U+%04x) failed: %s", start
, u_errorName(errorCode
));
1152 for(k
=0; k
<LENGTHOF(opt
); ++k
) {
1153 // test Normalizer::compare
1154 errorCode
=U_ZERO_ERROR
;
1155 result
=_norm_compare(s1
, s2
, opt
[k
].options
, errorCode
);
1156 refResult
=ref_norm_compare(s1
, s2
, opt
[k
].options
, errorCode
);
1157 if(_sign(result
)!=_sign(refResult
)) {
1158 errln("Normalizer::compare(U+%04x with its NFD, %s)%s should be %s %s",
1159 start
, opt
[k
].name
, _signString(result
), _signString(refResult
),
1160 U_SUCCESS(errorCode
) ? "" : u_errorName(errorCode
));
1163 // test UnicodeString::caseCompare - same internal implementation function
1164 if(opt
[k
].options
&U_COMPARE_IGNORE_CASE
) {
1165 errorCode
=U_ZERO_ERROR
;
1166 result
=s1
.caseCompare(s2
, opt
[k
].options
);
1167 refResult
=ref_case_compare(s1
, s2
, opt
[k
].options
);
1168 if(_sign(result
)!=_sign(refResult
)) {
1169 errln("UniStr::caseCompare(U+%04x with its NFD, %s)%s should be %s %s",
1170 start
, opt
[k
].name
, _signString(result
), _signString(refResult
),
1171 U_SUCCESS(errorCode
) ? "" : u_errorName(errorCode
));
1181 // verify that case-folding does not un-FCD strings
1183 BasicNormalizerTest::countFoldFCDExceptions(uint32_t foldingOptions
) {
1184 UnicodeString s
, fold
, d
;
1187 uint8_t cc
, trailCC
, foldCC
, foldTrailCC
;
1188 UNormalizationCheckResult qcResult
;
1191 UErrorCode errorCode
;
1193 logln("Test if case folding may un-FCD a string (folding options %04lx)", foldingOptions
);
1196 for(c
=0; c
<=0x10ffff; ++c
) {
1197 errorCode
= U_ZERO_ERROR
;
1198 category
=u_charType(c
);
1199 if(category
==U_UNASSIGNED
) {
1200 continue; // skip unassigned code points
1203 c
=0xd7a3; // skip Hangul - no case folding there
1206 // skip Han blocks - no case folding there either
1222 // get leading and trailing cc for c
1223 Normalizer::decompose(s
, FALSE
, 0, d
, errorCode
);
1225 cc
=u_getCombiningClass(d
.char32At(0));
1226 trailCC
=u_getCombiningClass(d
.char32At(d
.length()-1));
1228 // get leading and trailing cc for the case-folding of c
1229 s
.foldCase(foldingOptions
);
1230 Normalizer::decompose(s
, FALSE
, 0, d
, errorCode
);
1231 foldCC
=u_getCombiningClass(d
.char32At(0));
1232 foldTrailCC
=u_getCombiningClass(d
.char32At(d
.length()-1));
1234 qcResult
=Normalizer::quickCheck(s
, UNORM_FCD
, errorCode
);
1236 if (U_FAILURE(errorCode
)) {
1238 errln("U+%04lx: Failed with error %s", u_errorName(errorCode
));
1242 // - character maps to empty string: adjacent characters may then need reordering
1243 // - folding has different leading/trailing cc's, and they don't become just 0
1244 // - folding itself is not FCD
1245 if( qcResult
!=UNORM_YES
||
1247 (cc
!=foldCC
&& foldCC
!=0) || (trailCC
!=foldTrailCC
&& foldTrailCC
!=0)
1250 errln("U+%04lx: case-folding may un-FCD a string (folding options %04lx)", c
, foldingOptions
);
1251 errln(" cc %02x trailCC %02x foldCC(U+%04lx) %02x foldTrailCC(U+%04lx) %02x quickCheck(folded)=%d", cc
, trailCC
, d
.char32At(0), foldCC
, d
.char32At(d
.length()-1), foldTrailCC
, qcResult
);
1256 // if a code point is in NFD but its case folding is not, then
1257 // unorm_compare will also fail
1258 if(isNFD
&& UNORM_YES
!=Normalizer::quickCheck(s
, UNORM_NFD
, errorCode
)) {
1260 errln("U+%04lx: case-folding un-NFDs this character (folding options %04lx)", c
, foldingOptions
);
1264 logln("There are %ld code points for which case-folding may un-FCD a string (folding options %04lx)", count
, foldingOptions
);
1269 BasicNormalizerTest::FindFoldFCDExceptions() {
1272 count
=countFoldFCDExceptions(0);
1273 count
+=countFoldFCDExceptions(U_FOLD_CASE_EXCLUDE_SPECIAL_I
);
1276 * If case-folding un-FCDs any strings, then unorm_compare() must be
1278 * It currently assumes that one can check for FCD then case-fold
1279 * and then still have FCD strings for raw decomposition without reordering.
1281 errln("error: There are %ld code points for which case-folding may un-FCD a string for all folding options.\n"
1282 "See comment in BasicNormalizerTest::FindFoldFCDExceptions()!", count
);
1287 * Hardcoded "NF* Skippable" sets, generated from
1288 * Mark Davis' com.ibm.text.UCD.NFSkippable (see ICU4J CVS, module unicodetools).
1289 * Run com.ibm.text.UCD.Main with the option NFSkippable.
1291 * Must be updated for each Unicode version.
1294 initExpectedSkippables(UnicodeSet skipSets
[UNORM_MODE_COUNT
]) {
1295 UErrorCode errorCode
=U_ZERO_ERROR
;
1297 skipSets
[UNORM_NFD
].applyPattern(UnicodeString(
1298 "[^\\u00C0-\\u00C5\\u00C7-\\u00CF\\u00D1-\\u00D6\\u00D9-\\u00DD"
1299 "\\u00E0-\\u00E5\\u00E7-\\u00EF\\u00F1-\\u00F6\\u00F9-\\u00FD"
1300 "\\u00FF-\\u010F\\u0112-\\u0125\\u0128-\\u0130\\u0134-\\u0137"
1301 "\\u0139-\\u013E\\u0143-\\u0148\\u014C-\\u0151\\u0154-\\u0165"
1302 "\\u0168-\\u017E\\u01A0\\u01A1\\u01AF\\u01B0\\u01CD-\\u01DC"
1303 "\\u01DE-\\u01E3\\u01E6-\\u01F0\\u01F4\\u01F5\\u01F8-\\u021B"
1304 "\\u021E\\u021F\\u0226-\\u0233\\u0300-\\u034E\\u0350-\\u036F"
1305 "\\u0374\\u037E\\u0385-\\u038A\\u038C\\u038E-\\u0390\\u03AA-"
1306 "\\u03B0\\u03CA-\\u03CE\\u03D3\\u03D4\\u0400\\u0401\\u0403\\u0407"
1307 "\\u040C-\\u040E\\u0419\\u0439\\u0450\\u0451\\u0453\\u0457\\u045C"
1308 "-\\u045E\\u0476\\u0477\\u0483-\\u0487\\u04C1\\u04C2\\u04D0-"
1309 "\\u04D3\\u04D6\\u04D7\\u04DA-\\u04DF\\u04E2-\\u04E7\\u04EA-"
1310 "\\u04F5\\u04F8\\u04F9\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4"
1311 "\\u05C5\\u05C7\\u0610-\\u061A\\u0622-\\u0626\\u064B-\\u065E"
1312 "\\u0670\\u06C0\\u06C2\\u06D3\\u06D6-\\u06DC\\u06DF-\\u06E4"
1313 "\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07EB-"
1314 "\\u07F3\\u0929\\u0931\\u0934\\u093C\\u094D\\u0951-\\u0954\\u0958"
1315 "-\\u095F\\u09BC\\u09CB-\\u09CD\\u09DC\\u09DD\\u09DF\\u0A33"
1316 "\\u0A36\\u0A3C\\u0A4D\\u0A59-\\u0A5B\\u0A5E\\u0ABC\\u0ACD\\u0B3C"
1317 "\\u0B48\\u0B4B-\\u0B4D\\u0B5C\\u0B5D\\u0B94\\u0BCA-\\u0BCD"
1318 "\\u0C48\\u0C4D\\u0C55\\u0C56\\u0CBC\\u0CC0\\u0CC7\\u0CC8\\u0CCA"
1319 "\\u0CCB\\u0CCD\\u0D4A-\\u0D4D\\u0DCA\\u0DDA\\u0DDC-\\u0DDE"
1320 "\\u0E38-\\u0E3A\\u0E48-\\u0E4B\\u0EB8\\u0EB9\\u0EC8-\\u0ECB"
1321 "\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F43\\u0F4D\\u0F52\\u0F57"
1322 "\\u0F5C\\u0F69\\u0F71-\\u0F76\\u0F78\\u0F7A-\\u0F7D\\u0F80-"
1323 "\\u0F84\\u0F86\\u0F87\\u0F93\\u0F9D\\u0FA2\\u0FA7\\u0FAC\\u0FB9"
1324 "\\u0FC6\\u1026\\u1037\\u1039\\u103A\\u108D\\u135F\\u1714\\u1734"
1325 "\\u17D2\\u17DD\\u18A9\\u1939-\\u193B\\u1A17\\u1A18\\u1B06\\u1B08"
1326 "\\u1B0A\\u1B0C\\u1B0E\\u1B12\\u1B34\\u1B3B\\u1B3D\\u1B40\\u1B41"
1327 "\\u1B43\\u1B44\\u1B6B-\\u1B73\\u1BAA\\u1C37\\u1DC0-\\u1DE6"
1328 "\\u1DFE-\\u1E99\\u1E9B\\u1EA0-\\u1EF9\\u1F00-\\u1F15\\u1F18-"
1329 "\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59"
1330 "\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC"
1331 "\\u1FBE\\u1FC1-\\u1FC4\\u1FC6-\\u1FD3\\u1FD6-\\u1FDB\\u1FDD-"
1332 "\\u1FEF\\u1FF2-\\u1FF4\\u1FF6-\\u1FFD\\u2000\\u2001\\u20D0-"
1333 "\\u20DC\\u20E1\\u20E5-\\u20F0\\u2126\\u212A\\u212B\\u219A\\u219B"
1334 "\\u21AE\\u21CD-\\u21CF\\u2204\\u2209\\u220C\\u2224\\u2226\\u2241"
1335 "\\u2244\\u2247\\u2249\\u2260\\u2262\\u226D-\\u2271\\u2274\\u2275"
1336 "\\u2278\\u2279\\u2280\\u2281\\u2284\\u2285\\u2288\\u2289\\u22AC-"
1337 "\\u22AF\\u22E0-\\u22E3\\u22EA-\\u22ED\\u2329\\u232A\\u2ADC"
1338 "\\u2DE0-\\u2DFF\\u302A-\\u302F\\u304C\\u304E\\u3050\\u3052"
1339 "\\u3054\\u3056\\u3058\\u305A\\u305C\\u305E\\u3060\\u3062\\u3065"
1340 "\\u3067\\u3069\\u3070\\u3071\\u3073\\u3074\\u3076\\u3077\\u3079"
1341 "\\u307A\\u307C\\u307D\\u3094\\u3099\\u309A\\u309E\\u30AC\\u30AE"
1342 "\\u30B0\\u30B2\\u30B4\\u30B6\\u30B8\\u30BA\\u30BC\\u30BE\\u30C0"
1343 "\\u30C2\\u30C5\\u30C7\\u30C9\\u30D0\\u30D1\\u30D3\\u30D4\\u30D6"
1344 "\\u30D7\\u30D9\\u30DA\\u30DC\\u30DD\\u30F4\\u30F7-\\u30FA\\u30FE"
1345 "\\uA66F\\uA67C\\uA67D\\uA806\\uA8C4\\uA92B-\\uA92D\\uA953\\uAC00"
1346 "-\\uD7A3\\uF900-\\uFA0D\\uFA10\\uFA12\\uFA15-\\uFA1E\\uFA20"
1347 "\\uFA22\\uFA25\\uFA26\\uFA2A-\\uFA2D\\uFA30-\\uFA6A\\uFA70-"
1348 "\\uFAD9\\uFB1D-\\uFB1F\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E"
1349 "\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFB4E\\uFE20-\\uFE26"
1350 "\\U000101FD\\U00010A0D\\U00010A0F\\U00010A38-\\U00010A3A\\U00010"
1351 "A3F\\U0001D15E-\\U0001D169\\U0001D16D-\\U0001D172\\U0001D17B-"
1352 "\\U0001D182\\U0001D185-\\U0001D18B\\U0001D1AA-\\U0001D1AD\\U0001"
1353 "D1BB-\\U0001D1C0\\U0001D242-\\U0001D244\\U0002F800-\\U0002FA1D]"
1356 skipSets
[UNORM_NFC
].applyPattern(UnicodeString(
1357 "[^<->A-PR-Za-pr-z\\u00A8\\u00C0-\\u00CF\\u00D1-\\u00D6\\u00D8-"
1358 "\\u00DD\\u00E0-\\u00EF\\u00F1-\\u00F6\\u00F8-\\u00FD\\u00FF-"
1359 "\\u0103\\u0106-\\u010F\\u0112-\\u0117\\u011A-\\u0121\\u0124"
1360 "\\u0125\\u0128-\\u012D\\u0130\\u0139\\u013A\\u013D\\u013E\\u0143"
1361 "\\u0144\\u0147\\u0148\\u014C-\\u0151\\u0154\\u0155\\u0158-"
1362 "\\u015D\\u0160\\u0161\\u0164\\u0165\\u0168-\\u0171\\u0174-"
1363 "\\u017F\\u01A0\\u01A1\\u01AF\\u01B0\\u01B7\\u01CD-\\u01DC\\u01DE"
1364 "-\\u01E1\\u01E6-\\u01EB\\u01F4\\u01F5\\u01F8-\\u01FB\\u0200-"
1365 "\\u021B\\u021E\\u021F\\u0226-\\u0233\\u0292\\u0300-\\u034E"
1366 "\\u0350-\\u036F\\u0374\\u037E\\u0387\\u0391\\u0395\\u0397\\u0399"
1367 "\\u039F\\u03A1\\u03A5\\u03A9\\u03AC\\u03AE\\u03B1\\u03B5\\u03B7"
1368 "\\u03B9\\u03BF\\u03C1\\u03C5\\u03C9-\\u03CB\\u03CE\\u03D2\\u0406"
1369 "\\u0410\\u0413\\u0415-\\u0418\\u041A\\u041E\\u0423\\u0427\\u042B"
1370 "\\u042D\\u0430\\u0433\\u0435-\\u0438\\u043A\\u043E\\u0443\\u0447"
1371 "\\u044B\\u044D\\u0456\\u0474\\u0475\\u0483-\\u0487\\u04D8\\u04D9"
1372 "\\u04E8\\u04E9\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5"
1373 "\\u05C7\\u0610-\\u061A\\u0622\\u0623\\u0627\\u0648\\u064A-"
1374 "\\u065E\\u0670\\u06C1\\u06D2\\u06D5-\\u06DC\\u06DF-\\u06E4"
1375 "\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07EB-"
1376 "\\u07F3\\u0928\\u0930\\u0933\\u093C\\u094D\\u0951-\\u0954\\u0958"
1377 "-\\u095F\\u09BC\\u09BE\\u09C7\\u09CD\\u09D7\\u09DC\\u09DD\\u09DF"
1378 "\\u0A33\\u0A36\\u0A3C\\u0A4D\\u0A59-\\u0A5B\\u0A5E\\u0ABC\\u0ACD"
1379 "\\u0B3C\\u0B3E\\u0B47\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B92"
1380 "\\u0BBE\\u0BC6\\u0BC7\\u0BCD\\u0BD7\\u0C46\\u0C4D\\u0C55\\u0C56"
1381 "\\u0CBC\\u0CBF\\u0CC2\\u0CC6\\u0CCA\\u0CCD\\u0CD5\\u0CD6\\u0D3E"
1382 "\\u0D46\\u0D47\\u0D4D\\u0D57\\u0DCA\\u0DCF\\u0DD9\\u0DDC\\u0DDF"
1383 "\\u0E38-\\u0E3A\\u0E48-\\u0E4B\\u0EB8\\u0EB9\\u0EC8-\\u0ECB"
1384 "\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F43\\u0F4D\\u0F52\\u0F57"
1385 "\\u0F5C\\u0F69\\u0F71-\\u0F76\\u0F78\\u0F7A-\\u0F7D\\u0F80-"
1386 "\\u0F84\\u0F86\\u0F87\\u0F93\\u0F9D\\u0FA2\\u0FA7\\u0FAC\\u0FB9"
1387 "\\u0FC6\\u1025\\u102E\\u1037\\u1039\\u103A\\u108D\\u1100-\\u1112"
1388 "\\u1161-\\u1175\\u11A8-\\u11C2\\u135F\\u1714\\u1734\\u17D2"
1389 "\\u17DD\\u18A9\\u1939-\\u193B\\u1A17\\u1A18\\u1B05\\u1B07\\u1B09"
1390 "\\u1B0B\\u1B0D\\u1B11\\u1B34\\u1B35\\u1B3A\\u1B3C\\u1B3E\\u1B3F"
1391 "\\u1B42\\u1B44\\u1B6B-\\u1B73\\u1BAA\\u1C37\\u1DC0-\\u1DE6"
1392 "\\u1DFE-\\u1E03\\u1E0A-\\u1E0F\\u1E12-\\u1E1B\\u1E20-\\u1E27"
1393 "\\u1E2A-\\u1E41\\u1E44-\\u1E53\\u1E58-\\u1E7D\\u1E80-\\u1E87"
1394 "\\u1E8E-\\u1E91\\u1E96-\\u1E99\\u1EA0-\\u1EF3\\u1EF6-\\u1EF9"
1395 "\\u1F00-\\u1F11\\u1F18\\u1F19\\u1F20-\\u1F31\\u1F38\\u1F39"
1396 "\\u1F40\\u1F41\\u1F48\\u1F49\\u1F50\\u1F51\\u1F59\\u1F60-\\u1F71"
1397 "\\u1F73-\\u1F75\\u1F77\\u1F79\\u1F7B-\\u1F7D\\u1F80\\u1F81"
1398 "\\u1F88\\u1F89\\u1F90\\u1F91\\u1F98\\u1F99\\u1FA0\\u1FA1\\u1FA8"
1399 "\\u1FA9\\u1FB3\\u1FB6\\u1FBB\\u1FBC\\u1FBE\\u1FBF\\u1FC3\\u1FC6"
1400 "\\u1FC9\\u1FCB\\u1FCC\\u1FD3\\u1FDB\\u1FE3\\u1FEB\\u1FEE\\u1FEF"
1401 "\\u1FF3\\u1FF6\\u1FF9\\u1FFB-\\u1FFE\\u2000\\u2001\\u20D0-"
1402 "\\u20DC\\u20E1\\u20E5-\\u20F0\\u2126\\u212A\\u212B\\u2190\\u2192"
1403 "\\u2194\\u21D0\\u21D2\\u21D4\\u2203\\u2208\\u220B\\u2223\\u2225"
1404 "\\u223C\\u2243\\u2245\\u2248\\u224D\\u2261\\u2264\\u2265\\u2272"
1405 "\\u2273\\u2276\\u2277\\u227A-\\u227D\\u2282\\u2283\\u2286\\u2287"
1406 "\\u2291\\u2292\\u22A2\\u22A8\\u22A9\\u22AB\\u22B2-\\u22B5\\u2329"
1407 "\\u232A\\u2ADC\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3046\\u304B"
1408 "\\u304D\\u304F\\u3051\\u3053\\u3055\\u3057\\u3059\\u305B\\u305D"
1409 "\\u305F\\u3061\\u3064\\u3066\\u3068\\u306F\\u3072\\u3075\\u3078"
1410 "\\u307B\\u3099\\u309A\\u309D\\u30A6\\u30AB\\u30AD\\u30AF\\u30B1"
1411 "\\u30B3\\u30B5\\u30B7\\u30B9\\u30BB\\u30BD\\u30BF\\u30C1\\u30C4"
1412 "\\u30C6\\u30C8\\u30CF\\u30D2\\u30D5\\u30D8\\u30DB\\u30EF-\\u30F2"
1413 "\\u30FD\\uA66F\\uA67C\\uA67D\\uA806\\uA8C4\\uA92B-\\uA92D\\uA953"
1414 "\\uAC00\\uAC1C\\uAC38\\uAC54\\uAC70\\uAC8C\\uACA8\\uACC4\\uACE0"
1415 "\\uACFC\\uAD18\\uAD34\\uAD50\\uAD6C\\uAD88\\uADA4\\uADC0\\uADDC"
1416 "\\uADF8\\uAE14\\uAE30\\uAE4C\\uAE68\\uAE84\\uAEA0\\uAEBC\\uAED8"
1417 "\\uAEF4\\uAF10\\uAF2C\\uAF48\\uAF64\\uAF80\\uAF9C\\uAFB8\\uAFD4"
1418 "\\uAFF0\\uB00C\\uB028\\uB044\\uB060\\uB07C\\uB098\\uB0B4\\uB0D0"
1419 "\\uB0EC\\uB108\\uB124\\uB140\\uB15C\\uB178\\uB194\\uB1B0\\uB1CC"
1420 "\\uB1E8\\uB204\\uB220\\uB23C\\uB258\\uB274\\uB290\\uB2AC\\uB2C8"
1421 "\\uB2E4\\uB300\\uB31C\\uB338\\uB354\\uB370\\uB38C\\uB3A8\\uB3C4"
1422 "\\uB3E0\\uB3FC\\uB418\\uB434\\uB450\\uB46C\\uB488\\uB4A4\\uB4C0"
1423 "\\uB4DC\\uB4F8\\uB514\\uB530\\uB54C\\uB568\\uB584\\uB5A0\\uB5BC"
1424 "\\uB5D8\\uB5F4\\uB610\\uB62C\\uB648\\uB664\\uB680\\uB69C\\uB6B8"
1425 "\\uB6D4\\uB6F0\\uB70C\\uB728\\uB744\\uB760\\uB77C\\uB798\\uB7B4"
1426 "\\uB7D0\\uB7EC\\uB808\\uB824\\uB840\\uB85C\\uB878\\uB894\\uB8B0"
1427 "\\uB8CC\\uB8E8\\uB904\\uB920\\uB93C\\uB958\\uB974\\uB990\\uB9AC"
1428 "\\uB9C8\\uB9E4\\uBA00\\uBA1C\\uBA38\\uBA54\\uBA70\\uBA8C\\uBAA8"
1429 "\\uBAC4\\uBAE0\\uBAFC\\uBB18\\uBB34\\uBB50\\uBB6C\\uBB88\\uBBA4"
1430 "\\uBBC0\\uBBDC\\uBBF8\\uBC14\\uBC30\\uBC4C\\uBC68\\uBC84\\uBCA0"
1431 "\\uBCBC\\uBCD8\\uBCF4\\uBD10\\uBD2C\\uBD48\\uBD64\\uBD80\\uBD9C"
1432 "\\uBDB8\\uBDD4\\uBDF0\\uBE0C\\uBE28\\uBE44\\uBE60\\uBE7C\\uBE98"
1433 "\\uBEB4\\uBED0\\uBEEC\\uBF08\\uBF24\\uBF40\\uBF5C\\uBF78\\uBF94"
1434 "\\uBFB0\\uBFCC\\uBFE8\\uC004\\uC020\\uC03C\\uC058\\uC074\\uC090"
1435 "\\uC0AC\\uC0C8\\uC0E4\\uC100\\uC11C\\uC138\\uC154\\uC170\\uC18C"
1436 "\\uC1A8\\uC1C4\\uC1E0\\uC1FC\\uC218\\uC234\\uC250\\uC26C\\uC288"
1437 "\\uC2A4\\uC2C0\\uC2DC\\uC2F8\\uC314\\uC330\\uC34C\\uC368\\uC384"
1438 "\\uC3A0\\uC3BC\\uC3D8\\uC3F4\\uC410\\uC42C\\uC448\\uC464\\uC480"
1439 "\\uC49C\\uC4B8\\uC4D4\\uC4F0\\uC50C\\uC528\\uC544\\uC560\\uC57C"
1440 "\\uC598\\uC5B4\\uC5D0\\uC5EC\\uC608\\uC624\\uC640\\uC65C\\uC678"
1441 "\\uC694\\uC6B0\\uC6CC\\uC6E8\\uC704\\uC720\\uC73C\\uC758\\uC774"
1442 "\\uC790\\uC7AC\\uC7C8\\uC7E4\\uC800\\uC81C\\uC838\\uC854\\uC870"
1443 "\\uC88C\\uC8A8\\uC8C4\\uC8E0\\uC8FC\\uC918\\uC934\\uC950\\uC96C"
1444 "\\uC988\\uC9A4\\uC9C0\\uC9DC\\uC9F8\\uCA14\\uCA30\\uCA4C\\uCA68"
1445 "\\uCA84\\uCAA0\\uCABC\\uCAD8\\uCAF4\\uCB10\\uCB2C\\uCB48\\uCB64"
1446 "\\uCB80\\uCB9C\\uCBB8\\uCBD4\\uCBF0\\uCC0C\\uCC28\\uCC44\\uCC60"
1447 "\\uCC7C\\uCC98\\uCCB4\\uCCD0\\uCCEC\\uCD08\\uCD24\\uCD40\\uCD5C"
1448 "\\uCD78\\uCD94\\uCDB0\\uCDCC\\uCDE8\\uCE04\\uCE20\\uCE3C\\uCE58"
1449 "\\uCE74\\uCE90\\uCEAC\\uCEC8\\uCEE4\\uCF00\\uCF1C\\uCF38\\uCF54"
1450 "\\uCF70\\uCF8C\\uCFA8\\uCFC4\\uCFE0\\uCFFC\\uD018\\uD034\\uD050"
1451 "\\uD06C\\uD088\\uD0A4\\uD0C0\\uD0DC\\uD0F8\\uD114\\uD130\\uD14C"
1452 "\\uD168\\uD184\\uD1A0\\uD1BC\\uD1D8\\uD1F4\\uD210\\uD22C\\uD248"
1453 "\\uD264\\uD280\\uD29C\\uD2B8\\uD2D4\\uD2F0\\uD30C\\uD328\\uD344"
1454 "\\uD360\\uD37C\\uD398\\uD3B4\\uD3D0\\uD3EC\\uD408\\uD424\\uD440"
1455 "\\uD45C\\uD478\\uD494\\uD4B0\\uD4CC\\uD4E8\\uD504\\uD520\\uD53C"
1456 "\\uD558\\uD574\\uD590\\uD5AC\\uD5C8\\uD5E4\\uD600\\uD61C\\uD638"
1457 "\\uD654\\uD670\\uD68C\\uD6A8\\uD6C4\\uD6E0\\uD6FC\\uD718\\uD734"
1458 "\\uD750\\uD76C\\uD788\\uF900-\\uFA0D\\uFA10\\uFA12\\uFA15-"
1459 "\\uFA1E\\uFA20\\uFA22\\uFA25\\uFA26\\uFA2A-\\uFA2D\\uFA30-"
1460 "\\uFA6A\\uFA70-\\uFAD9\\uFB1D-\\uFB1F\\uFB2A-\\uFB36\\uFB38-"
1461 "\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFB4E\\uFE20"
1462 "-\\uFE26\\U000101FD\\U00010A0D\\U00010A0F\\U00010A38-\\U00010A3A"
1463 "\\U00010A3F\\U0001D15E-\\U0001D169\\U0001D16D-\\U0001D172\\U0001"
1464 "D17B-\\U0001D182\\U0001D185-\\U0001D18B\\U0001D1AA-\\U0001D1AD"
1465 "\\U0001D1BB-\\U0001D1C0\\U0001D242-\\U0001D244\\U0002F800-"
1469 skipSets
[UNORM_NFKD
].applyPattern(UnicodeString(
1470 "[^\\u00A0\\u00A8\\u00AA\\u00AF\\u00B2-\\u00B5\\u00B8-\\u00BA"
1471 "\\u00BC-\\u00BE\\u00C0-\\u00C5\\u00C7-\\u00CF\\u00D1-\\u00D6"
1472 "\\u00D9-\\u00DD\\u00E0-\\u00E5\\u00E7-\\u00EF\\u00F1-\\u00F6"
1473 "\\u00F9-\\u00FD\\u00FF-\\u010F\\u0112-\\u0125\\u0128-\\u0130"
1474 "\\u0132-\\u0137\\u0139-\\u0140\\u0143-\\u0149\\u014C-\\u0151"
1475 "\\u0154-\\u0165\\u0168-\\u017F\\u01A0\\u01A1\\u01AF\\u01B0"
1476 "\\u01C4-\\u01DC\\u01DE-\\u01E3\\u01E6-\\u01F5\\u01F8-\\u021B"
1477 "\\u021E\\u021F\\u0226-\\u0233\\u02B0-\\u02B8\\u02D8-\\u02DD"
1478 "\\u02E0-\\u02E4\\u0300-\\u034E\\u0350-\\u036F\\u0374\\u037A"
1479 "\\u037E\\u0384-\\u038A\\u038C\\u038E-\\u0390\\u03AA-\\u03B0"
1480 "\\u03CA-\\u03CE\\u03D0-\\u03D6\\u03F0-\\u03F2\\u03F4\\u03F5"
1481 "\\u03F9\\u0400\\u0401\\u0403\\u0407\\u040C-\\u040E\\u0419\\u0439"
1482 "\\u0450\\u0451\\u0453\\u0457\\u045C-\\u045E\\u0476\\u0477\\u0483"
1483 "-\\u0487\\u04C1\\u04C2\\u04D0-\\u04D3\\u04D6\\u04D7\\u04DA-"
1484 "\\u04DF\\u04E2-\\u04E7\\u04EA-\\u04F5\\u04F8\\u04F9\\u0587"
1485 "\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610"
1486 "-\\u061A\\u0622-\\u0626\\u064B-\\u065E\\u0670\\u0675-\\u0678"
1487 "\\u06C0\\u06C2\\u06D3\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7"
1488 "\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07EB-\\u07F3"
1489 "\\u0929\\u0931\\u0934\\u093C\\u094D\\u0951-\\u0954\\u0958-"
1490 "\\u095F\\u09BC\\u09CB-\\u09CD\\u09DC\\u09DD\\u09DF\\u0A33\\u0A36"
1491 "\\u0A3C\\u0A4D\\u0A59-\\u0A5B\\u0A5E\\u0ABC\\u0ACD\\u0B3C\\u0B48"
1492 "\\u0B4B-\\u0B4D\\u0B5C\\u0B5D\\u0B94\\u0BCA-\\u0BCD\\u0C48"
1493 "\\u0C4D\\u0C55\\u0C56\\u0CBC\\u0CC0\\u0CC7\\u0CC8\\u0CCA\\u0CCB"
1494 "\\u0CCD\\u0D4A-\\u0D4D\\u0DCA\\u0DDA\\u0DDC-\\u0DDE\\u0E33"
1495 "\\u0E38-\\u0E3A\\u0E48-\\u0E4B\\u0EB3\\u0EB8\\u0EB9\\u0EC8-"
1496 "\\u0ECB\\u0EDC\\u0EDD\\u0F0C\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39"
1497 "\\u0F43\\u0F4D\\u0F52\\u0F57\\u0F5C\\u0F69\\u0F71-\\u0F7D\\u0F80"
1498 "-\\u0F84\\u0F86\\u0F87\\u0F93\\u0F9D\\u0FA2\\u0FA7\\u0FAC\\u0FB9"
1499 "\\u0FC6\\u1026\\u1037\\u1039\\u103A\\u108D\\u10FC\\u135F\\u1714"
1500 "\\u1734\\u17D2\\u17DD\\u18A9\\u1939-\\u193B\\u1A17\\u1A18\\u1B06"
1501 "\\u1B08\\u1B0A\\u1B0C\\u1B0E\\u1B12\\u1B34\\u1B3B\\u1B3D\\u1B40"
1502 "\\u1B41\\u1B43\\u1B44\\u1B6B-\\u1B73\\u1BAA\\u1C37\\u1D2C-"
1503 "\\u1D2E\\u1D30-\\u1D3A\\u1D3C-\\u1D4D\\u1D4F-\\u1D6A\\u1D78"
1504 "\\u1D9B-\\u1DE6\\u1DFE-\\u1E9B\\u1EA0-\\u1EF9\\u1F00-\\u1F15"
1505 "\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57"
1506 "\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-"
1507 "\\u1FC4\\u1FC6-\\u1FD3\\u1FD6-\\u1FDB\\u1FDD-\\u1FEF\\u1FF2-"
1508 "\\u1FF4\\u1FF6-\\u1FFE\\u2000-\\u200A\\u2011\\u2017\\u2024-"
1509 "\\u2026\\u202F\\u2033\\u2034\\u2036\\u2037\\u203C\\u203E\\u2047-"
1510 "\\u2049\\u2057\\u205F\\u2070\\u2071\\u2074-\\u208E\\u2090-"
1511 "\\u2094\\u20A8\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2100-"
1512 "\\u2103\\u2105-\\u2107\\u2109-\\u2113\\u2115\\u2116\\u2119-"
1513 "\\u211D\\u2120-\\u2122\\u2124\\u2126\\u2128\\u212A-\\u212D"
1514 "\\u212F-\\u2131\\u2133-\\u2139\\u213B-\\u2140\\u2145-\\u2149"
1515 "\\u2153-\\u217F\\u219A\\u219B\\u21AE\\u21CD-\\u21CF\\u2204"
1516 "\\u2209\\u220C\\u2224\\u2226\\u222C\\u222D\\u222F\\u2230\\u2241"
1517 "\\u2244\\u2247\\u2249\\u2260\\u2262\\u226D-\\u2271\\u2274\\u2275"
1518 "\\u2278\\u2279\\u2280\\u2281\\u2284\\u2285\\u2288\\u2289\\u22AC-"
1519 "\\u22AF\\u22E0-\\u22E3\\u22EA-\\u22ED\\u2329\\u232A\\u2460-"
1520 "\\u24EA\\u2A0C\\u2A74-\\u2A76\\u2ADC\\u2C7C\\u2C7D\\u2D6F\\u2DE0"
1521 "-\\u2DFF\\u2E9F\\u2EF3\\u2F00-\\u2FD5\\u3000\\u302A-\\u302F"
1522 "\\u3036\\u3038-\\u303A\\u304C\\u304E\\u3050\\u3052\\u3054\\u3056"
1523 "\\u3058\\u305A\\u305C\\u305E\\u3060\\u3062\\u3065\\u3067\\u3069"
1524 "\\u3070\\u3071\\u3073\\u3074\\u3076\\u3077\\u3079\\u307A\\u307C"
1525 "\\u307D\\u3094\\u3099-\\u309C\\u309E\\u309F\\u30AC\\u30AE\\u30B0"
1526 "\\u30B2\\u30B4\\u30B6\\u30B8\\u30BA\\u30BC\\u30BE\\u30C0\\u30C2"
1527 "\\u30C5\\u30C7\\u30C9\\u30D0\\u30D1\\u30D3\\u30D4\\u30D6\\u30D7"
1528 "\\u30D9\\u30DA\\u30DC\\u30DD\\u30F4\\u30F7-\\u30FA\\u30FE\\u30FF"
1529 "\\u3131-\\u318E\\u3192-\\u319F\\u3200-\\u321E\\u3220-\\u3243"
1530 "\\u3250-\\u327E\\u3280-\\u32FE\\u3300-\\u33FF\\uA66F\\uA67C"
1531 "\\uA67D\\uA770\\uA806\\uA8C4\\uA92B-\\uA92D\\uA953\\uAC00-"
1532 "\\uD7A3\\uF900-\\uFA0D\\uFA10\\uFA12\\uFA15-\\uFA1E\\uFA20"
1533 "\\uFA22\\uFA25\\uFA26\\uFA2A-\\uFA2D\\uFA30-\\uFA6A\\uFA70-"
1534 "\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB36\\uFB38-"
1535 "\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3"
1536 "-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFC\\uFE10-"
1537 "\\uFE19\\uFE20-\\uFE26\\uFE30-\\uFE44\\uFE47-\\uFE52\\uFE54-"
1538 "\\uFE66\\uFE68-\\uFE6B\\uFE70-\\uFE72\\uFE74\\uFE76-\\uFEFC"
1539 "\\uFF01-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7"
1540 "\\uFFDA-\\uFFDC\\uFFE0-\\uFFE6\\uFFE8-\\uFFEE\\U000101FD\\U00010"
1541 "A0D\\U00010A0F\\U00010A38-\\U00010A3A\\U00010A3F\\U0001D15E-"
1542 "\\U0001D169\\U0001D16D-\\U0001D172\\U0001D17B-\\U0001D182\\U0001"
1543 "D185-\\U0001D18B\\U0001D1AA-\\U0001D1AD\\U0001D1BB-\\U0001D1C0"
1544 "\\U0001D242-\\U0001D244\\U0001D400-\\U0001D454\\U0001D456-"
1545 "\\U0001D49C\\U0001D49E\\U0001D49F\\U0001D4A2\\U0001D4A5\\U0001D4"
1546 "A6\\U0001D4A9-\\U0001D4AC\\U0001D4AE-\\U0001D4B9\\U0001D4BB"
1547 "\\U0001D4BD-\\U0001D4C3\\U0001D4C5-\\U0001D505\\U0001D507-"
1548 "\\U0001D50A\\U0001D50D-\\U0001D514\\U0001D516-\\U0001D51C\\U0001"
1549 "D51E-\\U0001D539\\U0001D53B-\\U0001D53E\\U0001D540-\\U0001D544"
1550 "\\U0001D546\\U0001D54A-\\U0001D550\\U0001D552-\\U0001D6A5\\U0001"
1551 "D6A8-\\U0001D7CB\\U0001D7CE-\\U0001D7FF\\U0002F800-\\U0002FA1D]"
1554 skipSets
[UNORM_NFKC
].applyPattern(UnicodeString(
1555 "[^<->A-PR-Za-pr-z\\u00A0\\u00A8\\u00AA\\u00AF\\u00B2-\\u00B5"
1556 "\\u00B8-\\u00BA\\u00BC-\\u00BE\\u00C0-\\u00CF\\u00D1-\\u00D6"
1557 "\\u00D8-\\u00DD\\u00E0-\\u00EF\\u00F1-\\u00F6\\u00F8-\\u00FD"
1558 "\\u00FF-\\u0103\\u0106-\\u010F\\u0112-\\u0117\\u011A-\\u0121"
1559 "\\u0124\\u0125\\u0128-\\u012D\\u0130\\u0132\\u0133\\u0139\\u013A"
1560 "\\u013D-\\u0140\\u0143\\u0144\\u0147-\\u0149\\u014C-\\u0151"
1561 "\\u0154\\u0155\\u0158-\\u015D\\u0160\\u0161\\u0164\\u0165\\u0168"
1562 "-\\u0171\\u0174-\\u017F\\u01A0\\u01A1\\u01AF\\u01B0\\u01B7"
1563 "\\u01C4-\\u01DC\\u01DE-\\u01E1\\u01E6-\\u01EB\\u01F1-\\u01F5"
1564 "\\u01F8-\\u01FB\\u0200-\\u021B\\u021E\\u021F\\u0226-\\u0233"
1565 "\\u0292\\u02B0-\\u02B8\\u02D8-\\u02DD\\u02E0-\\u02E4\\u0300-"
1566 "\\u034E\\u0350-\\u036F\\u0374\\u037A\\u037E\\u0384\\u0385\\u0387"
1567 "\\u0391\\u0395\\u0397\\u0399\\u039F\\u03A1\\u03A5\\u03A9\\u03AC"
1568 "\\u03AE\\u03B1\\u03B5\\u03B7\\u03B9\\u03BF\\u03C1\\u03C5\\u03C9-"
1569 "\\u03CB\\u03CE\\u03D0-\\u03D6\\u03F0-\\u03F2\\u03F4\\u03F5"
1570 "\\u03F9\\u0406\\u0410\\u0413\\u0415-\\u0418\\u041A\\u041E\\u0423"
1571 "\\u0427\\u042B\\u042D\\u0430\\u0433\\u0435-\\u0438\\u043A\\u043E"
1572 "\\u0443\\u0447\\u044B\\u044D\\u0456\\u0474\\u0475\\u0483-\\u0487"
1573 "\\u04D8\\u04D9\\u04E8\\u04E9\\u0587\\u0591-\\u05BD\\u05BF\\u05C1"
1574 "\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u0622\\u0623\\u0627"
1575 "\\u0648\\u064A-\\u065E\\u0670\\u0675-\\u0678\\u06C1\\u06D2"
1576 "\\u06D5-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED"
1577 "\\u0711\\u0730-\\u074A\\u07EB-\\u07F3\\u0928\\u0930\\u0933"
1578 "\\u093C\\u094D\\u0951-\\u0954\\u0958-\\u095F\\u09BC\\u09BE"
1579 "\\u09C7\\u09CD\\u09D7\\u09DC\\u09DD\\u09DF\\u0A33\\u0A36\\u0A3C"
1580 "\\u0A4D\\u0A59-\\u0A5B\\u0A5E\\u0ABC\\u0ACD\\u0B3C\\u0B3E\\u0B47"
1581 "\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B92\\u0BBE\\u0BC6\\u0BC7"
1582 "\\u0BCD\\u0BD7\\u0C46\\u0C4D\\u0C55\\u0C56\\u0CBC\\u0CBF\\u0CC2"
1583 "\\u0CC6\\u0CCA\\u0CCD\\u0CD5\\u0CD6\\u0D3E\\u0D46\\u0D47\\u0D4D"
1584 "\\u0D57\\u0DCA\\u0DCF\\u0DD9\\u0DDC\\u0DDF\\u0E33\\u0E38-\\u0E3A"
1585 "\\u0E48-\\u0E4B\\u0EB3\\u0EB8\\u0EB9\\u0EC8-\\u0ECB\\u0EDC"
1586 "\\u0EDD\\u0F0C\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F43\\u0F4D"
1587 "\\u0F52\\u0F57\\u0F5C\\u0F69\\u0F71-\\u0F7D\\u0F80-\\u0F84"
1588 "\\u0F86\\u0F87\\u0F93\\u0F9D\\u0FA2\\u0FA7\\u0FAC\\u0FB9\\u0FC6"
1589 "\\u1025\\u102E\\u1037\\u1039\\u103A\\u108D\\u10FC\\u1100-\\u1112"
1590 "\\u1161-\\u1175\\u11A8-\\u11C2\\u135F\\u1714\\u1734\\u17D2"
1591 "\\u17DD\\u18A9\\u1939-\\u193B\\u1A17\\u1A18\\u1B05\\u1B07\\u1B09"
1592 "\\u1B0B\\u1B0D\\u1B11\\u1B34\\u1B35\\u1B3A\\u1B3C\\u1B3E\\u1B3F"
1593 "\\u1B42\\u1B44\\u1B6B-\\u1B73\\u1BAA\\u1C37\\u1D2C-\\u1D2E"
1594 "\\u1D30-\\u1D3A\\u1D3C-\\u1D4D\\u1D4F-\\u1D6A\\u1D78\\u1D9B-"
1595 "\\u1DE6\\u1DFE-\\u1E03\\u1E0A-\\u1E0F\\u1E12-\\u1E1B\\u1E20-"
1596 "\\u1E27\\u1E2A-\\u1E41\\u1E44-\\u1E53\\u1E58-\\u1E7D\\u1E80-"
1597 "\\u1E87\\u1E8E-\\u1E91\\u1E96-\\u1E9B\\u1EA0-\\u1EF3\\u1EF6-"
1598 "\\u1EF9\\u1F00-\\u1F11\\u1F18\\u1F19\\u1F20-\\u1F31\\u1F38"
1599 "\\u1F39\\u1F40\\u1F41\\u1F48\\u1F49\\u1F50\\u1F51\\u1F59\\u1F60-"
1600 "\\u1F71\\u1F73-\\u1F75\\u1F77\\u1F79\\u1F7B-\\u1F7D\\u1F80"
1601 "\\u1F81\\u1F88\\u1F89\\u1F90\\u1F91\\u1F98\\u1F99\\u1FA0\\u1FA1"
1602 "\\u1FA8\\u1FA9\\u1FB3\\u1FB6\\u1FBB-\\u1FC1\\u1FC3\\u1FC6\\u1FC9"
1603 "\\u1FCB-\\u1FCF\\u1FD3\\u1FDB\\u1FDD-\\u1FDF\\u1FE3\\u1FEB"
1604 "\\u1FED-\\u1FEF\\u1FF3\\u1FF6\\u1FF9\\u1FFB-\\u1FFE\\u2000-"
1605 "\\u200A\\u2011\\u2017\\u2024-\\u2026\\u202F\\u2033\\u2034\\u2036"
1606 "\\u2037\\u203C\\u203E\\u2047-\\u2049\\u2057\\u205F\\u2070\\u2071"
1607 "\\u2074-\\u208E\\u2090-\\u2094\\u20A8\\u20D0-\\u20DC\\u20E1"
1608 "\\u20E5-\\u20F0\\u2100-\\u2103\\u2105-\\u2107\\u2109-\\u2113"
1609 "\\u2115\\u2116\\u2119-\\u211D\\u2120-\\u2122\\u2124\\u2126"
1610 "\\u2128\\u212A-\\u212D\\u212F-\\u2131\\u2133-\\u2139\\u213B-"
1611 "\\u2140\\u2145-\\u2149\\u2153-\\u217F\\u2190\\u2192\\u2194"
1612 "\\u21D0\\u21D2\\u21D4\\u2203\\u2208\\u220B\\u2223\\u2225\\u222C"
1613 "\\u222D\\u222F\\u2230\\u223C\\u2243\\u2245\\u2248\\u224D\\u2261"
1614 "\\u2264\\u2265\\u2272\\u2273\\u2276\\u2277\\u227A-\\u227D\\u2282"
1615 "\\u2283\\u2286\\u2287\\u2291\\u2292\\u22A2\\u22A8\\u22A9\\u22AB"
1616 "\\u22B2-\\u22B5\\u2329\\u232A\\u2460-\\u24EA\\u2A0C\\u2A74-"
1617 "\\u2A76\\u2ADC\\u2C7C\\u2C7D\\u2D6F\\u2DE0-\\u2DFF\\u2E9F\\u2EF3"
1618 "\\u2F00-\\u2FD5\\u3000\\u302A-\\u302F\\u3036\\u3038-\\u303A"
1619 "\\u3046\\u304B\\u304D\\u304F\\u3051\\u3053\\u3055\\u3057\\u3059"
1620 "\\u305B\\u305D\\u305F\\u3061\\u3064\\u3066\\u3068\\u306F\\u3072"
1621 "\\u3075\\u3078\\u307B\\u3099-\\u309D\\u309F\\u30A6\\u30AB\\u30AD"
1622 "\\u30AF\\u30B1\\u30B3\\u30B5\\u30B7\\u30B9\\u30BB\\u30BD\\u30BF"
1623 "\\u30C1\\u30C4\\u30C6\\u30C8\\u30CF\\u30D2\\u30D5\\u30D8\\u30DB"
1624 "\\u30EF-\\u30F2\\u30FD\\u30FF\\u3131-\\u318E\\u3192-\\u319F"
1625 "\\u3200-\\u321E\\u3220-\\u3243\\u3250-\\u327E\\u3280-\\u32FE"
1626 "\\u3300-\\u33FF\\uA66F\\uA67C\\uA67D\\uA770\\uA806\\uA8C4\\uA92B"
1627 "-\\uA92D\\uA953\\uAC00\\uAC1C\\uAC38\\uAC54\\uAC70\\uAC8C\\uACA8"
1628 "\\uACC4\\uACE0\\uACFC\\uAD18\\uAD34\\uAD50\\uAD6C\\uAD88\\uADA4"
1629 "\\uADC0\\uADDC\\uADF8\\uAE14\\uAE30\\uAE4C\\uAE68\\uAE84\\uAEA0"
1630 "\\uAEBC\\uAED8\\uAEF4\\uAF10\\uAF2C\\uAF48\\uAF64\\uAF80\\uAF9C"
1631 "\\uAFB8\\uAFD4\\uAFF0\\uB00C\\uB028\\uB044\\uB060\\uB07C\\uB098"
1632 "\\uB0B4\\uB0D0\\uB0EC\\uB108\\uB124\\uB140\\uB15C\\uB178\\uB194"
1633 "\\uB1B0\\uB1CC\\uB1E8\\uB204\\uB220\\uB23C\\uB258\\uB274\\uB290"
1634 "\\uB2AC\\uB2C8\\uB2E4\\uB300\\uB31C\\uB338\\uB354\\uB370\\uB38C"
1635 "\\uB3A8\\uB3C4\\uB3E0\\uB3FC\\uB418\\uB434\\uB450\\uB46C\\uB488"
1636 "\\uB4A4\\uB4C0\\uB4DC\\uB4F8\\uB514\\uB530\\uB54C\\uB568\\uB584"
1637 "\\uB5A0\\uB5BC\\uB5D8\\uB5F4\\uB610\\uB62C\\uB648\\uB664\\uB680"
1638 "\\uB69C\\uB6B8\\uB6D4\\uB6F0\\uB70C\\uB728\\uB744\\uB760\\uB77C"
1639 "\\uB798\\uB7B4\\uB7D0\\uB7EC\\uB808\\uB824\\uB840\\uB85C\\uB878"
1640 "\\uB894\\uB8B0\\uB8CC\\uB8E8\\uB904\\uB920\\uB93C\\uB958\\uB974"
1641 "\\uB990\\uB9AC\\uB9C8\\uB9E4\\uBA00\\uBA1C\\uBA38\\uBA54\\uBA70"
1642 "\\uBA8C\\uBAA8\\uBAC4\\uBAE0\\uBAFC\\uBB18\\uBB34\\uBB50\\uBB6C"
1643 "\\uBB88\\uBBA4\\uBBC0\\uBBDC\\uBBF8\\uBC14\\uBC30\\uBC4C\\uBC68"
1644 "\\uBC84\\uBCA0\\uBCBC\\uBCD8\\uBCF4\\uBD10\\uBD2C\\uBD48\\uBD64"
1645 "\\uBD80\\uBD9C\\uBDB8\\uBDD4\\uBDF0\\uBE0C\\uBE28\\uBE44\\uBE60"
1646 "\\uBE7C\\uBE98\\uBEB4\\uBED0\\uBEEC\\uBF08\\uBF24\\uBF40\\uBF5C"
1647 "\\uBF78\\uBF94\\uBFB0\\uBFCC\\uBFE8\\uC004\\uC020\\uC03C\\uC058"
1648 "\\uC074\\uC090\\uC0AC\\uC0C8\\uC0E4\\uC100\\uC11C\\uC138\\uC154"
1649 "\\uC170\\uC18C\\uC1A8\\uC1C4\\uC1E0\\uC1FC\\uC218\\uC234\\uC250"
1650 "\\uC26C\\uC288\\uC2A4\\uC2C0\\uC2DC\\uC2F8\\uC314\\uC330\\uC34C"
1651 "\\uC368\\uC384\\uC3A0\\uC3BC\\uC3D8\\uC3F4\\uC410\\uC42C\\uC448"
1652 "\\uC464\\uC480\\uC49C\\uC4B8\\uC4D4\\uC4F0\\uC50C\\uC528\\uC544"
1653 "\\uC560\\uC57C\\uC598\\uC5B4\\uC5D0\\uC5EC\\uC608\\uC624\\uC640"
1654 "\\uC65C\\uC678\\uC694\\uC6B0\\uC6CC\\uC6E8\\uC704\\uC720\\uC73C"
1655 "\\uC758\\uC774\\uC790\\uC7AC\\uC7C8\\uC7E4\\uC800\\uC81C\\uC838"
1656 "\\uC854\\uC870\\uC88C\\uC8A8\\uC8C4\\uC8E0\\uC8FC\\uC918\\uC934"
1657 "\\uC950\\uC96C\\uC988\\uC9A4\\uC9C0\\uC9DC\\uC9F8\\uCA14\\uCA30"
1658 "\\uCA4C\\uCA68\\uCA84\\uCAA0\\uCABC\\uCAD8\\uCAF4\\uCB10\\uCB2C"
1659 "\\uCB48\\uCB64\\uCB80\\uCB9C\\uCBB8\\uCBD4\\uCBF0\\uCC0C\\uCC28"
1660 "\\uCC44\\uCC60\\uCC7C\\uCC98\\uCCB4\\uCCD0\\uCCEC\\uCD08\\uCD24"
1661 "\\uCD40\\uCD5C\\uCD78\\uCD94\\uCDB0\\uCDCC\\uCDE8\\uCE04\\uCE20"
1662 "\\uCE3C\\uCE58\\uCE74\\uCE90\\uCEAC\\uCEC8\\uCEE4\\uCF00\\uCF1C"
1663 "\\uCF38\\uCF54\\uCF70\\uCF8C\\uCFA8\\uCFC4\\uCFE0\\uCFFC\\uD018"
1664 "\\uD034\\uD050\\uD06C\\uD088\\uD0A4\\uD0C0\\uD0DC\\uD0F8\\uD114"
1665 "\\uD130\\uD14C\\uD168\\uD184\\uD1A0\\uD1BC\\uD1D8\\uD1F4\\uD210"
1666 "\\uD22C\\uD248\\uD264\\uD280\\uD29C\\uD2B8\\uD2D4\\uD2F0\\uD30C"
1667 "\\uD328\\uD344\\uD360\\uD37C\\uD398\\uD3B4\\uD3D0\\uD3EC\\uD408"
1668 "\\uD424\\uD440\\uD45C\\uD478\\uD494\\uD4B0\\uD4CC\\uD4E8\\uD504"
1669 "\\uD520\\uD53C\\uD558\\uD574\\uD590\\uD5AC\\uD5C8\\uD5E4\\uD600"
1670 "\\uD61C\\uD638\\uD654\\uD670\\uD68C\\uD6A8\\uD6C4\\uD6E0\\uD6FC"
1671 "\\uD718\\uD734\\uD750\\uD76C\\uD788\\uF900-\\uFA0D\\uFA10\\uFA12"
1672 "\\uFA15-\\uFA1E\\uFA20\\uFA22\\uFA25\\uFA26\\uFA2A-\\uFA2D"
1673 "\\uFA30-\\uFA6A\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17"
1674 "\\uFB1D-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43"
1675 "\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-"
1676 "\\uFDC7\\uFDF0-\\uFDFC\\uFE10-\\uFE19\\uFE20-\\uFE26\\uFE30-"
1677 "\\uFE44\\uFE47-\\uFE52\\uFE54-\\uFE66\\uFE68-\\uFE6B\\uFE70-"
1678 "\\uFE72\\uFE74\\uFE76-\\uFEFC\\uFF01-\\uFFBE\\uFFC2-\\uFFC7"
1679 "\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\uFFE0-\\uFFE6"
1680 "\\uFFE8-\\uFFEE\\U000101FD\\U00010A0D\\U00010A0F\\U00010A38-"
1681 "\\U00010A3A\\U00010A3F\\U0001D15E-\\U0001D169\\U0001D16D-\\U0001"
1682 "D172\\U0001D17B-\\U0001D182\\U0001D185-\\U0001D18B\\U0001D1AA-"
1683 "\\U0001D1AD\\U0001D1BB-\\U0001D1C0\\U0001D242-\\U0001D244\\U0001"
1684 "D400-\\U0001D454\\U0001D456-\\U0001D49C\\U0001D49E\\U0001D49F"
1685 "\\U0001D4A2\\U0001D4A5\\U0001D4A6\\U0001D4A9-\\U0001D4AC\\U0001D"
1686 "4AE-\\U0001D4B9\\U0001D4BB\\U0001D4BD-\\U0001D4C3\\U0001D4C5-"
1687 "\\U0001D505\\U0001D507-\\U0001D50A\\U0001D50D-\\U0001D514\\U0001"
1688 "D516-\\U0001D51C\\U0001D51E-\\U0001D539\\U0001D53B-\\U0001D53E"
1689 "\\U0001D540-\\U0001D544\\U0001D546\\U0001D54A-\\U0001D550\\U0001"
1690 "D552-\\U0001D6A5\\U0001D6A8-\\U0001D7CB\\U0001D7CE-\\U0001D7FF"
1691 "\\U0002F800-\\U0002FA1D]"
1697 // USetAdder implementation
1698 // Does not use uset.h to reduce code dependencies
1699 static void U_CALLCONV
1700 _set_add(USet
*set
, UChar32 c
) {
1704 static void U_CALLCONV
1705 _set_addRange(USet
*set
, UChar32 start
, UChar32 end
) {
1706 uset_addRange(set
, start
, end
);
1709 static void U_CALLCONV
1710 _set_addString(USet
*set
, const UChar
*str
, int32_t length
) {
1711 uset_addString(set
, str
, length
);
1717 BasicNormalizerTest::TestSkippable() {
1718 UnicodeSet starts
, diff
, skipSets
[UNORM_MODE_COUNT
], expectSets
[UNORM_MODE_COUNT
];
1719 UnicodeSet
*startsPtr
= &starts
;
1720 UnicodeString s
, pattern
;
1721 UChar32 start
, limit
, rangeStart
, rangeEnd
;
1722 int32_t i
, range
, count
;
1726 /* build NF*Skippable sets from runtime data */
1727 status
=U_ZERO_ERROR
;
1733 NULL
, // don't need remove()
1736 unorm_addPropertyStarts(&sa
, &status
);
1737 if(U_FAILURE(status
)) {
1738 errln("unable to load normalization data for unorm_addPropertyStarts(() - %s\n", u_errorName(status
));
1741 count
=starts
.getRangeCount();
1744 rangeStart
=rangeEnd
=0;
1748 /* get properties for start and apply them to [start..limit[ */
1749 if(unorm_isNFSkippable(start
, UNORM_NFD
)) {
1750 skipSets
[UNORM_NFD
].add(start
, limit
-1);
1752 if(unorm_isNFSkippable(start
, UNORM_NFKD
)) {
1753 skipSets
[UNORM_NFKD
].add(start
, limit
-1);
1755 if(unorm_isNFSkippable(start
, UNORM_NFC
)) {
1756 skipSets
[UNORM_NFC
].add(start
, limit
-1);
1758 if(unorm_isNFSkippable(start
, UNORM_NFKC
)) {
1759 skipSets
[UNORM_NFKC
].add(start
, limit
-1);
1763 /* go to next range of same properties */
1765 if(++limit
>rangeEnd
) {
1767 limit
=rangeStart
=starts
.getRangeStart(range
);
1768 rangeEnd
=starts
.getRangeEnd(range
);
1770 } else if(range
==count
) {
1771 /* additional range to complete the Unicode code space */
1772 limit
=rangeStart
=rangeEnd
=0x110000;
1780 /* get expected sets from hardcoded patterns */
1781 initExpectedSkippables(expectSets
);
1783 for(i
=UNORM_NONE
; i
<UNORM_MODE_COUNT
; ++i
) {
1784 if(skipSets
[i
]!=expectSets
[i
]) {
1785 errln("error: TestSkippable skipSets[%d]!=expectedSets[%d]\n"
1786 "may need to update hardcoded UnicodeSet patterns in\n"
1787 "tstnorm.cpp/initExpectedSkippables(),\n"
1788 "see ICU4J - unicodetools.com.ibm.text.UCD.NFSkippable\n",
1791 s
=UNICODE_STRING_SIMPLE("skip-expect=");
1792 (diff
=skipSets
[i
]).removeAll(expectSets
[i
]).toPattern(pattern
, TRUE
);
1796 s
.append(UNICODE_STRING_SIMPLE("\n\nexpect-skip="));
1797 (diff
=expectSets
[i
]).removeAll(skipSets
[i
]).toPattern(pattern
, TRUE
);
1799 s
.append(UNICODE_STRING_SIMPLE("\n\n"));
1806 #endif /* #if !UCONFIG_NO_NORMALIZATION */