+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
-* Copyright (C) 2000-2010, International Business Machines
+* Copyright (C) 2000-2016, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
#include "unicode/locid.h"
#include "unicode/ulocdata.h"
#include "unicode/utf8.h"
+#include "unicode/utf16.h"
#include "putilimp.h"
#include "cmemory.h"
#include "transrt.h"
#include "testutil.h"
+#include "uassert.h"
#include <string.h>
#include <stdio.h>
// see if string is of the form aB; e.g. lower, then upper or title
UChar32 cp;
UBool haveLower = FALSE;
- for (int32_t i = 0; i < a.length(); i += UTF_CHAR_LENGTH(cp)) {
+ for (int32_t i = 0; i < a.length(); i += U16_LENGTH(cp)) {
cp = a.char32At(i);
int8_t t = u_charType(cp);
switch (t) {
break;
case U_TITLECASE_LETTER:
if (haveLower) return TRUE;
- // drop through, since second letter is lower.
+ // fall through, since second letter is lower.
+ U_FALLTHROUGH;
case U_LOWERCASE_LETTER:
haveLower = TRUE;
break;
Transliterator::createInstance(transliteratorID, UTRANS_FORWARD, parseError,
status));
if ((Transliterator *)sourceToTarget == NULL) {
- parent->errln("FAIL: createInstance(" + transliteratorID +
+ parent->dataerrln("FAIL: createInstance(" + transliteratorID +
") returned NULL. Error: " + u_errorName(status)
+ "\n\tpreContext : " + prettify(parseError.preContext)
+ "\n\tpostContext : " + prettify(parseError.postContext));
UBool isError = FALSE;
int32_t destIdx = 0;
U8_APPEND(bufForOneChar, destIdx, (int32_t)sizeof(bufForOneChar), c, isError);
+ U_ASSERT(!isError);
fwrite(bufForOneChar, 1, destIdx, out);
}
}
void TransliteratorRoundTripTest::TestGreek() {
-
- // CLDR bug #1911: This test should be moved into CLDR.
+ logKnownIssue( "cldrbug:1911");
// It is left in its current state as a regression test.
-
-// if (isICUVersionAtLeast(ICU_39)) {
-// // We temporarily filter against Unicode 4.1, but we only do this
-// // before version 3.4.
-// errln("FAIL: TestGreek needs to be updated to remove delete the [:Age=4.0:] filter ");
-// return;
-// } else {
-// logln("Warning: TestGreek needs to be updated to remove delete the section marked [:Age=4.0:] filter");
-// }
-
+
RTTest test("Latin-Greek");
LegalGreek *legal = new LegalGreek(TRUE);
void TransliteratorRoundTripTest::TestGreekUNGEGN() {
-
- // CLDR bug #1911: This test should be moved into CLDR.
+ logKnownIssue( "cldrbug:1911");
// It is left in its current state as a regression test.
-// if (isICUVersionAtLeast(ICU_39)) {
-// // We temporarily filter against Unicode 4.1, but we only do this
-// // before version 3.4.
-// errln("FAIL: TestGreek needs to be updated to remove delete the [:Age=4.0:] filter ");
-// return;
-// } else {
-// logln("Warning: TestGreek needs to be updated to remove delete the section marked [:Age=4.0:] filter");
-// }
-
RTTest test("Latin-Greek/UNGEGN");
LegalGreek *legal = new LegalGreek(FALSE);
}
void TransliteratorRoundTripTest::Testel() {
-
- // CLDR bug #1911: This test should be moved into CLDR.
+ logKnownIssue( "cldrbug:1911");
// It is left in its current state as a regression test.
-// if (isICUVersionAtLeast(ICU_39)) {
-// // We temporarily filter against Unicode 4.1, but we only do this
-// // before version 3.4.
-// errln("FAIL: TestGreek needs to be updated to remove delete the [:Age=4.0:] filter ");
-// return;
-// } else {
-// logln("Warning: TestGreek needs to be updated to remove delete the section marked [:Age=4.0:] filter");
-// }
-
RTTest test("Latin-el");
LegalGreek *legal = new LegalGreek(FALSE);
return TRUE;
}
void TransliteratorRoundTripTest::TestHebrew() {
- // CLDR bug #1911: This test should be moved into CLDR.
+ logKnownIssue( "cldrbug:1911");
// It is left in its current state as a regression test.
-// if (isICUVersionAtLeast(ICU_39)) {
-// // We temporarily filter against Unicode 4.1, but we only do this
-// // before version 3.4.
-// errln("FAIL: TestHebrew needs to be updated to remove delete the [:Age=4.0:] filter ");
-// return;
-// } else {
-// logln("Warning: TestHebrew needs to be updated to remove delete the section marked [:Age=4.0:] filter");
-// }
+
//long start = System.currentTimeMillis();
UErrorCode error = U_ZERO_ERROR;
LegalHebrew* legal = new LegalHebrew(error);
}
RTTest test("Latin-Devanagari");
Legal *legal = new LegalIndic();
- // CLDR bug #1911: This test should be moved into CLDR.
+ logKnownIssue( "cldrbug:1911");
// It is left in its current state as a regression test.
-// if (isICUVersionAtLeast(ICU_39)) {
-// // We temporarily filter against Unicode 4.1, but we only do this
-// // before version 3.4.
-// errln("FAIL: TestDevanagariLatin needs to be updated to remove delete the [:Age=4.1:] filter ");
-// return;
-// } else {
-// logln("Warning: TestDevanagariLatin needs to be updated to remove delete the section marked [:Age=4.1:] filter");
-// }
+
test.test(UnicodeString(latinForIndic, ""),
- UnicodeString("[[[:Devanagari:][\\u094d][\\u0964\\u0965]]&[:Age=4.1:]]", ""), "[\\u0965\\u0904]", this, quick,
+ UnicodeString("[[[:Devanagari:][\\u094d][\\u0964\\u0965]]&[:Age=4.1:]-[\\u0970]]", ""), "[\\u0965\\u0904]", this, quick,
legal, 50);
delete legal;
static const int32_t INTER_INDIC_ARRAY_WIDTH = 4;
static const char * const interIndicArray[] = {
- "BENGALI-DEVANAGARI", "[:BENGALI:]", "[:Devanagari:]",
+ "BENGALI-DEVANAGARI", "[:BENGALI:]", "[[:Devanagari:]-[\\u0970]]",
"[\\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*/
- "DEVANAGARI-BENGALI", "[:Devanagari:]", "[:BENGALI:]",
+ "DEVANAGARI-BENGALI", "[[:Devanagari:]-[\\u0970]]", "[:BENGALI:]",
"[\\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*/
- "GURMUKHI-DEVANAGARI", "[:GURMUKHI:]", "[:Devanagari:]",
+ "GURMUKHI-DEVANAGARI", "[:GURMUKHI:]", "[[:Devanagari:]-[\\u0970]]",
"[\\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*/
- "DEVANAGARI-GURMUKHI", "[:Devanagari:]", "[:GURMUKHI:]",
+ "DEVANAGARI-GURMUKHI", "[[:Devanagari:]-[\\u0970]]", "[:GURMUKHI:]",
"[\\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*/
- "GUJARATI-DEVANAGARI", "[:GUJARATI:]", "[:Devanagari:]",
+ "GUJARATI-DEVANAGARI", "[:GUJARATI:]", "[[:Devanagari:]-[\\u0970]]",
"[\\u0946\\u094A\\u0962\\u0963\\u0951-\\u0954\\u0961\\u090c\\u090e\\u0912\\u097d]", /*roundtrip exclusions*/
- "DEVANAGARI-GUJARATI", "[:Devanagari:]", "[:GUJARATI:]",
+ "DEVANAGARI-GUJARATI", "[[:Devanagari:]-[\\u0970]]", "[:GUJARATI:]",
"[\\u0951-\\u0954\\u0961\\u090c\\u090e\\u0912]", /*roundtrip exclusions*/
- "ORIYA-DEVANAGARI", "[:ORIYA:]", "[:Devanagari:]",
+ "ORIYA-DEVANAGARI", "[:ORIYA:]", "[[:Devanagari:]-[\\u0970]]",
"[\\u0904\\u0943-\\u094a\\u0962\\u0963\\u0951-\\u0954\\u0950\\u090D\\u090e\\u0912\\u0911\\u0931\\u0935\\u097d]", /*roundtrip exclusions*/
- "DEVANAGARI-ORIYA", "[:Devanagari:]", "[:ORIYA:]",
+ "DEVANAGARI-ORIYA", "[[:Devanagari:]-[\\u0970]]", "[:ORIYA:]",
"[\\u0b5f\\u0b56\\u0b57\\u0b70\\u0b71\\u0950\\u090D\\u090e\\u0912\\u0911\\u0931]", /*roundtrip exclusions*/
- "Tamil-DEVANAGARI", "[:tamil:]", "[:Devanagari:]",
+ "Tamil-DEVANAGARI", "[:tamil:]", "[[:Devanagari:]-[\\u0970]]",
"[\\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*/
- "DEVANAGARI-Tamil", "[:Devanagari:]", "[:tamil:]",
+ "DEVANAGARI-Tamil", "[[:Devanagari:]-[\\u0970]]", "[:tamil:]",
"[\\u0bd7\\u0BF0\\u0BF1\\u0BF2]", /*roundtrip exclusions*/
- "Telugu-DEVANAGARI", "[:telugu:]", "[:Devanagari:]",
+ "Telugu-DEVANAGARI", "[:telugu:]", "[[:Devanagari:]-[\\u0970]]",
"[\\u0904\\u093c\\u0950\\u0945\\u0949\\u0951-\\u0954\\u0962\\u0963\\u090D\\u0911\\u093d\\u0929\\u0934[\\u0958-\\u095f]\\u097d]", /*roundtrip exclusions*/
- "DEVANAGARI-TELUGU", "[:Devanagari:]", "[:TELUGU:]",
+ "DEVANAGARI-TELUGU", "[[:Devanagari:]-[\\u0970]]", "[:TELUGU:]",
"[\\u0c55\\u0c56\\u0950\\u090D\\u0911\\u093d\\u0929\\u0934[\\u0958-\\u095f]]", /*roundtrip exclusions*/
- "KANNADA-DEVANAGARI", "[:KANNADA:]", "[:Devanagari:]",
+ "KANNADA-DEVANAGARI", "[:KANNADA:]", "[[:Devanagari:]-[\\u0970]]",
"[\\u0901\\u0904\\u0946\\u093c\\u0950\\u0945\\u0949\\u0951-\\u0954\\u0962\\u0963\\u0950\\u090D\\u0911\\u093d\\u0929\\u0934[\\u0958-\\u095f]\\u097d]", /*roundtrip exclusions*/
- "DEVANAGARI-KANNADA", "[:Devanagari:]", "[:KANNADA:]",
+ "DEVANAGARI-KANNADA", "[[:Devanagari:]-[\\u0970]]", "[:KANNADA:]",
"[{\\u0cb0\\u0cbc}{\\u0cb3\\u0cbc}\\u0cde\\u0cd5\\u0cd6\\u0950\\u090D\\u0911\\u093d\\u0929\\u0934[\\u0958-\\u095f]]", /*roundtrip exclusions*/
- "MALAYALAM-DEVANAGARI", "[:MALAYALAM:]", "[:Devanagari:]",
+ "MALAYALAM-DEVANAGARI", "[:MALAYALAM:]", "[[:Devanagari:]-[\\u0970]]",
"[\\u0901\\u0904\\u094a\\u094b\\u094c\\u093c\\u0950\\u0944\\u0945\\u0949\\u0951-\\u0954\\u0962\\u0963\\u090D\\u0911\\u093d\\u0929\\u0934[\\u0958-\\u095f]\\u097d]", /*roundtrip exclusions*/
- "DEVANAGARI-MALAYALAM", "[:Devanagari:]", "[:MALAYALAM:]",
+ "DEVANAGARI-MALAYALAM", "[[:Devanagari:]-[\\u0970]]", "[:MALAYALAM:]",
"[\\u0d4c\\u0d57\\u0950\\u090D\\u0911\\u093d\\u0929\\u0934[\\u0958-\\u095f]]", /*roundtrip exclusions*/
"GURMUKHI-BENGALI", "[:GURMUKHI:]", "[:BENGALI:]",
void TransliteratorRoundTripTest::TestInterIndic() {
//TestDebug("Latin-Gurmukhi", latinForIndic, "[:Gurmukhi:]","[\\u0965\\u0a02\\u0a72\\u0a73\\u0a74]",TRUE);
- int32_t num = (int32_t)(sizeof(interIndicArray)/(INTER_INDIC_ARRAY_WIDTH*sizeof(char*)));
+ int32_t num = UPRV_LENGTHOF(interIndicArray)/INTER_INDIC_ARRAY_WIDTH;
if(quick){
logln("Testing only 5 of %i. Skipping rest (use -e for exhaustive)",num);
num = 5;
}
- // CLDR bug #1911: This test should be moved into CLDR.
- // It is left in its current state as a regression test.
-// if (isICUVersionAtLeast(ICU_39)) {
-// // We temporarily filter against Unicode 4.1, but we only do this
-// // before version 3.4.
-// errln("FAIL: TestInterIndic needs to be updated to remove delete the [:Age=4.1:] filter ");
-// return;
-// } else {
-// logln("Warning: TestInterIndic needs to be updated to remove delete the section marked [:Age=4.1:] filter");
-// }
for(int i = 0; i < num;i++){
RTTest test(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 0]);
Legal *legal = new LegalIndic();
logln(UnicodeString("Stress testing ") + interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 0]);
- /* Uncomment lines below when transliterator is fixed */
- /*
+ if( !logKnownIssue( "cldrbug:1911" ) ) {
+ /* "full test" */
+ // CLDR bug #1911: This test should be moved into CLDR.
test.test( interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 1],
interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 2],
interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 3], // roundtrip exclusions
this, quick, legal, 50);
- */
- /* comment lines below when transliterator is fixed */
+ } else {
+ // It is left in its current state as a regression test.
+ // CLDR should test, and remove the age filter.
+ /* regression test - ""temporary"" until CLDR#1911 is fixed */
// start
UnicodeString source("[");
source.append(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 1]);
UnicodeString target("[");
target.append(interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 2]);
target.append(" & [:Age=4.1:]]");
- test.test( source,
- target,
+ test.test( source,
+ target,
interIndicArray[i*INTER_INDIC_ARRAY_WIDTH + 3], // roundtrip exclusions
this, quick, legal, 50);
// end
delete legal;
+ }
}
}