]>
Commit | Line | Data |
---|---|---|
1 | // © 2016 and later: Unicode, Inc. and others. | |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
3 | /* | |
4 | ********************************************************************** | |
5 | * Copyright (C) 2000-2016, International Business Machines | |
6 | * Corporation and others. All Rights Reserved. | |
7 | ********************************************************************** | |
8 | * Date Name Description | |
9 | * 05/23/00 aliu Creation. | |
10 | ********************************************************************** | |
11 | */ | |
12 | ||
13 | #include "unicode/utypes.h" | |
14 | ||
15 | #if !UCONFIG_NO_TRANSLITERATION | |
16 | ||
17 | #include "unicode/translit.h" | |
18 | #include "rbt.h" | |
19 | #include "unicode/calendar.h" | |
20 | #include "unicode/uniset.h" | |
21 | #include "unicode/uchar.h" | |
22 | #include "unicode/normlzr.h" | |
23 | #include "unicode/uchar.h" | |
24 | #include "unicode/parseerr.h" | |
25 | #include "unicode/usetiter.h" | |
26 | #include "unicode/putil.h" | |
27 | #include "unicode/uversion.h" | |
28 | #include "unicode/locid.h" | |
29 | #include "unicode/ulocdata.h" | |
30 | #include "unicode/utf8.h" | |
31 | #include "unicode/utf16.h" | |
32 | #include "putilimp.h" | |
33 | #include "cmemory.h" | |
34 | #include "transrt.h" | |
35 | #include "testutil.h" | |
36 | #include "uassert.h" | |
37 | #include <string.h> | |
38 | #include <stdio.h> | |
39 | ||
40 | #define CASE(id,test) case id: \ | |
41 | name = #test; \ | |
42 | if (exec) { \ | |
43 | logln(#test "---"); \ | |
44 | logln((UnicodeString)""); \ | |
45 | UDate t = uprv_getUTCtime(); \ | |
46 | test(); \ | |
47 | t = uprv_getUTCtime() - t; \ | |
48 | logln((UnicodeString)#test " took " + t/U_MILLIS_PER_DAY + " seconds"); \ | |
49 | } \ | |
50 | break | |
51 | ||
52 | #define EXHAUSTIVE(id,test) case id: \ | |
53 | if(quick==FALSE){ \ | |
54 | name = #test; \ | |
55 | if (exec){ \ | |
56 | logln(#test "---"); \ | |
57 | logln((UnicodeString)""); \ | |
58 | test(); \ | |
59 | } \ | |
60 | }else{ \ | |
61 | name=""; \ | |
62 | } \ | |
63 | break | |
64 | void | |
65 | TransliteratorRoundTripTest::runIndexedTest(int32_t index, UBool exec, | |
66 | const char* &name, char* /*par*/) { | |
67 | switch (index) { | |
68 | CASE(0, TestCyrillic); | |
69 | // CASE(0,TestKana); | |
70 | CASE(1,TestHiragana); | |
71 | CASE(2,TestKatakana); | |
72 | CASE(3,TestJamo); | |
73 | CASE(4,TestHangul); | |
74 | CASE(5,TestGreek); | |
75 | CASE(6,TestGreekUNGEGN); | |
76 | CASE(7,Testel); | |
77 | CASE(8,TestDevanagariLatin); | |
78 | CASE(9,TestInterIndic); | |
79 | CASE(10, TestHebrew); | |
80 | CASE(11, TestArabic); | |
81 | CASE(12, TestHan); | |
82 | default: name = ""; break; | |
83 | } | |
84 | } | |
85 | ||
86 | ||
87 | //-------------------------------------------------------------------- | |
88 | // TransliteratorPointer | |
89 | //-------------------------------------------------------------------- | |
90 | ||
91 | /** | |
92 | * A transliterator pointer wrapper that deletes the contained | |
93 | * pointer automatically when the wrapper goes out of scope. | |
94 | * Sometimes called a "janitor" or "smart pointer". | |
95 | */ | |
96 | class TransliteratorPointer { | |
97 | Transliterator* t; | |
98 | // disallowed: | |
99 | TransliteratorPointer(const TransliteratorPointer& rhs); | |
100 | TransliteratorPointer& operator=(const TransliteratorPointer& rhs); | |
101 | public: | |
102 | TransliteratorPointer(Transliterator* adopted) { | |
103 | t = adopted; | |
104 | } | |
105 | ~TransliteratorPointer() { | |
106 | delete t; | |
107 | } | |
108 | inline Transliterator* operator->() { return t; } | |
109 | inline operator const Transliterator*() const { return t; } | |
110 | inline operator Transliterator*() { return t; } | |
111 | }; | |
112 | ||
113 | //-------------------------------------------------------------------- | |
114 | // Legal | |
115 | //-------------------------------------------------------------------- | |
116 | ||
117 | class Legal { | |
118 | public: | |
119 | Legal() {} | |
120 | virtual ~Legal() {} | |
121 | virtual UBool is(const UnicodeString& /*sourceString*/) const {return TRUE;} | |
122 | }; | |
123 | ||
124 | class LegalJamo : public Legal { | |
125 | // any initial must be followed by a medial (or initial) | |
126 | // any medial must follow an initial (or medial) | |
127 | // any final must follow a medial (or final) | |
128 | public: | |
129 | LegalJamo() {} | |
130 | virtual ~LegalJamo() {} | |
131 | virtual UBool is(const UnicodeString& sourceString) const; | |
132 | int getType(UChar c) const; | |
133 | }; | |
134 | ||
135 | UBool LegalJamo::is(const UnicodeString& sourceString) const { | |
136 | int t; | |
137 | UnicodeString decomp; | |
138 | UErrorCode ec = U_ZERO_ERROR; | |
139 | Normalizer::decompose(sourceString, FALSE, 0, decomp, ec); | |
140 | if (U_FAILURE(ec)) { | |
141 | return FALSE; | |
142 | } | |
143 | for (int i = 0; i < decomp.length(); ++i) { // don't worry about surrogates | |
144 | switch (getType(decomp.charAt(i))) { | |
145 | case 0: t = getType(decomp.charAt(i+1)); | |
146 | if (t != 0 && t != 1) { return FALSE; } | |
147 | break; | |
148 | case 1: t = getType(decomp.charAt(i-1)); | |
149 | if (t != 0 && t != 1) { return FALSE; } | |
150 | break; | |
151 | case 2: t = getType(decomp.charAt(i-1)); | |
152 | if (t != 1 && t != 2) { return FALSE; } | |
153 | break; | |
154 | } | |
155 | } | |
156 | return TRUE; | |
157 | } | |
158 | ||
159 | int LegalJamo::getType(UChar c) const { | |
160 | if (0x1100 <= c && c <= 0x1112) | |
161 | return 0; | |
162 | else if (0x1161 <= c && c <= 0x1175) | |
163 | return 1; | |
164 | else if (0x11A8 <= c && c <= 0x11C2) | |
165 | return 2; | |
166 | return -1; // other | |
167 | } | |
168 | ||
169 | class LegalGreek : public Legal { | |
170 | UBool full; | |
171 | public: | |
172 | LegalGreek(UBool _full) { full = _full; } | |
173 | virtual ~LegalGreek() {} | |
174 | ||
175 | virtual UBool is(const UnicodeString& sourceString) const; | |
176 | ||
177 | static UBool isVowel(UChar c); | |
178 | ||
179 | static UBool isRho(UChar c); | |
180 | }; | |
181 | ||
182 | UBool LegalGreek::is(const UnicodeString& sourceString) const { | |
183 | UnicodeString decomp; | |
184 | UErrorCode ec = U_ZERO_ERROR; | |
185 | Normalizer::decompose(sourceString, FALSE, 0, decomp, ec); | |
186 | ||
187 | // modern is simpler: don't care about anything but a grave | |
188 | if (full == FALSE) { | |
189 | // A special case which is legal but should be | |
190 | // excluded from round trip | |
191 | // if (sourceString == UnicodeString("\\u039C\\u03C0", "")) { | |
192 | // return FALSE; | |
193 | // } | |
194 | for (int32_t i = 0; i < decomp.length(); ++i) { | |
195 | UChar c = decomp.charAt(i); | |
196 | // exclude all the accents | |
197 | if (c == 0x0313 || c == 0x0314 || c == 0x0300 || c == 0x0302 | |
198 | || c == 0x0342 || c == 0x0345 | |
199 | ) return FALSE; | |
200 | } | |
201 | return TRUE; | |
202 | } | |
203 | ||
204 | // Legal greek has breathing marks IFF there is a vowel or RHO at the start | |
205 | // IF it has them, it has exactly one. | |
206 | // IF it starts with a RHO, then the breathing mark must come before the second letter. | |
207 | // Since there are no surrogates in greek, don't worry about them | |
208 | UBool firstIsVowel = FALSE; | |
209 | UBool firstIsRho = FALSE; | |
210 | UBool noLetterYet = TRUE; | |
211 | int32_t breathingCount = 0; | |
212 | int32_t letterCount = 0; | |
213 | for (int32_t i = 0; i < decomp.length(); ++i) { | |
214 | UChar c = decomp.charAt(i); | |
215 | if (u_isalpha(c)) { | |
216 | ++letterCount; | |
217 | if (noLetterYet) { | |
218 | noLetterYet = FALSE; | |
219 | firstIsVowel = isVowel(c); | |
220 | firstIsRho = isRho(c); | |
221 | } | |
222 | if (firstIsRho && letterCount == 2 && breathingCount == 0) { | |
223 | return FALSE; | |
224 | } | |
225 | } | |
226 | if (c == 0x0313 || c == 0x0314) { | |
227 | ++breathingCount; | |
228 | } | |
229 | } | |
230 | ||
231 | if (firstIsVowel || firstIsRho) return breathingCount == 1; | |
232 | return breathingCount == 0; | |
233 | } | |
234 | ||
235 | UBool LegalGreek::isVowel(UChar c) { | |
236 | switch (c) { | |
237 | case 0x03B1: | |
238 | case 0x03B5: | |
239 | case 0x03B7: | |
240 | case 0x03B9: | |
241 | case 0x03BF: | |
242 | case 0x03C5: | |
243 | case 0x03C9: | |
244 | case 0x0391: | |
245 | case 0x0395: | |
246 | case 0x0397: | |
247 | case 0x0399: | |
248 | case 0x039F: | |
249 | case 0x03A5: | |
250 | case 0x03A9: | |
251 | return TRUE; | |
252 | } | |
253 | return FALSE; | |
254 | } | |
255 | ||
256 | UBool LegalGreek::isRho(UChar c) { | |
257 | switch (c) { | |
258 | case 0x03C1: | |
259 | case 0x03A1: | |
260 | return TRUE; | |
261 | } | |
262 | return FALSE; | |
263 | } | |
264 | ||
265 | // AbbreviatedUnicodeSetIterator Interface --------------------------------------------- | |
266 | // | |
267 | // Iterate over a UnicodeSet, only returning a sampling of the contained code points. | |
268 | // density is the approximate total number of code points to returned for the entire set. | |
269 | // | |
270 | ||
271 | class AbbreviatedUnicodeSetIterator : public UnicodeSetIterator { | |
272 | public : | |
273 | ||
274 | AbbreviatedUnicodeSetIterator(); | |
275 | virtual ~AbbreviatedUnicodeSetIterator(); | |
276 | void reset(UnicodeSet& set, UBool abb = FALSE, int32_t density = 100); | |
277 | ||
278 | /** | |
279 | * ICU "poor man's RTTI", returns a UClassID for this class. | |
280 | */ | |
281 | static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; } | |
282 | ||
283 | /** | |
284 | * ICU "poor man's RTTI", returns a UClassID for the actual class. | |
285 | */ | |
286 | virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); } | |
287 | ||
288 | private : | |
289 | UBool abbreviated; | |
290 | int32_t perRange; // The maximum number of code points to be returned from each range | |
291 | virtual void loadRange(int32_t range); | |
292 | ||
293 | /** | |
294 | * The address of this static class variable serves as this class's ID | |
295 | * for ICU "poor man's RTTI". | |
296 | */ | |
297 | static const char fgClassID; | |
298 | }; | |
299 | ||
300 | // AbbreviatedUnicodeSetIterator Implementation --------------------------------------- | |
301 | ||
302 | const char AbbreviatedUnicodeSetIterator::fgClassID=0; | |
303 | ||
304 | AbbreviatedUnicodeSetIterator::AbbreviatedUnicodeSetIterator() : | |
305 | UnicodeSetIterator(), abbreviated(FALSE) { | |
306 | } | |
307 | ||
308 | AbbreviatedUnicodeSetIterator::~AbbreviatedUnicodeSetIterator() { | |
309 | } | |
310 | ||
311 | void AbbreviatedUnicodeSetIterator::reset(UnicodeSet& newSet, UBool abb, int32_t density) { | |
312 | UnicodeSetIterator::reset(newSet); | |
313 | abbreviated = abb; | |
314 | perRange = newSet.getRangeCount(); | |
315 | if (perRange != 0) { | |
316 | perRange = density / perRange; | |
317 | } | |
318 | } | |
319 | ||
320 | void AbbreviatedUnicodeSetIterator::loadRange(int32_t myRange) { | |
321 | UnicodeSetIterator::loadRange(myRange); | |
322 | if (abbreviated && (endElement > nextElement + perRange)) { | |
323 | endElement = nextElement + perRange; | |
324 | } | |
325 | } | |
326 | ||
327 | //-------------------------------------------------------------------- | |
328 | // RTTest Interface | |
329 | //-------------------------------------------------------------------- | |
330 | ||
331 | class RTTest : public IntlTest { | |
332 | ||
333 | // PrintWriter out; | |
334 | ||
335 | UnicodeString transliteratorID; | |
336 | int32_t errorLimit; | |
337 | int32_t errorCount; | |
338 | int32_t pairLimit; | |
339 | UnicodeSet sourceRange; | |
340 | UnicodeSet targetRange; | |
341 | UnicodeSet toSource; | |
342 | UnicodeSet toTarget; | |
343 | UnicodeSet roundtripExclusionsSet; | |
344 | IntlTest* parent; | |
345 | Legal* legalSource; // NOT owned | |
346 | UnicodeSet badCharacters; | |
347 | ||
348 | public: | |
349 | ||
350 | /* | |
351 | * create a test for the given script transliterator. | |
352 | */ | |
353 | RTTest(const UnicodeString& transliteratorIDStr); | |
354 | ||
355 | virtual ~RTTest(); | |
356 | ||
357 | void setErrorLimit(int32_t limit); | |
358 | ||
359 | void setPairLimit(int32_t limit); | |
360 | ||
361 | void test(const UnicodeString& sourceRange, | |
362 | const UnicodeString& targetRange, | |
363 | const char* roundtripExclusions, | |
364 | IntlTest* parent, | |
365 | UBool quick, | |
366 | Legal* adoptedLegal, | |
367 | int32_t density = 100); | |
368 | ||
369 | private: | |
370 | ||
371 | // Added to do better equality check. | |
372 | ||
373 | static UBool isSame(const UnicodeString& a, const UnicodeString& b); | |
374 | ||
375 | static UBool isCamel(const UnicodeString& a); | |
376 | ||
377 | UBool checkIrrelevants(Transliterator *t, const UnicodeString& irrelevants); | |
378 | ||
379 | void test2(UBool quick, int32_t density); | |
380 | ||
381 | void logWrongScript(const UnicodeString& label, | |
382 | const UnicodeString& from, | |
383 | const UnicodeString& to); | |
384 | ||
385 | void logNotCanonical(const UnicodeString& label, | |
386 | const UnicodeString& from, | |
387 | const UnicodeString& to, | |
388 | const UnicodeString& fromCan, | |
389 | const UnicodeString& toCan); | |
390 | ||
391 | void logFails(const UnicodeString& label); | |
392 | ||
393 | void logToRulesFails(const UnicodeString& label, | |
394 | const UnicodeString& from, | |
395 | const UnicodeString& to, | |
396 | const UnicodeString& toCan); | |
397 | ||
398 | void logRoundTripFailure(const UnicodeString& from, | |
399 | const UnicodeString& toID, | |
400 | const UnicodeString& to, | |
401 | const UnicodeString& backID, | |
402 | const UnicodeString& back); | |
403 | }; | |
404 | ||
405 | //-------------------------------------------------------------------- | |
406 | // RTTest Implementation | |
407 | //-------------------------------------------------------------------- | |
408 | ||
409 | /* | |
410 | * create a test for the given script transliterator. | |
411 | */ | |
412 | RTTest::RTTest(const UnicodeString& transliteratorIDStr) { | |
413 | transliteratorID = transliteratorIDStr; | |
414 | errorLimit = 500; | |
415 | errorCount = 0; | |
416 | pairLimit = 0x10000; | |
417 | } | |
418 | ||
419 | RTTest::~RTTest() { | |
420 | } | |
421 | ||
422 | void RTTest::setErrorLimit(int32_t limit) { | |
423 | errorLimit = limit; | |
424 | } | |
425 | ||
426 | void RTTest::setPairLimit(int32_t limit) { | |
427 | pairLimit = limit; | |
428 | } | |
429 | ||
430 | UBool RTTest::isSame(const UnicodeString& a, const UnicodeString& b) { | |
431 | if (a == b) return TRUE; | |
432 | if (a.caseCompare(b, U_FOLD_CASE_DEFAULT)==0 && isCamel(a)) return TRUE; | |
433 | UnicodeString aa, bb; | |
434 | UErrorCode ec = U_ZERO_ERROR; | |
435 | Normalizer::decompose(a, FALSE, 0, aa, ec); | |
436 | Normalizer::decompose(b, FALSE, 0, bb, ec); | |
437 | if (aa == bb) return TRUE; | |
438 | if (aa.caseCompare(bb, U_FOLD_CASE_DEFAULT)==0 && isCamel(aa)) return TRUE; | |
439 | return FALSE; | |
440 | } | |
441 | ||
442 | UBool RTTest::isCamel(const UnicodeString& a) { | |
443 | // see if string is of the form aB; e.g. lower, then upper or title | |
444 | UChar32 cp; | |
445 | UBool haveLower = FALSE; | |
446 | for (int32_t i = 0; i < a.length(); i += U16_LENGTH(cp)) { | |
447 | cp = a.char32At(i); | |
448 | int8_t t = u_charType(cp); | |
449 | switch (t) { | |
450 | case U_UPPERCASE_LETTER: | |
451 | if (haveLower) return TRUE; | |
452 | break; | |
453 | case U_TITLECASE_LETTER: | |
454 | if (haveLower) return TRUE; | |
455 | // fall through, since second letter is lower. | |
456 | U_FALLTHROUGH; | |
457 | case U_LOWERCASE_LETTER: | |
458 | haveLower = TRUE; | |
459 | break; | |
460 | } | |
461 | } | |
462 | return FALSE; | |
463 | } | |
464 | ||
465 | void RTTest::test(const UnicodeString& sourceRangeVal, | |
466 | const UnicodeString& targetRangeVal, | |
467 | const char* roundtripExclusions, | |
468 | IntlTest* logVal, UBool quickRt, | |
469 | Legal* adoptedLegal, | |
470 | int32_t density) | |
471 | { | |
472 | ||
473 | UErrorCode status = U_ZERO_ERROR; | |
474 | ||
475 | this->parent = logVal; | |
476 | this->legalSource = adoptedLegal; | |
477 | ||
478 | UnicodeSet neverOk("[:Other:]", status); | |
479 | UnicodeSet okAnyway("[^[:Letter:]]", status); | |
480 | ||
481 | if (U_FAILURE(status)) { | |
482 | parent->dataerrln("FAIL: Initializing UnicodeSet with [:Other:] or [^[:Letter:]] - Error: %s", u_errorName(status)); | |
483 | return; | |
484 | } | |
485 | ||
486 | this->sourceRange.clear(); | |
487 | this->sourceRange.applyPattern(sourceRangeVal, status); | |
488 | if (U_FAILURE(status)) { | |
489 | parent->errln("FAIL: UnicodeSet::applyPattern(" + | |
490 | sourceRangeVal + ")"); | |
491 | return; | |
492 | } | |
493 | this->sourceRange.removeAll(neverOk); | |
494 | ||
495 | this->targetRange.clear(); | |
496 | this->targetRange.applyPattern(targetRangeVal, status); | |
497 | if (U_FAILURE(status)) { | |
498 | parent->errln("FAIL: UnicodeSet::applyPattern(" + | |
499 | targetRangeVal + ")"); | |
500 | return; | |
501 | } | |
502 | this->targetRange.removeAll(neverOk); | |
503 | ||
504 | this->toSource.clear(); | |
505 | this->toSource.applyPattern(sourceRangeVal, status); | |
506 | if (U_FAILURE(status)) { | |
507 | parent->errln("FAIL: UnicodeSet::applyPattern(" + | |
508 | sourceRangeVal + ")"); | |
509 | return; | |
510 | } | |
511 | this->toSource.addAll(okAnyway); | |
512 | ||
513 | this->toTarget.clear(); | |
514 | this->toTarget.applyPattern(targetRangeVal, status); | |
515 | if (U_FAILURE(status)) { | |
516 | parent->errln("FAIL: UnicodeSet::applyPattern(" + | |
517 | targetRangeVal + ")"); | |
518 | return; | |
519 | } | |
520 | this->toTarget.addAll(okAnyway); | |
521 | ||
522 | this->roundtripExclusionsSet.clear(); | |
523 | if (roundtripExclusions != NULL && strlen(roundtripExclusions) > 0) { | |
524 | this->roundtripExclusionsSet.applyPattern(UnicodeString(roundtripExclusions, -1, US_INV), status); | |
525 | if (U_FAILURE(status)) { | |
526 | parent->errln("FAIL: UnicodeSet::applyPattern(%s)", roundtripExclusions); | |
527 | return; | |
528 | } | |
529 | } | |
530 | ||
531 | badCharacters.clear(); | |
532 | badCharacters.applyPattern("[:Other:]", status); | |
533 | if (U_FAILURE(status)) { | |
534 | parent->errln("FAIL: UnicodeSet::applyPattern([:Other:])"); | |
535 | return; | |
536 | } | |
537 | ||
538 | test2(quickRt, density); | |
539 | ||
540 | if (errorCount > 0) { | |
541 | char str[100]; | |
542 | int32_t length = transliteratorID.extract(str, 100, NULL, status); | |
543 | str[length] = 0; | |
544 | parent->errln("FAIL: %s errors: %d %s", str, errorCount, (errorCount > errorLimit ? " (at least!)" : " ")); // + ", see " + logFileName); | |
545 | } else { | |
546 | char str[100]; | |
547 | int32_t length = transliteratorID.extract(str, 100, NULL, status); | |
548 | str[length] = 0; | |
549 | parent->logln("%s ok", str); | |
550 | } | |
551 | } | |
552 | ||
553 | UBool RTTest::checkIrrelevants(Transliterator *t, | |
554 | const UnicodeString& irrelevants) { | |
555 | for (int i = 0; i < irrelevants.length(); ++i) { | |
556 | UChar c = irrelevants.charAt(i); | |
557 | UnicodeString srcStr(c); | |
558 | UnicodeString targ = srcStr; | |
559 | t->transliterate(targ); | |
560 | if (srcStr == targ) return TRUE; | |
561 | } | |
562 | return FALSE; | |
563 | } | |
564 | ||
565 | void RTTest::test2(UBool quickRt, int32_t density) { | |
566 | ||
567 | UnicodeString srcStr, targ, reverse; | |
568 | UErrorCode status = U_ZERO_ERROR; | |
569 | UParseError parseError ; | |
570 | TransliteratorPointer sourceToTarget( | |
571 | Transliterator::createInstance(transliteratorID, UTRANS_FORWARD, parseError, | |
572 | status)); | |
573 | if ((Transliterator *)sourceToTarget == NULL) { | |
574 | parent->dataerrln("FAIL: createInstance(" + transliteratorID + | |
575 | ") returned NULL. Error: " + u_errorName(status) | |
576 | + "\n\tpreContext : " + prettify(parseError.preContext) | |
577 | + "\n\tpostContext : " + prettify(parseError.postContext)); | |
578 | ||
579 | return; | |
580 | } | |
581 | TransliteratorPointer targetToSource(sourceToTarget->createInverse(status)); | |
582 | if ((Transliterator *)targetToSource == NULL) { | |
583 | parent->errln("FAIL: " + transliteratorID + | |
584 | ".createInverse() returned NULL. Error:" + u_errorName(status) | |
585 | + "\n\tpreContext : " + prettify(parseError.preContext) | |
586 | + "\n\tpostContext : " + prettify(parseError.postContext)); | |
587 | return; | |
588 | } | |
589 | ||
590 | AbbreviatedUnicodeSetIterator usi; | |
591 | AbbreviatedUnicodeSetIterator usi2; | |
592 | ||
593 | parent->logln("Checking that at least one irrelevant character is not NFC'ed"); | |
594 | // string is from NFC_NO in the UCD | |
595 | UnicodeString irrelevants = CharsToUnicodeString("\\u2000\\u2001\\u2126\\u212A\\u212B\\u2329"); | |
596 | ||
597 | if (checkIrrelevants(sourceToTarget, irrelevants) == FALSE) { | |
598 | logFails("Source-Target, irrelevants"); | |
599 | } | |
600 | if (checkIrrelevants(targetToSource, irrelevants) == FALSE) { | |
601 | logFails("Target-Source, irrelevants"); | |
602 | } | |
603 | ||
604 | if (!quickRt){ | |
605 | parent->logln("Checking that toRules works"); | |
606 | UnicodeString rules = ""; | |
607 | ||
608 | UParseError parseError; | |
609 | rules = sourceToTarget->toRules(rules, TRUE); | |
610 | // parent->logln((UnicodeString)"toRules => " + rules); | |
611 | TransliteratorPointer sourceToTarget2(Transliterator::createFromRules( | |
612 | "s2t2", rules, | |
613 | UTRANS_FORWARD, | |
614 | parseError, status)); | |
615 | if (U_FAILURE(status)) { | |
616 | parent->errln("FAIL: createFromRules %s\n", u_errorName(status)); | |
617 | return; | |
618 | } | |
619 | ||
620 | rules = targetToSource->toRules(rules, FALSE); | |
621 | TransliteratorPointer targetToSource2(Transliterator::createFromRules( | |
622 | "t2s2", rules, | |
623 | UTRANS_FORWARD, | |
624 | parseError, status)); | |
625 | if (U_FAILURE(status)) { | |
626 | parent->errln("FAIL: createFromRules %s\n", u_errorName(status)); | |
627 | return; | |
628 | } | |
629 | ||
630 | usi.reset(sourceRange); | |
631 | for (;;) { | |
632 | if (!usi.next() || usi.isString()) break; | |
633 | UChar32 c = usi.getCodepoint(); | |
634 | ||
635 | UnicodeString srcStr((UChar32)c); | |
636 | UnicodeString targ = srcStr; | |
637 | sourceToTarget->transliterate(targ); | |
638 | UnicodeString targ2 = srcStr; | |
639 | sourceToTarget2->transliterate(targ2); | |
640 | if (targ != targ2) { | |
641 | logToRulesFails("Source-Target, toRules", srcStr, targ, targ2); | |
642 | } | |
643 | } | |
644 | ||
645 | usi.reset(targetRange); | |
646 | for (;;) { | |
647 | if (!usi.next() || usi.isString()) break; | |
648 | UChar32 c = usi.getCodepoint(); | |
649 | ||
650 | UnicodeString srcStr((UChar32)c); | |
651 | UnicodeString targ = srcStr; | |
652 | targetToSource->transliterate(targ); | |
653 | UnicodeString targ2 = srcStr; | |
654 | targetToSource2->transliterate(targ2); | |
655 | if (targ != targ2) { | |
656 | logToRulesFails("Target-Source, toRules", srcStr, targ, targ2); | |
657 | } | |
658 | } | |
659 | } | |
660 | ||
661 | parent->logln("Checking that all source characters convert to target - Singles"); | |
662 | ||
663 | UnicodeSet failSourceTarg; | |
664 | usi.reset(sourceRange); | |
665 | for (;;) { | |
666 | if (!usi.next() || usi.isString()) break; | |
667 | UChar32 c = usi.getCodepoint(); | |
668 | ||
669 | UnicodeString srcStr((UChar32)c); | |
670 | UnicodeString targ = srcStr; | |
671 | sourceToTarget->transliterate(targ); | |
672 | if (toTarget.containsAll(targ) == FALSE | |
673 | || badCharacters.containsSome(targ) == TRUE) { | |
674 | UnicodeString targD; | |
675 | Normalizer::decompose(targ, FALSE, 0, targD, status); | |
676 | if (U_FAILURE(status)) { | |
677 | parent->errln("FAIL: Internal error during decomposition %s\n", u_errorName(status)); | |
678 | return; | |
679 | } | |
680 | if (toTarget.containsAll(targD) == FALSE || | |
681 | badCharacters.containsSome(targD) == TRUE) { | |
682 | logWrongScript("Source-Target", srcStr, targ); | |
683 | failSourceTarg.add(c); | |
684 | continue; | |
685 | } | |
686 | } | |
687 | ||
688 | UnicodeString cs2; | |
689 | Normalizer::decompose(srcStr, FALSE, 0, cs2, status); | |
690 | if (U_FAILURE(status)) { | |
691 | parent->errln("FAIL: Internal error during decomposition %s\n", u_errorName(status)); | |
692 | return; | |
693 | } | |
694 | UnicodeString targ2 = cs2; | |
695 | sourceToTarget->transliterate(targ2); | |
696 | if (targ != targ2) { | |
697 | logNotCanonical("Source-Target", srcStr, targ,cs2, targ2); | |
698 | } | |
699 | } | |
700 | ||
701 | parent->logln("Checking that all source characters convert to target - Doubles"); | |
702 | ||
703 | UnicodeSet sourceRangeMinusFailures(sourceRange); | |
704 | sourceRangeMinusFailures.removeAll(failSourceTarg); | |
705 | ||
706 | usi.reset(sourceRangeMinusFailures, quickRt, density); | |
707 | for (;;) { | |
708 | if (!usi.next() || usi.isString()) break; | |
709 | UChar32 c = usi.getCodepoint(); | |
710 | ||
711 | usi2.reset(sourceRangeMinusFailures, quickRt, density); | |
712 | for (;;) { | |
713 | if (!usi2.next() || usi2.isString()) break; | |
714 | UChar32 d = usi2.getCodepoint(); | |
715 | ||
716 | UnicodeString srcStr; | |
717 | srcStr += (UChar32)c; | |
718 | srcStr += (UChar32)d; | |
719 | UnicodeString targ = srcStr; | |
720 | sourceToTarget->transliterate(targ); | |
721 | if (toTarget.containsAll(targ) == FALSE || | |
722 | badCharacters.containsSome(targ) == TRUE) | |
723 | { | |
724 | UnicodeString targD; | |
725 | Normalizer::decompose(targ, FALSE, 0, targD, status); | |
726 | if (U_FAILURE(status)) { | |
727 | parent->errln("FAIL: Internal error during decomposition %s\n", u_errorName(status)); | |
728 | return; | |
729 | } | |
730 | if (toTarget.containsAll(targD) == FALSE || | |
731 | badCharacters.containsSome(targD) == TRUE) { | |
732 | logWrongScript("Source-Target", srcStr, targ); | |
733 | continue; | |
734 | } | |
735 | } | |
736 | UnicodeString cs2; | |
737 | Normalizer::decompose(srcStr, FALSE, 0, cs2, status); | |
738 | if (U_FAILURE(status)) { | |
739 | parent->errln("FAIL: Internal error during decomposition %s\n", u_errorName(status)); | |
740 | return; | |
741 | } | |
742 | UnicodeString targ2 = cs2; | |
743 | sourceToTarget->transliterate(targ2); | |
744 | if (targ != targ2) { | |
745 | logNotCanonical("Source-Target", srcStr, targ, cs2,targ2); | |
746 | } | |
747 | } | |
748 | } | |
749 | ||
750 | parent->logln("Checking that target characters convert to source and back - Singles"); | |
751 | ||
752 | UnicodeSet failTargSource; | |
753 | UnicodeSet failRound; | |
754 | ||
755 | usi.reset(targetRange); | |
756 | for (;;) { | |
757 | if (!usi.next()) break; | |
758 | ||
759 | if(usi.isString()){ | |
760 | srcStr = usi.getString(); | |
761 | }else{ | |
762 | srcStr = (UnicodeString)usi.getCodepoint(); | |
763 | } | |
764 | ||
765 | UChar32 c = srcStr.char32At(0); | |
766 | ||
767 | targ = srcStr; | |
768 | targetToSource->transliterate(targ); | |
769 | reverse = targ; | |
770 | sourceToTarget->transliterate(reverse); | |
771 | ||
772 | if (toSource.containsAll(targ) == FALSE || | |
773 | badCharacters.containsSome(targ) == TRUE) { | |
774 | UnicodeString targD; | |
775 | Normalizer::decompose(targ, FALSE, 0, targD, status); | |
776 | if (U_FAILURE(status)) { | |
777 | parent->errln("FAIL: Internal error during decomposition%s\n", u_errorName(status)); | |
778 | return; | |
779 | } | |
780 | if (toSource.containsAll(targD) == FALSE) { | |
781 | logWrongScript("Target-Source", srcStr, targ); | |
782 | failTargSource.add(c); | |
783 | continue; | |
784 | } | |
785 | if (badCharacters.containsSome(targD) == TRUE) { | |
786 | logWrongScript("Target-Source*", srcStr, targ); | |
787 | failTargSource.add(c); | |
788 | continue; | |
789 | } | |
790 | } | |
791 | if (isSame(srcStr, reverse) == FALSE && | |
792 | roundtripExclusionsSet.contains(c) == FALSE | |
793 | && roundtripExclusionsSet.contains(srcStr)==FALSE) { | |
794 | logRoundTripFailure(srcStr,targetToSource->getID(), targ,sourceToTarget->getID(), reverse); | |
795 | failRound.add(c); | |
796 | continue; | |
797 | } | |
798 | ||
799 | UnicodeString targ2; | |
800 | Normalizer::decompose(targ, FALSE, 0, targ2, status); | |
801 | if (U_FAILURE(status)) { | |
802 | parent->errln("FAIL: Internal error during decomposition%s\n", u_errorName(status)); | |
803 | return; | |
804 | } | |
805 | UnicodeString reverse2 = targ2; | |
806 | sourceToTarget->transliterate(reverse2); | |
807 | if (reverse != reverse2) { | |
808 | logNotCanonical("Target-Source", targ, reverse, targ2, reverse2); | |
809 | } | |
810 | } | |
811 | ||
812 | parent->logln("Checking that target characters convert to source and back - Doubles"); | |
813 | int32_t count = 0; | |
814 | ||
815 | UnicodeSet targetRangeMinusFailures(targetRange); | |
816 | targetRangeMinusFailures.removeAll(failTargSource); | |
817 | targetRangeMinusFailures.removeAll(failRound); | |
818 | ||
819 | usi.reset(targetRangeMinusFailures, quickRt, density); | |
820 | UnicodeString targ2; | |
821 | UnicodeString reverse2; | |
822 | UnicodeString targD; | |
823 | for (;;) { | |
824 | if (!usi.next() || usi.isString()) break; | |
825 | UChar32 c = usi.getCodepoint(); | |
826 | if (++count > pairLimit) { | |
827 | //throw new TestTruncated("Test truncated at " + pairLimit + " x 64k pairs"); | |
828 | parent->logln(""); | |
829 | parent->logln((UnicodeString)"Test truncated at " + pairLimit + " x 64k pairs"); | |
830 | return; | |
831 | } | |
832 | ||
833 | usi2.reset(targetRangeMinusFailures, quickRt, density); | |
834 | for (;;) { | |
835 | if (!usi2.next() || usi2.isString()) | |
836 | break; | |
837 | UChar32 d = usi2.getCodepoint(); | |
838 | srcStr.truncate(0); // empty the variable without construction/destruction | |
839 | srcStr += c; | |
840 | srcStr += d; | |
841 | ||
842 | targ = srcStr; | |
843 | targetToSource->transliterate(targ); | |
844 | reverse = targ; | |
845 | sourceToTarget->transliterate(reverse); | |
846 | ||
847 | if (toSource.containsAll(targ) == FALSE || | |
848 | badCharacters.containsSome(targ) == TRUE) | |
849 | { | |
850 | targD.truncate(0); // empty the variable without construction/destruction | |
851 | Normalizer::decompose(targ, FALSE, 0, targD, status); | |
852 | if (U_FAILURE(status)) { | |
853 | parent->errln("FAIL: Internal error during decomposition%s\n", | |
854 | u_errorName(status)); | |
855 | return; | |
856 | } | |
857 | if (toSource.containsAll(targD) == FALSE | |
858 | || badCharacters.containsSome(targD) == TRUE) | |
859 | { | |
860 | logWrongScript("Target-Source", srcStr, targ); | |
861 | continue; | |
862 | } | |
863 | } | |
864 | if (isSame(srcStr, reverse) == FALSE && | |
865 | roundtripExclusionsSet.contains(c) == FALSE&& | |
866 | roundtripExclusionsSet.contains(d) == FALSE && | |
867 | roundtripExclusionsSet.contains(srcStr)== FALSE) | |
868 | { | |
869 | logRoundTripFailure(srcStr,targetToSource->getID(), targ, sourceToTarget->getID(),reverse); | |
870 | continue; | |
871 | } | |
872 | ||
873 | targ2.truncate(0); // empty the variable without construction/destruction | |
874 | Normalizer::decompose(targ, FALSE, 0, targ2, status); | |
875 | if (U_FAILURE(status)) { | |
876 | parent->errln("FAIL: Internal error during decomposition%s\n", u_errorName(status)); | |
877 | return; | |
878 | } | |
879 | reverse2 = targ2; | |
880 | sourceToTarget->transliterate(reverse2); | |
881 | if (reverse != reverse2) { | |
882 | logNotCanonical("Target-Source", targ,reverse, targ2, reverse2); | |
883 | } | |
884 | } | |
885 | } | |
886 | parent->logln(""); | |
887 | } | |
888 | ||
889 | void RTTest::logWrongScript(const UnicodeString& label, | |
890 | const UnicodeString& from, | |
891 | const UnicodeString& to) { | |
892 | parent->errln((UnicodeString)"FAIL " + | |
893 | label + ": " + | |
894 | from + "(" + TestUtility::hex(from) + ") => " + | |
895 | to + "(" + TestUtility::hex(to) + ")"); | |
896 | ++errorCount; | |
897 | } | |
898 | ||
899 | void RTTest::logNotCanonical(const UnicodeString& label, | |
900 | const UnicodeString& from, | |
901 | const UnicodeString& to, | |
902 | const UnicodeString& fromCan, | |
903 | const UnicodeString& toCan) { | |
904 | parent->errln((UnicodeString)"FAIL (can.equiv)" + | |
905 | label + ": " + | |
906 | from + "(" + TestUtility::hex(from) + ") => " + | |
907 | to + "(" + TestUtility::hex(to) + ")" + | |
908 | fromCan + "(" + TestUtility::hex(fromCan) + ") => " + | |
909 | toCan + " (" + | |
910 | TestUtility::hex(toCan) + ")" | |
911 | ); | |
912 | ++errorCount; | |
913 | } | |
914 | ||
915 | void RTTest::logFails(const UnicodeString& label) { | |
916 | parent->errln((UnicodeString)"<br>FAIL " + label); | |
917 | ++errorCount; | |
918 | } | |
919 | ||
920 | void RTTest::logToRulesFails(const UnicodeString& label, | |
921 | const UnicodeString& from, | |
922 | const UnicodeString& to, | |
923 | const UnicodeString& otherTo) | |
924 | { | |
925 | parent->errln((UnicodeString)"FAIL: " + | |
926 | label + ": " + | |
927 | from + "(" + TestUtility::hex(from) + ") => " + | |
928 | to + "(" + TestUtility::hex(to) + ")" + | |
929 | "!=" + | |
930 | otherTo + " (" + | |
931 | TestUtility::hex(otherTo) + ")" | |
932 | ); | |
933 | ++errorCount; | |
934 | } | |
935 | ||
936 | ||
937 | void RTTest::logRoundTripFailure(const UnicodeString& from, | |
938 | const UnicodeString& toID, | |
939 | const UnicodeString& to, | |
940 | const UnicodeString& backID, | |
941 | const UnicodeString& back) { | |
942 | if (legalSource->is(from) == FALSE) return; // skip illegals | |
943 | ||
944 | parent->errln((UnicodeString)"FAIL Roundtrip: " + | |
945 | from + "(" + TestUtility::hex(from) + ") => " + | |
946 | to + "(" + TestUtility::hex(to) + ") "+toID+" => " + | |
947 | back + "(" + TestUtility::hex(back) + ") "+backID+" => "); | |
948 | ++errorCount; | |
949 | } | |
950 | ||
951 | //-------------------------------------------------------------------- | |
952 | // Specific Tests | |
953 | //-------------------------------------------------------------------- | |
954 | ||
955 | /* | |
956 | Note: Unicode 3.2 added new Hiragana/Katakana characters: | |
957 | ||
958 | 3095..3096 ; 3.2 # [2] HIRAGANA LETTER SMALL KA..HIRAGANA LETTER SMALL KE | |
959 | 309F..30A0 ; 3.2 # [2] HIRAGANA DIGRAPH YORI..KATAKANA-HIRAGANA DOUBLE HYPHEN | |
960 | 30FF ; 3.2 # KATAKANA DIGRAPH KOTO | |
961 | 31F0..31FF ; 3.2 # [16] KATAKANA LETTER SMALL KU..KATAKANA LETTER SMALL RO | |
962 | ||
963 | Unicode 5.2 added another Hiragana character: | |
964 | 1F200 ; 5.2 # SQUARE HIRAGANA HOKA | |
965 | ||
966 | We will not add them to the rules until they are more supported (e.g. in fonts on Windows) | |
967 | A bug has been filed to remind us to do this: #1979. | |
968 | */ | |
969 | ||
970 | static const char KATAKANA[] = "[[[:katakana:][\\u30A1-\\u30FA\\u30FC]]-[\\u30FF\\u31F0-\\u31FF]-[:^age=5.2:]]"; | |
971 | static const char HIRAGANA[] = "[[[:hiragana:][\\u3040-\\u3094]]-[\\u3095-\\u3096\\u309F-\\u30A0\\U0001F200-\\U0001F2FF]-[:^age=5.2:]]"; | |
972 | static const char LENGTH[] = "[\\u30FC]"; | |
973 | static const char HALFWIDTH_KATAKANA[] = "[\\uFF65-\\uFF9D]"; | |
974 | static const char KATAKANA_ITERATION[] = "[\\u30FD\\u30FE]"; | |
975 | static const char HIRAGANA_ITERATION[] = "[\\u309D\\u309E]"; | |
976 | static const int32_t TEMP_MAX=256; | |
977 | ||
978 | void TransliteratorRoundTripTest::TestKana() { | |
979 | RTTest test("Katakana-Hiragana"); | |
980 | Legal *legal = new Legal(); | |
981 | char temp[TEMP_MAX]; | |
982 | strcpy(temp, "["); | |
983 | strcat(temp, HALFWIDTH_KATAKANA); | |
984 | strcat(temp, LENGTH); | |
985 | strcat(temp, "]"); | |
986 | test.test(KATAKANA, UnicodeString("[") + HIRAGANA + LENGTH + UnicodeString("]"), | |
987 | temp, | |
988 | this, quick, legal); | |
989 | delete legal; | |
990 | } | |
991 | ||
992 | void TransliteratorRoundTripTest::TestHiragana() { | |
993 | RTTest test("Latin-Hiragana"); | |
994 | Legal *legal = new Legal(); | |
995 | test.test(UnicodeString("[a-zA-Z]", ""), | |
996 | UnicodeString(HIRAGANA, -1, US_INV), | |
997 | HIRAGANA_ITERATION, this, quick, legal); | |
998 | delete legal; | |
999 | } | |
1000 | ||
1001 | void TransliteratorRoundTripTest::TestKatakana() { | |
1002 | RTTest test("Latin-Katakana"); | |
1003 | Legal *legal = new Legal(); | |
1004 | char temp[TEMP_MAX]; | |
1005 | strcpy(temp, "["); | |
1006 | strcat(temp, KATAKANA_ITERATION); | |
1007 | strcat(temp, HALFWIDTH_KATAKANA); | |
1008 | strcat(temp, "]"); | |
1009 | test.test(UnicodeString("[a-zA-Z]", ""), | |
1010 | UnicodeString(KATAKANA, -1, US_INV), | |
1011 | temp, | |
1012 | this, quick, legal); | |
1013 | delete legal; | |
1014 | } | |
1015 | ||
1016 | void TransliteratorRoundTripTest::TestJamo() { | |
1017 | RTTest t("Latin-Jamo"); | |
1018 | Legal *legal = new LegalJamo(); | |
1019 | t.test(UnicodeString("[a-zA-Z]", ""), | |
1020 | UnicodeString("[\\u1100-\\u1112 \\u1161-\\u1175 \\u11A8-\\u11C2]", | |
1021 | ""), | |
1022 | NULL, this, quick, legal); | |
1023 | delete legal; | |
1024 | } | |
1025 | ||
1026 | void TransliteratorRoundTripTest::TestHangul() { | |
1027 | RTTest t("Latin-Hangul"); | |
1028 | Legal *legal = new Legal(); | |
1029 | if (quick) t.setPairLimit(1000); | |
1030 | t.test(UnicodeString("[a-zA-Z]", ""), | |
1031 | UnicodeString("[\\uAC00-\\uD7A4]", ""), | |
1032 | NULL, this, quick, legal, 1); | |
1033 | delete legal; | |
1034 | } | |
1035 | ||
1036 | ||
1037 | #define ASSERT_SUCCESS(status) {if (U_FAILURE(status)) { \ | |
1038 | errcheckln(status, "error at file %s, line %d, status = %s", __FILE__, __LINE__, \ | |
1039 | u_errorName(status)); \ | |
1040 | return;}} | |
1041 | ||
1042 | ||
1043 | static void writeStringInU8(FILE *out, const UnicodeString &s) { | |
1044 | int i; | |
1045 | for (i=0; i<s.length(); i=s.moveIndex32(i, 1)) { | |
1046 | UChar32 c = s.char32At(i); | |
1047 | uint8_t bufForOneChar[10]; | |
1048 | UBool isError = FALSE; | |
1049 | int32_t destIdx = 0; | |
1050 | U8_APPEND(bufForOneChar, destIdx, (int32_t)sizeof(bufForOneChar), c, isError); | |
1051 | U_ASSERT(!isError); | |
1052 | fwrite(bufForOneChar, 1, destIdx, out); | |
1053 | } | |
1054 | } | |
1055 | ||
1056 | ||
1057 | ||
1058 | ||
1059 | void TransliteratorRoundTripTest::TestHan() { | |
1060 | UErrorCode status = U_ZERO_ERROR; | |
1061 | LocalULocaleDataPointer uld(ulocdata_open("zh",&status)); | |
1062 | LocalUSetPointer USetExemplars(ulocdata_getExemplarSet(uld.getAlias(), uset_openEmpty(), 0, ULOCDATA_ES_STANDARD, &status)); | |
1063 | ASSERT_SUCCESS(status); | |
1064 | ||
1065 | UnicodeString source; | |
1066 | UChar32 c; | |
1067 | int i; | |
1068 | for (i=0; ;i++) { | |
1069 | // Add all of the Chinese exemplar chars to the string "source". | |
1070 | c = uset_charAt(USetExemplars.getAlias(), i); | |
1071 | if (c == (UChar32)-1) { | |
1072 | break; | |
1073 | } | |
1074 | source.append(c); | |
1075 | } | |
1076 | ||
1077 | // transform with Han translit | |
1078 | Transliterator *hanTL = Transliterator::createInstance("Han-Latin", UTRANS_FORWARD, status); | |
1079 | ASSERT_SUCCESS(status); | |
1080 | UnicodeString target=source; | |
1081 | hanTL->transliterate(target); | |
1082 | // now verify that there are no Han characters left | |
1083 | UnicodeSet allHan("[:han:]", status); | |
1084 | ASSERT_SUCCESS(status); | |
1085 | if (allHan.containsSome(target)) { | |
1086 | errln("file %s, line %d, No Han must be left after Han-Latin transliteration", | |
1087 | __FILE__, __LINE__); | |
1088 | } | |
1089 | ||
1090 | // check the pinyin translit | |
1091 | Transliterator *pn = Transliterator::createInstance("Latin-NumericPinyin", UTRANS_FORWARD, status); | |
1092 | ASSERT_SUCCESS(status); | |
1093 | UnicodeString target2 = target; | |
1094 | pn->transliterate(target2); | |
1095 | ||
1096 | // verify that there are no marks | |
1097 | Transliterator *nfd = Transliterator::createInstance("nfd", UTRANS_FORWARD, status); | |
1098 | ASSERT_SUCCESS(status); | |
1099 | ||
1100 | UnicodeString nfded = target2; | |
1101 | nfd->transliterate(nfded); | |
1102 | UnicodeSet allMarks(UNICODE_STRING_SIMPLE("[\\u0304\\u0301\\u030C\\u0300\\u0306]"), status); // look only for Pinyin tone marks, not all marks (there are some others in there) | |
1103 | ASSERT_SUCCESS(status); | |
1104 | assertFalse("NumericPinyin must contain no marks", allMarks.containsSome(nfded)); | |
1105 | ||
1106 | // verify roundtrip | |
1107 | Transliterator *np = pn->createInverse(status); | |
1108 | ASSERT_SUCCESS(status); | |
1109 | UnicodeString target3 = target2; | |
1110 | np->transliterate(target3); | |
1111 | UBool roundtripOK = (target3.compare(target) == 0); | |
1112 | assertTrue("NumericPinyin must roundtrip", roundtripOK); | |
1113 | if (!roundtripOK) { | |
1114 | const char *filename = "numeric-pinyin.log.txt"; | |
1115 | FILE *out = fopen(filename, "w"); | |
1116 | errln("Creating log file %s\n", filename); | |
1117 | fprintf(out, "Pinyin: "); | |
1118 | writeStringInU8(out, target); | |
1119 | fprintf(out, "\nPinyin-Numeric-Pinyin: "); | |
1120 | writeStringInU8(out, target2); | |
1121 | fprintf(out, "\nNumeric-Pinyin-Pinyin: "); | |
1122 | writeStringInU8(out, target3); | |
1123 | fprintf(out, "\n"); | |
1124 | fclose(out); | |
1125 | } | |
1126 | ||
1127 | delete hanTL; | |
1128 | delete pn; | |
1129 | delete nfd; | |
1130 | delete np; | |
1131 | } | |
1132 | ||
1133 | ||
1134 | void TransliteratorRoundTripTest::TestGreek() { | |
1135 | logKnownIssue( "cldrbug:1911"); | |
1136 | // It is left in its current state as a regression test. | |
1137 | ||
1138 | RTTest test("Latin-Greek"); | |
1139 | LegalGreek *legal = new LegalGreek(TRUE); | |
1140 | ||
1141 | test.test(UnicodeString("[a-zA-Z]", ""), | |
1142 | UnicodeString("[\\u003B\\u00B7[[:Greek:]&[:Letter:]]-[" | |
1143 | "\\u1D26-\\u1D2A" // L& [5] GREEK LETTER SMALL CAPITAL GAMMA..GREEK LETTER SMALL CAPITAL PSI | |
1144 | "\\u1D5D-\\u1D61" // Lm [5] MODIFIER LETTER SMALL BETA..MODIFIER LETTER SMALL CHI | |
1145 | "\\u1D66-\\u1D6A" // L& [5] GREEK SUBSCRIPT SMALL LETTER BETA..GREEK SUBSCRIPT SMALL LETTER CHI | |
1146 | "\\u03D7-\\u03EF" // \N{GREEK KAI SYMBOL}..\N{COPTIC SMALL LETTER DEI} | |
1147 | "] & [:Age=4.0:]]", | |
1148 | ||
1149 | //UnicodeString("[[\\u003B\\u00B7[:Greek:]-[\\u0374\\u0385\\u1fcd\\u1fce\\u1fdd\\u1fde\\u1fed-\\u1fef\\u1ffd\\u03D7-\\u03EF]]&[:Age=3.2:]]", | |
1150 | ""), | |
1151 | "[\\u00B5\\u037A\\u03D0-\\u03F5\\u03f9]", /* exclusions */ | |
1152 | this, quick, legal, 50); | |
1153 | ||
1154 | ||
1155 | delete legal; | |
1156 | } | |
1157 | ||
1158 | ||
1159 | void TransliteratorRoundTripTest::TestGreekUNGEGN() { | |
1160 | logKnownIssue( "cldrbug:1911"); | |
1161 | // It is left in its current state as a regression test. | |
1162 | ||
1163 | RTTest test("Latin-Greek/UNGEGN"); | |
1164 | LegalGreek *legal = new LegalGreek(FALSE); | |
1165 | ||
1166 | test.test(UnicodeString("[a-zA-Z]", ""), | |
1167 | UnicodeString("[\\u003B\\u00B7[[:Greek:]&[:Letter:]]-[" | |
1168 | "\\u1D26-\\u1D2A" // L& [5] GREEK LETTER SMALL CAPITAL GAMMA..GREEK LETTER SMALL CAPITAL PSI | |
1169 | "\\u1D5D-\\u1D61" // Lm [5] MODIFIER LETTER SMALL BETA..MODIFIER LETTER SMALL CHI | |
1170 | "\\u1D66-\\u1D6A" // L& [5] GREEK SUBSCRIPT SMALL LETTER BETA..GREEK SUBSCRIPT SMALL LETTER CHI | |
1171 | "\\u03D7-\\u03EF" // \N{GREEK KAI SYMBOL}..\N{COPTIC SMALL LETTER DEI} | |
1172 | "] & [:Age=4.0:]]", | |
1173 | //UnicodeString("[[\\u003B\\u00B7[:Greek:]-[\\u0374\\u0385\\u1fce\\u1fde\\u03D7-\\u03EF]]&[:Age=3.2:]]", | |
1174 | ""), | |
1175 | "[\\u0385\\u00B5\\u037A\\u03D0-\\uFFFF {\\u039C\\u03C0}]", /* roundtrip exclusions */ | |
1176 | this, quick, legal); | |
1177 | ||
1178 | delete legal; | |
1179 | } | |
1180 | ||
1181 | void TransliteratorRoundTripTest::Testel() { | |
1182 | logKnownIssue( "cldrbug:1911"); | |
1183 | // It is left in its current state as a regression test. | |
1184 | ||
1185 | RTTest test("Latin-el"); | |
1186 | LegalGreek *legal = new LegalGreek(FALSE); | |
1187 | ||
1188 | test.test(UnicodeString("[a-zA-Z]", ""), | |
1189 | UnicodeString("[\\u003B\\u00B7[[:Greek:]&[:Letter:]]-[" | |
1190 | "\\u1D26-\\u1D2A" // L& [5] GREEK LETTER SMALL CAPITAL GAMMA..GREEK LETTER SMALL CAPITAL PSI | |
1191 | "\\u1D5D-\\u1D61" // Lm [5] MODIFIER LETTER SMALL BETA..MODIFIER LETTER SMALL CHI | |
1192 | "\\u1D66-\\u1D6A" // L& [5] GREEK SUBSCRIPT SMALL LETTER BETA..GREEK SUBSCRIPT SMALL LETTER CHI | |
1193 | "\\u03D7-\\u03EF" // \N{GREEK KAI SYMBOL}..\N{COPTIC SMALL LETTER DEI} | |
1194 | "] & [:Age=4.0:]]", | |
1195 | //UnicodeString("[[\\u003B\\u00B7[:Greek:]-[\\u0374\\u0385\\u1fce\\u1fde\\u03D7-\\u03EF]]&[:Age=3.2:]]", | |
1196 | ""), | |
1197 | "[\\u00B5\\u037A\\u03D0-\\uFFFF {\\u039C\\u03C0}]", /* exclusions */ | |
1198 | this, quick, legal); | |
1199 | ||
1200 | ||
1201 | delete legal; | |
1202 | } | |
1203 | ||
1204 | ||
1205 | void TransliteratorRoundTripTest::TestArabic() { | |
1206 | UnicodeString ARABIC("[\\u060C\\u061B\\u061F\\u0621\\u0627-\\u063A\\u0641-\\u0655\\u0660-\\u066C\\u067E\\u0686\\u0698\\u06A4\\u06AD\\u06AF\\u06CB-\\u06CC\\u06F0-\\u06F9]", -1, US_INV); | |
1207 | Legal *legal = new Legal(); | |
1208 | RTTest test("Latin-Arabic"); | |
1209 | test.test(UNICODE_STRING_SIMPLE("[a-zA-Z\\u02BE\\u02BF\\u207F]"), ARABIC, "[a-zA-Z\\u02BE\\u02BF\\u207F]",this, quick, legal); // | |
1210 | delete legal; | |
1211 | } | |
1212 | class LegalHebrew : public Legal { | |
1213 | private: | |
1214 | UnicodeSet FINAL; | |
1215 | UnicodeSet NON_FINAL; | |
1216 | UnicodeSet LETTER; | |
1217 | public: | |
1218 | LegalHebrew(UErrorCode& error); | |
1219 | virtual ~LegalHebrew() {} | |
1220 | virtual UBool is(const UnicodeString& sourceString) const; | |
1221 | }; | |
1222 | ||
1223 | LegalHebrew::LegalHebrew(UErrorCode& error){ | |
1224 | FINAL.applyPattern(UNICODE_STRING_SIMPLE("[\\u05DA\\u05DD\\u05DF\\u05E3\\u05E5]"), error); | |
1225 | NON_FINAL.applyPattern(UNICODE_STRING_SIMPLE("[\\u05DB\\u05DE\\u05E0\\u05E4\\u05E6]"), error); | |
1226 | LETTER.applyPattern("[:letter:]", error); | |
1227 | } | |
1228 | UBool LegalHebrew::is(const UnicodeString& sourceString)const{ | |
1229 | ||
1230 | if (sourceString.length() == 0) return TRUE; | |
1231 | // don't worry about surrogates. | |
1232 | for (int i = 0; i < sourceString.length(); ++i) { | |
1233 | UChar ch = sourceString.charAt(i); | |
1234 | UChar next = i+1 == sourceString.length() ? 0x0000 : sourceString.charAt(i); | |
1235 | if (FINAL.contains(ch)) { | |
1236 | if (LETTER.contains(next)) return FALSE; | |
1237 | } else if (NON_FINAL.contains(ch)) { | |
1238 | if (!LETTER.contains(next)) return FALSE; | |
1239 | } | |
1240 | } | |
1241 | return TRUE; | |
1242 | } | |
1243 | void TransliteratorRoundTripTest::TestHebrew() { | |
1244 | logKnownIssue( "cldrbug:1911"); | |
1245 | // It is left in its current state as a regression test. | |
1246 | ||
1247 | //long start = System.currentTimeMillis(); | |
1248 | UErrorCode error = U_ZERO_ERROR; | |
1249 | LegalHebrew* legal = new LegalHebrew(error); | |
1250 | if(U_FAILURE(error)){ | |
1251 | dataerrln("Could not construct LegalHebrew object. Error: %s", u_errorName(error)); | |
1252 | return; | |
1253 | } | |
1254 | RTTest test("Latin-Hebrew"); | |
1255 | test.test(UNICODE_STRING_SIMPLE("[a-zA-Z\\u02BC\\u02BB]"), UNICODE_STRING_SIMPLE("[[[:hebrew:]-[\\u05BD\\uFB00-\\uFBFF]]&[:Age=4.0:]]"), "[\\u05F0\\u05F1\\u05F2]", this, quick, legal); | |
1256 | ||
1257 | //showElapsed(start, "TestHebrew"); | |
1258 | delete legal; | |
1259 | } | |
1260 | void TransliteratorRoundTripTest::TestCyrillic() { | |
1261 | RTTest test("Latin-Cyrillic"); | |
1262 | Legal *legal = new Legal(); | |
1263 | ||
1264 | test.test(UnicodeString("[a-zA-Z\\u0110\\u0111\\u02BA\\u02B9]", ""), | |
1265 | UnicodeString("[[\\u0400-\\u045F] & [:Age=3.2:]]", ""), NULL, this, quick, | |
1266 | legal); | |
1267 | ||
1268 | delete legal; | |
1269 | } | |
1270 | ||
1271 | ||
1272 | // Inter-Indic Tests ---------------------------------- | |
1273 | class LegalIndic :public Legal{ | |
1274 | UnicodeSet vowelSignSet; | |
1275 | UnicodeSet avagraha; | |
1276 | UnicodeSet nukta; | |
1277 | UnicodeSet virama; | |
1278 | UnicodeSet sanskritStressSigns; | |
1279 | UnicodeSet chandrabindu; | |
1280 | ||
1281 | public: | |
1282 | LegalIndic(); | |
1283 | virtual UBool is(const UnicodeString& sourceString) const; | |
1284 | virtual ~LegalIndic() {}; | |
1285 | }; | |
1286 | UBool LegalIndic::is(const UnicodeString& sourceString) const{ | |
1287 | int cp=sourceString.charAt(0); | |
1288 | ||
1289 | // A vowel sign cannot be the first char | |
1290 | if(vowelSignSet.contains(cp)){ | |
1291 | return FALSE; | |
1292 | }else if(avagraha.contains(cp)){ | |
1293 | return FALSE; | |
1294 | }else if(virama.contains(cp)){ | |
1295 | return FALSE; | |
1296 | }else if(nukta.contains(cp)){ | |
1297 | return FALSE; | |
1298 | }else if(sanskritStressSigns.contains(cp)){ | |
1299 | return FALSE; | |
1300 | }else if(chandrabindu.contains(cp) && | |
1301 | ((sourceString.length()>1) && | |
1302 | vowelSignSet.contains(sourceString.charAt(1)))){ | |
1303 | return FALSE; | |
1304 | } | |
1305 | return TRUE; | |
1306 | } | |
1307 | LegalIndic::LegalIndic(){ | |
1308 | UErrorCode status = U_ZERO_ERROR; | |
1309 | vowelSignSet.addAll( UnicodeSet("[\\u0902\\u0903\\u0904\\u093e-\\u094c\\u0962\\u0963]",status));/* Devanagari */ | |
1310 | vowelSignSet.addAll( UnicodeSet("[\\u0982\\u0983\\u09be-\\u09cc\\u09e2\\u09e3\\u09D7]",status));/* Bengali */ | |
1311 | vowelSignSet.addAll( UnicodeSet("[\\u0a02\\u0a03\\u0a3e-\\u0a4c\\u0a62\\u0a63\\u0a70\\u0a71]",status));/* Gurmukhi */ | |
1312 | vowelSignSet.addAll( UnicodeSet("[\\u0a82\\u0a83\\u0abe-\\u0acc\\u0ae2\\u0ae3]",status));/* Gujarati */ | |
1313 | vowelSignSet.addAll( UnicodeSet("[\\u0b02\\u0b03\\u0b3e-\\u0b4c\\u0b62\\u0b63\\u0b56\\u0b57]",status));/* Oriya */ | |
1314 | vowelSignSet.addAll( UnicodeSet("[\\u0b82\\u0b83\\u0bbe-\\u0bcc\\u0be2\\u0be3\\u0bd7]",status));/* Tamil */ | |
1315 | vowelSignSet.addAll( UnicodeSet("[\\u0c02\\u0c03\\u0c3e-\\u0c4c\\u0c62\\u0c63\\u0c55\\u0c56]",status));/* Telugu */ | |
1316 | vowelSignSet.addAll( UnicodeSet("[\\u0c82\\u0c83\\u0cbe-\\u0ccc\\u0ce2\\u0ce3\\u0cd5\\u0cd6]",status));/* Kannada */ | |
1317 | vowelSignSet.addAll( UnicodeSet("[\\u0d02\\u0d03\\u0d3e-\\u0d4c\\u0d62\\u0d63\\u0d57]",status));/* Malayalam */ | |
1318 | ||
1319 | avagraha.addAll(UnicodeSet("[\\u093d\\u09bd\\u0abd\\u0b3d\\u0cbd]",status)); | |
1320 | nukta.addAll(UnicodeSet("[\\u093c\\u09bc\\u0a3c\\u0abc\\u0b3c\\u0cbc]",status)); | |
1321 | virama.addAll(UnicodeSet("[\\u094d\\u09cd\\u0a4d\\u0acd\\u0b4d\\u0bcd\\u0c4d\\u0ccd\\u0d4d]",status)); | |
1322 | sanskritStressSigns.addAll(UnicodeSet("[\\u0951\\u0952\\u0953\\u0954\\u097d]",status)); | |
1323 | chandrabindu.addAll(UnicodeSet("[\\u0901\\u0981\\u0A81\\u0b01\\u0c01]",status)); | |
1324 | ||
1325 | } | |
1326 | ||
1327 | static const char latinForIndic[] = "[['.0-9A-Za-z~\\u00C0-\\u00C5\\u00C7-\\u00CF\\u00D1-\\u00D6\\u00D9-\\u00DD" | |
1328 | "\\u00E0-\\u00E5\\u00E7-\\u00EF\\u00F1-\\u00F6\\u00F9-\\u00FD\\u00FF-\\u010F" | |
1329 | "\\u0112-\\u0125\\u0128-\\u0130\\u0134-\\u0137\\u0139-\\u013E\\u0143-\\u0148" | |
1330 | "\\u014C-\\u0151\\u0154-\\u0165\\u0168-\\u017E\\u01A0-\\u01A1\\u01AF-\\u01B0" | |
1331 | "\\u01CD-\\u01DC\\u01DE-\\u01E3\\u01E6-\\u01ED\\u01F0\\u01F4-\\u01F5\\u01F8-\\u01FB" | |
1332 | "\\u0200-\\u021B\\u021E-\\u021F\\u0226-\\u0233\\u0294\\u0303-\\u0304\\u0306\\u0314-\\u0315" | |
1333 | "\\u0325\\u040E\\u0419\\u0439\\u045E\\u04C1-\\u04C2\\u04D0-\\u04D1\\u04D6-\\u04D7" | |
1334 | "\\u04E2-\\u04E3\\u04EE-\\u04EF\\u1E00-\\u1E99\\u1EA0-\\u1EF9\\u1F01\\u1F03\\u1F05" | |
1335 | "\\u1F07\\u1F09\\u1F0B\\u1F0D\\u1F0F\\u1F11\\u1F13\\u1F15\\u1F19\\u1F1B\\u1F1D\\u1F21" | |
1336 | "\\u1F23\\u1F25\\u1F27\\u1F29\\u1F2B\\u1F2D\\u1F2F\\u1F31\\u1F33\\u1F35\\u1F37\\u1F39" | |
1337 | "\\u1F3B\\u1F3D\\u1F3F\\u1F41\\u1F43\\u1F45\\u1F49\\u1F4B\\u1F4D\\u1F51\\u1F53\\u1F55" | |
1338 | "\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F\\u1F61\\u1F63\\u1F65\\u1F67\\u1F69\\u1F6B\\u1F6D" | |
1339 | "\\u1F6F\\u1F81\\u1F83\\u1F85\\u1F87\\u1F89\\u1F8B\\u1F8D\\u1F8F\\u1F91\\u1F93\\u1F95" | |
1340 | "\\u1F97\\u1F99\\u1F9B\\u1F9D\\u1F9F\\u1FA1\\u1FA3\\u1FA5\\u1FA7\\u1FA9\\u1FAB\\u1FAD" | |
1341 | "\\u1FAF-\\u1FB1\\u1FB8-\\u1FB9\\u1FD0-\\u1FD1\\u1FD8-\\u1FD9\\u1FE0-\\u1FE1\\u1FE5" | |
1342 | "\\u1FE8-\\u1FE9\\u1FEC\\u212A-\\u212B\\uE04D\\uE064]" | |
1343 | "-[\\uE000-\\uE080 \\u01E2\\u01E3]& [[:latin:][:mark:]]]"; | |
1344 | ||
1345 | void TransliteratorRoundTripTest::TestDevanagariLatin() { | |
1346 | { | |
1347 | UErrorCode status = U_ZERO_ERROR; | |
1348 | UParseError parseError; | |
1349 | TransliteratorPointer t1(Transliterator::createInstance("[\\u0964-\\u0965\\u0981-\\u0983\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC\\u09BE-\\u09C4\\u09C7-\\u09C8\\u09CB-\\u09CD\\u09D7\\u09DC-\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09FA];NFD;Bengali-InterIndic;InterIndic-Gujarati;NFC;",UTRANS_FORWARD, parseError, status)); | |
1350 | if((Transliterator *)t1 != NULL){ | |
1351 | TransliteratorPointer t2(t1->createInverse(status)); | |
1352 | if(U_FAILURE(status)){ | |
1353 | errln("FAIL: could not create the Inverse:-( \n"); | |
1354 | } | |
1355 | }else { | |
1356 | dataerrln("FAIL: could not create the transliterator. Error: %s\n", u_errorName(status)); | |
1357 | } | |
1358 | ||
1359 | } | |
1360 | RTTest test("Latin-Devanagari"); | |
1361 | Legal *legal = new LegalIndic(); | |
1362 | logKnownIssue( "cldrbug:1911"); | |
1363 | // It is left in its current state as a regression test. | |
1364 | ||
1365 | test.test(UnicodeString(latinForIndic, ""), | |
1366 | UnicodeString("[[[:Devanagari:][\\u094d][\\u0964\\u0965]]&[:Age=4.1:]-[\\u0970]]", ""), "[\\u0965\\u0904]", this, quick, | |
1367 | legal, 50); | |
1368 | ||
1369 | delete legal; | |
1370 | } | |
1371 | ||
1372 | /* Defined this way for HP/UX11CC :-( */ | |
1373 | static const int32_t INTER_INDIC_ARRAY_WIDTH = 4; | |
1374 | static const char * const interIndicArray[] = { | |
1375 | ||
1376 | "BENGALI-DEVANAGARI", "[:BENGALI:]", "[[:Devanagari:]-[\\u0970]]", | |
1377 | "[\\u0904\\u0951-\\u0954\\u0943-\\u0949\\u094a\\u0962\\u0963\\u090D\\u090e\\u0911\\u0912\\u0929\\u0933\\u0934\\u0935\\u093d\\u0950\\u0958\\u0959\\u095a\\u095b\\u095e\\u097d]", /*roundtrip exclusions*/ | |
1378 | ||
1379 | "DEVANAGARI-BENGALI", "[[:Devanagari:]-[\\u0970]]", "[:BENGALI:]", | |
1380 | "[\\u0951-\\u0954\\u0951-\\u0954\\u09D7\\u090D\\u090e\\u0911\\u0912\\u0929\\u0933\\u0934\\u0935\\u093d\\u0950\\u0958\\u0959\\u095a\\u095b\\u095e\\u09f0\\u09f1\\u09f2-\\u09fa\\u09ce]", /*roundtrip exclusions*/ | |
1381 | ||
1382 | "GURMUKHI-DEVANAGARI", "[:GURMUKHI:]", "[[:Devanagari:]-[\\u0970]]", | |
1383 | "[\\u0904\\u0901\\u0902\\u0936\\u0933\\u0951-\\u0954\\u0902\\u0903\\u0943-\\u0949\\u094a\\u0962\\u0963\\u090B\\u090C\\u090D\\u090e\\u0911\\u0912\\u0934\\u0937\\u093D\\u0950\\u0960\\u0961\\u097d]", /*roundtrip exclusions*/ | |
1384 | ||
1385 | "DEVANAGARI-GURMUKHI", "[[:Devanagari:]-[\\u0970]]", "[:GURMUKHI:]", | |
1386 | "[\\u0904\\u0A02\\u0946\\u0A5C\\u0951-\\u0954\\u0A70\\u0A71\\u090B\\u090C\\u090D\\u090e\\u0911\\u0912\\u0934\\u0937\\u093D\\u0950\\u0960\\u0961\\u0a72\\u0a73\\u0a74]", /*roundtrip exclusions*/ | |
1387 | ||
1388 | "GUJARATI-DEVANAGARI", "[:GUJARATI:]", "[[:Devanagari:]-[\\u0970]]", | |
1389 | "[\\u0946\\u094A\\u0962\\u0963\\u0951-\\u0954\\u0961\\u090c\\u090e\\u0912\\u097d]", /*roundtrip exclusions*/ | |
1390 | ||
1391 | "DEVANAGARI-GUJARATI", "[[:Devanagari:]-[\\u0970]]", "[:GUJARATI:]", | |
1392 | "[\\u0951-\\u0954\\u0961\\u090c\\u090e\\u0912]", /*roundtrip exclusions*/ | |
1393 | ||
1394 | "ORIYA-DEVANAGARI", "[:ORIYA:]", "[[:Devanagari:]-[\\u0970]]", | |
1395 | "[\\u0904\\u0943-\\u094a\\u0962\\u0963\\u0951-\\u0954\\u0950\\u090D\\u090e\\u0912\\u0911\\u0931\\u0935\\u097d]", /*roundtrip exclusions*/ | |
1396 | ||
1397 | "DEVANAGARI-ORIYA", "[[:Devanagari:]-[\\u0970]]", "[:ORIYA:]", | |
1398 | "[\\u0b5f\\u0b56\\u0b57\\u0b70\\u0b71\\u0950\\u090D\\u090e\\u0912\\u0911\\u0931]", /*roundtrip exclusions*/ | |
1399 | ||
1400 | "Tamil-DEVANAGARI", "[:tamil:]", "[[:Devanagari:]-[\\u0970]]", | |
1401 | "[\\u0901\\u0904\\u093c\\u0943-\\u094a\\u0951-\\u0954\\u0962\\u0963\\u090B\\u090C\\u090D\\u0911\\u0916\\u0917\\u0918\\u091B\\u091D\\u0920\\u0921\\u0922\\u0925\\u0926\\u0927\\u092B\\u092C\\u092D\\u0936\\u093d\\u0950[\\u0958-\\u0961]\\u097d]", /*roundtrip exclusions*/ | |
1402 | ||
1403 | "DEVANAGARI-Tamil", "[[:Devanagari:]-[\\u0970]]", "[:tamil:]", | |
1404 | "[\\u0bd7\\u0BF0\\u0BF1\\u0BF2]", /*roundtrip exclusions*/ | |
1405 | ||
1406 | "Telugu-DEVANAGARI", "[:telugu:]", "[[:Devanagari:]-[\\u0970]]", | |
1407 | "[\\u0904\\u093c\\u0950\\u0945\\u0949\\u0951-\\u0954\\u0962\\u0963\\u090D\\u0911\\u093d\\u0929\\u0934[\\u0958-\\u095f]\\u097d]", /*roundtrip exclusions*/ | |
1408 | ||
1409 | "DEVANAGARI-TELUGU", "[[:Devanagari:]-[\\u0970]]", "[:TELUGU:]", | |
1410 | "[\\u0c55\\u0c56\\u0950\\u090D\\u0911\\u093d\\u0929\\u0934[\\u0958-\\u095f]]", /*roundtrip exclusions*/ | |
1411 | ||
1412 | "KANNADA-DEVANAGARI", "[:KANNADA:]", "[[:Devanagari:]-[\\u0970]]", | |
1413 | "[\\u0901\\u0904\\u0946\\u093c\\u0950\\u0945\\u0949\\u0951-\\u0954\\u0962\\u0963\\u0950\\u090D\\u0911\\u093d\\u0929\\u0934[\\u0958-\\u095f]\\u097d]", /*roundtrip exclusions*/ | |
1414 | ||
1415 | "DEVANAGARI-KANNADA", "[[:Devanagari:]-[\\u0970]]", "[:KANNADA:]", | |
1416 | "[{\\u0cb0\\u0cbc}{\\u0cb3\\u0cbc}\\u0cde\\u0cd5\\u0cd6\\u0950\\u090D\\u0911\\u093d\\u0929\\u0934[\\u0958-\\u095f]]", /*roundtrip exclusions*/ | |
1417 | ||
1418 | "MALAYALAM-DEVANAGARI", "[:MALAYALAM:]", "[[:Devanagari:]-[\\u0970]]", | |
1419 | "[\\u0901\\u0904\\u094a\\u094b\\u094c\\u093c\\u0950\\u0944\\u0945\\u0949\\u0951-\\u0954\\u0962\\u0963\\u090D\\u0911\\u093d\\u0929\\u0934[\\u0958-\\u095f]\\u097d]", /*roundtrip exclusions*/ | |
1420 | ||
1421 | "DEVANAGARI-MALAYALAM", "[[:Devanagari:]-[\\u0970]]", "[:MALAYALAM:]", | |
1422 | "[\\u0d4c\\u0d57\\u0950\\u090D\\u0911\\u093d\\u0929\\u0934[\\u0958-\\u095f]]", /*roundtrip exclusions*/ | |
1423 | ||
1424 | "GURMUKHI-BENGALI", "[:GURMUKHI:]", "[:BENGALI:]", | |
1425 | "[\\u0981\\u0982\\u09b6\\u09e2\\u09e3\\u09c3\\u09c4\\u09d7\\u098B\\u098C\\u09B7\\u09E0\\u09E1\\u09F0\\u09F1\\u09f2-\\u09fa\\u09ce]", /*roundtrip exclusions*/ | |
1426 | ||
1427 | "BENGALI-GURMUKHI", "[:BENGALI:]", "[:GURMUKHI:]", | |
1428 | "[\\u0A02\\u0a5c\\u0a47\\u0a70\\u0a71\\u0A33\\u0A35\\u0A59\\u0A5A\\u0A5B\\u0A5E\\u0A72\\u0A73\\u0A74]", /*roundtrip exclusions*/ | |
1429 | ||
1430 | "GUJARATI-BENGALI", "[:GUJARATI:]", "[:BENGALI:]", | |
1431 | "[\\u09d7\\u09e2\\u09e3\\u098c\\u09e1\\u09f0\\u09f1\\u09f2-\\u09fa\\u09ce]", /*roundtrip exclusions*/ | |
1432 | ||
1433 | "BENGALI-GUJARATI", "[:BENGALI:]", "[:GUJARATI:]", | |
1434 | "[\\u0A82\\u0a83\\u0Ac9\\u0Ac5\\u0ac7\\u0A8D\\u0A91\\u0AB3\\u0AB5\\u0ABD\\u0AD0]", /*roundtrip exclusions*/ | |
1435 | ||
1436 | "ORIYA-BENGALI", "[:ORIYA:]", "[:BENGALI:]", | |
1437 | "[\\u09c4\\u09e2\\u09e3\\u09f0\\u09f1\\u09f2-\\u09fa\\u09ce]", /*roundtrip exclusions*/ | |
1438 | ||
1439 | "BENGALI-ORIYA", "[:BENGALI:]", "[:ORIYA:]", | |
1440 | "[\\u0b35\\u0b71\\u0b5f\\u0b56\\u0b33\\u0b3d]", /*roundtrip exclusions*/ | |
1441 | ||
1442 | "Tamil-BENGALI", "[:tamil:]", "[:BENGALI:]", | |
1443 | "[\\u0981\\u09bc\\u09c3\\u09c4\\u09e2\\u09e3\\u09f0\\u09f1\\u098B\\u098C\\u0996\\u0997\\u0998\\u099B\\u099D\\u09A0\\u09A1\\u09A2\\u09A5\\u09A6\\u09A7\\u09AB\\u09AC\\u09AD\\u09B6\\u09DC\\u09DD\\u09DF\\u09E0\\u09E1\\u09f2-\\u09fa\\u09ce]", /*roundtrip exclusions*/ | |
1444 | ||
1445 | "BENGALI-Tamil", "[:BENGALI:]", "[:tamil:]", | |
1446 | "[\\u0bc6\\u0bc7\\u0bca\\u0B8E\\u0B92\\u0BA9\\u0BB1\\u0BB3\\u0BB4\\u0BB5\\u0BF0\\u0BF1\\u0BF2]", /*roundtrip exclusions*/ | |
1447 | ||
1448 | "Telugu-BENGALI", "[:telugu:]", "[:BENGALI:]", | |
1449 | "[\\u09e2\\u09e3\\u09bc\\u09d7\\u09f0\\u09f1\\u09dc\\u09dd\\u09df\\u09f2-\\u09fa\\u09ce]", /*roundtrip exclusions*/ | |
1450 | ||
1451 | "BENGALI-TELUGU", "[:BENGALI:]", "[:TELUGU:]", | |
1452 | "[\\u0c55\\u0c56\\u0c47\\u0c46\\u0c4a\\u0C0E\\u0C12\\u0C31\\u0C33\\u0C35]", /*roundtrip exclusions*/ | |
1453 | ||
1454 | "KANNADA-BENGALI", "[:KANNADA:]", "[:BENGALI:]", | |
1455 | "[\\u0981\\u09e2\\u09e3\\u09bc\\u09d7\\u09dc\\u09dd\\u09df\\u09f0\\u09f1\\u09f2-\\u09fa\\u09ce]", /*roundtrip exclusions*/ | |
1456 | ||
1457 | "BENGALI-KANNADA", "[:BENGALI:]", "[:KANNADA:]", | |
1458 | "[{\\u0cb0\\u0cbc}{\\u0cb3\\u0cbc}\\u0cc6\\u0cca\\u0cd5\\u0cd6\\u0cc7\\u0C8E\\u0C92\\u0CB1\\u0cb3\\u0cb5\\u0cde]", /*roundtrip exclusions*/ | |
1459 | ||
1460 | "MALAYALAM-BENGALI", "[:MALAYALAM:]", "[:BENGALI:]", | |
1461 | "[\\u0981\\u09e2\\u09e3\\u09bc\\u09c4\\u09f0\\u09f1\\u09dc\\u09dd\\u09df\\u09dc\\u09dd\\u09df\\u09f2-\\u09fa\\u09ce]", /*roundtrip exclusions*/ | |
1462 | ||
1463 | "BENGALI-MALAYALAM", "[:BENGALI:]", "[:MALAYALAM:]", | |
1464 | "[\\u0d46\\u0d4a\\u0d47\\u0d31-\\u0d35\\u0d0e\\u0d12]", /*roundtrip exclusions*/ | |
1465 | ||
1466 | "GUJARATI-GURMUKHI", "[:GUJARATI:]", "[:GURMUKHI:]", | |
1467 | "[\\u0A02\\u0ab3\\u0ab6\\u0A70\\u0a71\\u0a82\\u0a83\\u0ac3\\u0ac4\\u0ac5\\u0ac9\\u0a5c\\u0a72\\u0a73\\u0a74\\u0a8b\\u0a8d\\u0a91\\u0abd]", /*roundtrip exclusions*/ | |
1468 | ||
1469 | "GURMUKHI-GUJARATI", "[:GURMUKHI:]", "[:GUJARATI:]", | |
1470 | "[\\u0a5c\\u0A70\\u0a71\\u0a72\\u0a73\\u0a74\\u0a82\\u0a83\\u0a8b\\u0a8c\\u0a8d\\u0a91\\u0ab3\\u0ab6\\u0ab7\\u0abd\\u0ac3\\u0ac4\\u0ac5\\u0ac9\\u0ad0\\u0ae0\\u0ae1]", /*roundtrip exclusions*/ | |
1471 | ||
1472 | "ORIYA-GURMUKHI", "[:ORIYA:]", "[:GURMUKHI:]", | |
1473 | "[\\u0A01\\u0A02\\u0a5c\\u0a21\\u0a47\\u0a71\\u0b02\\u0b03\\u0b33\\u0b36\\u0b43\\u0b56\\u0b57\\u0B0B\\u0B0C\\u0B37\\u0B3D\\u0B5F\\u0B60\\u0B61\\u0a35\\u0a72\\u0a73\\u0a74]", /*roundtrip exclusions*/ | |
1474 | ||
1475 | "GURMUKHI-ORIYA", "[:GURMUKHI:]", "[:ORIYA:]", | |
1476 | "[\\u0b01\\u0b02\\u0b03\\u0b33\\u0b36\\u0b43\\u0b56\\u0b57\\u0B0B\\u0B0C\\u0B37\\u0B3D\\u0B5F\\u0B60\\u0B61\\u0b70\\u0b71]", /*roundtrip exclusions*/ | |
1477 | ||
1478 | "TAMIL-GURMUKHI", "[:TAMIL:]", "[:GURMUKHI:]", | |
1479 | "[\\u0A01\\u0A02\\u0a33\\u0a36\\u0a3c\\u0a70\\u0a71\\u0a47\\u0A16\\u0A17\\u0A18\\u0A1B\\u0A1D\\u0A20\\u0A21\\u0A22\\u0A25\\u0A26\\u0A27\\u0A2B\\u0A2C\\u0A2D\\u0A59\\u0A5A\\u0A5B\\u0A5C\\u0A5E\\u0A72\\u0A73\\u0A74]", /*roundtrip exclusions*/ | |
1480 | ||
1481 | "GURMUKHI-TAMIL", "[:GURMUKHI:]", "[:TAMIL:]", | |
1482 | "[\\u0b82\\u0bc6\\u0bca\\u0bd7\\u0bb7\\u0bb3\\u0b83\\u0B8E\\u0B92\\u0BA9\\u0BB1\\u0BB4\\u0bb6\\u0BF0\\u0BF1\\u0BF2]", /*roundtrip exclusions*/ | |
1483 | ||
1484 | "TELUGU-GURMUKHI", "[:TELUGU:]", "[:GURMUKHI:]", | |
1485 | "[\\u0A02\\u0a33\\u0a36\\u0a3c\\u0a70\\u0a71\\u0A59\\u0A5A\\u0A5B\\u0A5C\\u0A5E\\u0A72\\u0A73\\u0A74]", /*roundtrip exclusions*/ | |
1486 | ||
1487 | "GURMUKHI-TELUGU", "[:GURMUKHI:]", "[:TELUGU:]", | |
1488 | "[\\u0c01\\u0c02\\u0c03\\u0c33\\u0c36\\u0c44\\u0c43\\u0c46\\u0c4a\\u0c56\\u0c55\\u0C0B\\u0C0C\\u0C0E\\u0C12\\u0C31\\u0C37\\u0C60\\u0C61]", /*roundtrip exclusions*/ | |
1489 | ||
1490 | "KANNADA-GURMUKHI", "[:KANNADA:]", "[:GURMUKHI:]", | |
1491 | "[\\u0A01\\u0A02\\u0a33\\u0a36\\u0a3c\\u0a70\\u0a71\\u0A59\\u0A5A\\u0A5B\\u0A5C\\u0A5E\\u0A72\\u0A73\\u0A74]", /*roundtrip exclusions*/ | |
1492 | ||
1493 | "GURMUKHI-KANNADA", "[:GURMUKHI:]", "[:KANNADA:]", | |
1494 | "[{\\u0cb0\\u0cbc}{\\u0cb3\\u0cbc}\\u0c82\\u0c83\\u0cb3\\u0cb6\\u0cc4\\u0cc3\\u0cc6\\u0cca\\u0cd5\\u0cd6\\u0C8B\\u0C8C\\u0C8E\\u0C92\\u0CB1\\u0CB7\\u0cbd\\u0CE0\\u0CE1\\u0cde]", /*roundtrip exclusions*/ | |
1495 | ||
1496 | "MALAYALAM-GURMUKHI", "[:MALAYALAM:]", "[:GURMUKHI:]", | |
1497 | "[\\u0A01\\u0A02\\u0a4b\\u0a4c\\u0a33\\u0a36\\u0a3c\\u0a70\\u0a71\\u0A59\\u0A5A\\u0A5B\\u0A5C\\u0A5E\\u0A72\\u0A73\\u0A74]", /*roundtrip exclusions*/ | |
1498 | ||
1499 | "GURMUKHI-MALAYALAM", "[:GURMUKHI:]", "[:MALAYALAM:]", | |
1500 | "[\\u0d02\\u0d03\\u0d33\\u0d36\\u0d43\\u0d46\\u0d4a\\u0d4c\\u0d57\\u0D0B\\u0D0C\\u0D0E\\u0D12\\u0D31\\u0D34\\u0D37\\u0D60\\u0D61]", /*roundtrip exclusions*/ | |
1501 | ||
1502 | "GUJARATI-ORIYA", "[:GUJARATI:]", "[:ORIYA:]", | |
1503 | "[\\u0b56\\u0b57\\u0B0C\\u0B5F\\u0B61\\u0b70\\u0b71]", /*roundtrip exclusions*/ | |
1504 | ||
1505 | "ORIYA-GUJARATI", "[:ORIYA:]", "[:GUJARATI:]", | |
1506 | "[\\u0Ac4\\u0Ac5\\u0Ac9\\u0Ac7\\u0A8D\\u0A91\\u0AB5\\u0Ad0]", /*roundtrip exclusions*/ | |
1507 | ||
1508 | "TAMIL-GUJARATI", "[:TAMIL:]", "[:GUJARATI:]", | |
1509 | "[\\u0A81\\u0a8c\\u0abc\\u0ac3\\u0Ac4\\u0Ac5\\u0Ac9\\u0Ac7\\u0A8B\\u0A8D\\u0A91\\u0A96\\u0A97\\u0A98\\u0A9B\\u0A9D\\u0AA0\\u0AA1\\u0AA2\\u0AA5\\u0AA6\\u0AA7\\u0AAB\\u0AAC\\u0AAD\\u0AB6\\u0ABD\\u0AD0\\u0AE0\\u0AE1]", /*roundtrip exclusions*/ | |
1510 | ||
1511 | "GUJARATI-TAMIL", "[:GUJARATI:]", "[:TAMIL:]", | |
1512 | "[\\u0Bc6\\u0Bca\\u0Bd7\\u0B8E\\u0B92\\u0BA9\\u0BB1\\u0BB4\\u0BF0\\u0BF1\\u0BF2]", /*roundtrip exclusions*/ | |
1513 | ||
1514 | "TELUGU-GUJARATI", "[:TELUGU:]", "[:GUJARATI:]", | |
1515 | "[\\u0abc\\u0Ac5\\u0Ac9\\u0A8D\\u0A91\\u0ABD\\u0Ad0]", /*roundtrip exclusions*/ | |
1516 | ||
1517 | "GUJARATI-TELUGU", "[:GUJARATI:]", "[:TELUGU:]", | |
1518 | "[\\u0c46\\u0c4a\\u0c55\\u0c56\\u0C0C\\u0C0E\\u0C12\\u0C31\\u0C61]", /*roundtrip exclusions*/ | |
1519 | ||
1520 | "KANNADA-GUJARATI", "[:KANNADA:]", "[:GUJARATI:]", | |
1521 | "[\\u0A81\\u0abc\\u0Ac5\\u0Ac9\\u0A8D\\u0A91\\u0ABD\\u0Ad0]", /*roundtrip exclusions*/ | |
1522 | ||
1523 | "GUJARATI-KANNADA", "[:GUJARATI:]", "[:KANNADA:]", | |
1524 | "[{\\u0cb0\\u0cbc}{\\u0cb3\\u0cbc}\\u0cc6\\u0cca\\u0cd5\\u0cd6\\u0C8C\\u0C8E\\u0C92\\u0CB1\\u0CDE\\u0CE1]", /*roundtrip exclusions*/ | |
1525 | ||
1526 | "MALAYALAM-GUJARATI", "[:MALAYALAM:]", "[:GUJARATI:]", | |
1527 | "[\\u0A81\\u0ac4\\u0acb\\u0acc\\u0abc\\u0Ac5\\u0Ac9\\u0A8D\\u0A91\\u0ABD\\u0Ad0]", /*roundtrip exclusions*/ | |
1528 | ||
1529 | "GUJARATI-MALAYALAM", "[:GUJARATI:]", "[:MALAYALAM:]", | |
1530 | "[\\u0d46\\u0d4a\\u0d4c\\u0d55\\u0d57\\u0D0C\\u0D0E\\u0D12\\u0D31\\u0D34\\u0D61]", /*roundtrip exclusions*/ | |
1531 | ||
1532 | "TAMIL-ORIYA", "[:TAMIL:]", "[:ORIYA:]", | |
1533 | "[\\u0B01\\u0b3c\\u0b43\\u0b56\\u0B0B\\u0B0C\\u0B16\\u0B17\\u0B18\\u0B1B\\u0B1D\\u0B20\\u0B21\\u0B22\\u0B25\\u0B26\\u0B27\\u0B2B\\u0B2C\\u0B2D\\u0B36\\u0B3D\\u0B5C\\u0B5D\\u0B5F\\u0B60\\u0B61\\u0b70\\u0b71]", /*roundtrip exclusions*/ | |
1534 | ||
1535 | "ORIYA-TAMIL", "[:ORIYA:]", "[:TAMIL:]", | |
1536 | "[\\u0bc6\\u0bca\\u0bc7\\u0B8E\\u0B92\\u0BA9\\u0BB1\\u0BB4\\u0BB5\\u0BF0\\u0BF1\\u0BF2]", /*roundtrip exclusions*/ | |
1537 | ||
1538 | "TELUGU-ORIYA", "[:TELUGU:]", "[:ORIYA:]", | |
1539 | "[\\u0b3c\\u0b57\\u0b56\\u0B3D\\u0B5C\\u0B5D\\u0B5F\\u0b70\\u0b71]", /*roundtrip exclusions*/ | |
1540 | ||
1541 | "ORIYA-TELUGU", "[:ORIYA:]", "[:TELUGU:]", | |
1542 | "[\\u0c44\\u0c46\\u0c4a\\u0c55\\u0c47\\u0C0E\\u0C12\\u0C31\\u0C35]", /*roundtrip exclusions*/ | |
1543 | ||
1544 | "KANNADA-ORIYA", "[:KANNADA:]", "[:ORIYA:]", | |
1545 | "[\\u0B01\\u0b3c\\u0b57\\u0B3D\\u0B5C\\u0B5D\\u0B5F\\u0b70\\u0b71]", /*roundtrip exclusions*/ | |
1546 | ||
1547 | "ORIYA-KANNADA", "[:ORIYA:]", "[:KANNADA:]", | |
1548 | "[{\\u0cb0\\u0cbc}{\\u0cb3\\u0cbc}\\u0cc4\\u0cc6\\u0cca\\u0cd5\\u0cc7\\u0C8E\\u0C92\\u0CB1\\u0CB5\\u0CDE]", /*roundtrip exclusions*/ | |
1549 | ||
1550 | "MALAYALAM-ORIYA", "[:MALAYALAM:]", "[:ORIYA:]", | |
1551 | "[\\u0B01\\u0b3c\\u0b56\\u0B3D\\u0B5C\\u0B5D\\u0B5F\\u0b70\\u0b71]", /*roundtrip exclusions*/ | |
1552 | ||
1553 | "ORIYA-MALAYALAM", "[:ORIYA:]", "[:MALAYALAM:]", | |
1554 | "[\\u0D47\\u0D46\\u0D4a\\u0D0E\\u0D12\\u0D31\\u0D34\\u0D35]", /*roundtrip exclusions*/ | |
1555 | ||
1556 | "TELUGU-TAMIL", "[:TELUGU:]", "[:TAMIL:]", | |
1557 | "[\\u0bd7\\u0ba9\\u0bb4\\u0BF0\\u0BF1\\u0BF2]", /*roundtrip exclusions*/ | |
1558 | ||
1559 | "TAMIL-TELUGU", "[:TAMIL:]", "[:TELUGU:]", | |
1560 | "[\\u0C01\\u0c43\\u0c44\\u0c46\\u0c47\\u0c55\\u0c56\\u0c66\\u0C0B\\u0C0C\\u0C16\\u0C17\\u0C18\\u0C1B\\u0C1D\\u0C20\\u0C21\\u0C22\\u0C25\\u0C26\\u0C27\\u0C2B\\u0C2C\\u0C2D\\u0C36\\u0C60\\u0C61]", /*roundtrip exclusions*/ | |
1561 | ||
1562 | "KANNADA-TAMIL", "[:KANNADA:]", "[:TAMIL:]", | |
1563 | "[\\u0bd7\\u0bc6\\u0ba9\\u0bb4\\u0BF0\\u0BF1\\u0BF2]", /*roundtrip exclusions*/ | |
1564 | ||
1565 | "TAMIL-KANNADA", "[:TAMIL:]", "[:KANNADA:]", | |
1566 | "[\\u0cc3\\u0cc4\\u0cc6\\u0cc7\\u0cd5\\u0cd6\\u0C8B\\u0C8C\\u0C96\\u0C97\\u0C98\\u0C9B\\u0C9D\\u0CA0\\u0CA1\\u0CA2\\u0CA5\\u0CA6\\u0CA7\\u0CAB\\u0CAC\\u0CAD\\u0CB6\\u0cbc\\u0cbd\\u0CDE\\u0CE0\\u0CE1]", /*roundtrip exclusions*/ | |
1567 | ||
1568 | "MALAYALAM-TAMIL", "[:MALAYALAM:]", "[:TAMIL:]", | |
1569 | "[\\u0ba9\\u0BF0\\u0BF1\\u0BF2]", /*roundtrip exclusions*/ | |
1570 | ||
1571 | "TAMIL-MALAYALAM", "[:TAMIL:]", "[:MALAYALAM:]", | |
1572 | "[\\u0d43\\u0d12\\u0D0B\\u0D0C\\u0D16\\u0D17\\u0D18\\u0D1B\\u0D1D\\u0D20\\u0D21\\u0D22\\u0D25\\u0D26\\u0D27\\u0D2B\\u0D2C\\u0D2D\\u0D36\\u0D60\\u0D61]", /*roundtrip exclusions*/ | |
1573 | ||
1574 | "KANNADA-TELUGU", "[:KANNADA:]", "[:TELUGU:]", | |
1575 | "[\\u0C01\\u0c3f\\u0c46\\u0c48\\u0c4a]", /*roundtrip exclusions*/ | |
1576 | ||
1577 | "TELUGU-KANNADA", "[:TELUGU:]", "[:KANNADA:]", | |
1578 | "[\\u0cc8\\u0cd5\\u0cd6\\u0cbc\\u0cbd\\u0CDE]", /*roundtrip exclusions*/ | |
1579 | ||
1580 | "MALAYALAM-TELUGU", "[:MALAYALAM:]", "[:TELUGU:]", | |
1581 | "[\\u0C01\\u0c44\\u0c4a\\u0c4c\\u0c4b\\u0c55\\u0c56]", /*roundtrip exclusions*/ | |
1582 | ||
1583 | "TELUGU-MALAYALAM", "[:TELUGU:]", "[:MALAYALAM:]", | |
1584 | "[\\u0d4c\\u0d57\\u0D34]", /*roundtrip exclusions*/ | |
1585 | ||
1586 | "MALAYALAM-KANNADA", "[:MALAYALAM:]", "[:KANNADA:]", | |
1587 | "[\\u0cbc\\u0cbd\\u0cc4\\u0cc6\\u0cca\\u0ccc\\u0ccb\\u0cd5\\u0cd6\\u0cDe]", /*roundtrip exclusions*/ | |
1588 | ||
1589 | "KANNADA-MALAYALAM", "[:KANNADA:]", "[:MALAYALAM:]", | |
1590 | "[\\u0d4c\\u0d57\\u0d46\\u0D34]", /*roundtrip exclusions*/ | |
1591 | ||
1592 | "Latin-Bengali",latinForIndic, "[[:Bengali:][\\u0964\\u0965]]", | |
1593 | "[\\u0965\\u09f0-\\u09fa\\u09ce]" /*roundtrip exclusions*/ , | |
1594 | ||
1595 | "Latin-Gurmukhi", latinForIndic, "[[:Gurmukhi:][\\u0964\\u0965]]", | |
1596 | "[\\u0a01\\u0965\\u0a02\\u0a72\\u0a73\\u0a74]" /*roundtrip exclusions*/, | |
1597 | ||
1598 | "Latin-Gujarati",latinForIndic, "[[:Gujarati:][\\u0964\\u0965]]", | |
1599 | "[\\u0965]" /*roundtrip exclusions*/, | |
1600 | ||
1601 | "Latin-Oriya",latinForIndic, "[[:Oriya:][\\u0964\\u0965]]", | |
1602 | "[\\u0965\\u0b70]" /*roundtrip exclusions*/, | |
1603 | ||
1604 | "Latin-Tamil",latinForIndic, "[:Tamil:]", | |
1605 | "[\\u0BF0\\u0BF1\\u0BF2]" /*roundtrip exclusions*/, | |
1606 | ||
1607 | "Latin-Telugu",latinForIndic, "[:Telugu:]", | |
1608 | NULL /*roundtrip exclusions*/, | |
1609 | ||
1610 | "Latin-Kannada",latinForIndic, "[:Kannada:]", | |
1611 | NULL /*roundtrip exclusions*/, | |
1612 | ||
1613 | "Latin-Malayalam",latinForIndic, "[:Malayalam:]", | |
1614 | NULL /*roundtrip exclusions*/ | |
1615 | }; | |
1616 | ||
1617 | void TransliteratorRoundTripTest::TestDebug(const char* name,const char fromSet[], | |
1618 | const char* toSet,const char* exclusions){ | |
1619 | ||
1620 | RTTest test(name); | |
1621 | Legal *legal = new LegalIndic(); | |
1622 | test.test(UnicodeString(fromSet,""),UnicodeString(toSet,""),exclusions,this,quick,legal); | |
1623 | } | |
1624 | ||
1625 | void TransliteratorRoundTripTest::TestInterIndic() { | |
1626 | //TestDebug("Latin-Gurmukhi", latinForIndic, "[:Gurmukhi:]","[\\u0965\\u0a02\\u0a72\\u0a73\\u0a74]",TRUE); | |
1627 | int32_t num = UPRV_LENGTHOF(interIndicArray)/INTER_INDIC_ARRAY_WIDTH; | |
1628 | if(quick){ | |
1629 | logln("Testing only 5 of %i. Skipping rest (use -e for exhaustive)",num); | |
1630 | num = 5; | |
1631 | } | |
1632 | for(int i = 0; i < num;i++){ | |
1633 | RTTest test(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 0]); | |
1634 | Legal *legal = new LegalIndic(); | |
1635 | logln(UnicodeString("Stress testing ") + interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 0]); | |
1636 | if( !logKnownIssue( "cldrbug:1911" ) ) { | |
1637 | /* "full test" */ | |
1638 | // CLDR bug #1911: This test should be moved into CLDR. | |
1639 | test.test( interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 1], | |
1640 | interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 2], | |
1641 | interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 3], // roundtrip exclusions | |
1642 | this, quick, legal, 50); | |
1643 | } else { | |
1644 | // It is left in its current state as a regression test. | |
1645 | // CLDR should test, and remove the age filter. | |
1646 | /* regression test - ""temporary"" until CLDR#1911 is fixed */ | |
1647 | // start | |
1648 | UnicodeString source("["); | |
1649 | source.append(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 1]); | |
1650 | source.append(" & [:Age=4.1:]]"); | |
1651 | UnicodeString target("["); | |
1652 | target.append(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 2]); | |
1653 | target.append(" & [:Age=4.1:]]"); | |
1654 | test.test( source, | |
1655 | target, | |
1656 | interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 3], // roundtrip exclusions | |
1657 | this, quick, legal, 50); | |
1658 | // end | |
1659 | delete legal; | |
1660 | } | |
1661 | } | |
1662 | } | |
1663 | ||
1664 | // end indic tests ---------------------------------------------------------- | |
1665 | ||
1666 | #endif /* #if !UCONFIG_NO_TRANSLITERATION */ |