From 0413fcf2dce354f7e39b6ca5d996ff649da03fcd Mon Sep 17 00:00:00 2001 From: Vladimir Weinstein Date: Wed, 2 Aug 2000 19:06:18 +0000 Subject: [PATCH] ICU-432 fixes for running on a japanese machine X-SVN-Rev: 2096 --- icu4c/source/test/cintltst/creststn.c | 3 +- icu4c/source/test/cintltst/putiltst.c | 2 + icu4c/source/test/cintltst/utransts.c | 12 ++-- icu4c/source/test/intltest/cpdtrtst.cpp | 2 +- icu4c/source/test/intltest/hxuntrts.cpp | 38 ++++++------ icu4c/source/test/intltest/transapi.cpp | 62 +++++++++---------- icu4c/source/test/intltest/transrt.cpp | 12 ++-- icu4c/source/test/intltest/transtst.cpp | 7 ++- icu4c/source/test/intltest/ufltlgts.cpp | 80 ++++++++++++------------- icu4c/source/test/intltest/unhxtrts.cpp | 46 +++++++------- icu4c/source/test/intltest/usettest.cpp | 12 ++-- 11 files changed, 142 insertions(+), 134 deletions(-) diff --git a/icu4c/source/test/cintltst/creststn.c b/icu4c/source/test/cintltst/creststn.c index 5fc3b5aba8..0591a5e8f1 100644 --- a/icu4c/source/test/cintltst/creststn.c +++ b/icu4c/source/test/cintltst/creststn.c @@ -330,7 +330,8 @@ void TestAPI(){ directory= ctest_getTestDirectory(); uprv_strcpy(testdatapath, directory); uprv_strcat(testdatapath, "testdata"); - u_uastrcpy(utestdatapath, testdatapath); + u_charsToUChars(testdatapath, utestdatapath, strlen(testdatapath)+1); + /*u_uastrcpy(utestdatapath, testdatapath);*/ /*Test ures_openU */ log_verbose("Testing ures_openU()......\n"); diff --git a/icu4c/source/test/cintltst/putiltst.c b/icu4c/source/test/cintltst/putiltst.c index 49b28713ce..b6c376ed18 100644 --- a/icu4c/source/test/cintltst/putiltst.c +++ b/icu4c/source/test/cintltst/putiltst.c @@ -228,6 +228,8 @@ void TestPUtilAPI(){ udataDir=(UChar*)malloc(sizeof(UChar) * (strlen(dataDirectory) + 1)); u_charsToUChars(dataDirectory, udataDir, (strlen(dataDirectory)+1)); u_uastrcpy(temp, dataDirectory); + /* This cannot really work on a japanese system. u_uastrcpy will have different results than */ + /* u_charsToUChars when there is a backslash in the string! */ if(u_strcmp(temp, udataDir) != 0){ log_err("ERROR: u_charsToUChars failed. Expected %s, Got %s\n", austrdup(temp), austrdup(udataDir)); } diff --git a/icu4c/source/test/cintltst/utransts.c b/icu4c/source/test/cintltst/utransts.c index cbc7b4c23d..71d4105e3b 100644 --- a/icu4c/source/test/cintltst/utransts.c +++ b/icu4c/source/test/cintltst/utransts.c @@ -146,7 +146,8 @@ void TestFilter() { } for (i=0; i %s\n", DATA[i+1], DATA[i], cbuf); } else { diff --git a/icu4c/source/test/intltest/cpdtrtst.cpp b/icu4c/source/test/intltest/cpdtrtst.cpp index 378100cfb3..f2d0f8593d 100644 --- a/icu4c/source/test/intltest/cpdtrtst.cpp +++ b/icu4c/source/test/intltest/cpdtrtst.cpp @@ -317,7 +317,7 @@ void CompoundTransliteratorTest::TestTransliterate(){ delete ct1; UnicodeString Data[]={ //ID, input string, transliterated string - "Unicode-Hex;Hex-Unicode;Unicode-Hex", "hello", "\\u0068\\u0065\\u006C\\u006C\\u006F", + "Unicode-Hex;Hex-Unicode;Unicode-Hex", "hello", UnicodeString("\\u0068\\u0065\\u006C\\u006C\\u006F", ""), "Unicode-Hex;Hex-Unicode", "hello! How are you?", "hello! How are you?", "Devanagari-Latin;Latin-Devanagari", CharsToUnicodeString("\\u092D\\u0948'\\u0930'\\u0935"), CharsToUnicodeString("\\u092D\\u0948\\u0930\\u0935"), // quotes lost "Latin-Cyrillic;Cyrillic-Latin", "a'b'k'd'e'f'g'h'i'j'Shch'shch'zh'h", "abkdefghijShchshchzhh", diff --git a/icu4c/source/test/intltest/hxuntrts.cpp b/icu4c/source/test/intltest/hxuntrts.cpp index 6ed64d2077..ae73b78abd 100644 --- a/icu4c/source/test/intltest/hxuntrts.cpp +++ b/icu4c/source/test/intltest/hxuntrts.cpp @@ -206,7 +206,7 @@ void HexToUniTransliteratorTest::TestPattern(){ } UnicodeString defaultpattern=transdefault->toPattern(); - UnicodeString pattern1("\\\\U+0000"); + UnicodeString pattern1("\\\\U+0000", ""); HexToUnicodeTransliterator *trans1=new HexToUnicodeTransliterator(pattern1, NULL, status); if(U_FAILURE(status) ){ errln("HexToUnicodeTransliterator construction failed with pattern =" + pattern1); @@ -215,21 +215,21 @@ void HexToUniTransliteratorTest::TestPattern(){ } /*test toPattern() */ if(transdefault->toPattern() == trans1->toPattern() || - transdefault->toPattern() != UnicodeString("\\\\u0000;\\\\U0000;u+0000;U+0000") || + transdefault->toPattern() != UnicodeString("\\\\u0000;\\\\U0000;u+0000;U+0000", "") || trans1->toPattern() != pattern1 ){ errln("Error: toPattern() failed "+ transdefault->toPattern()); } /*apply patterns for transdefault*/ UnicodeString str("abKf"); - expectPattern(*transdefault, pattern1, (UnicodeString)"\\U+0061\\U+0062\\U+004B\\U+0066", str); - expectPattern(*transdefault, (UnicodeString)"\\U##00,", (UnicodeString)"U61,U62,U4B,U66,", str); - expectPattern(*transdefault, defaultpattern, (UnicodeString)"\\u0061\\u0062\\u004B\\u0066", str); - expectPattern(*trans1, (UnicodeString)"\\uni0000", (UnicodeString)"uni0061uni0062uni004Buni0066", str); - expectPattern(*trans1, (UnicodeString)"\\\\S-0000-E", (UnicodeString)"\\S-0061-E\\S-0062-E\\S-004B-E\\S-0066-E", str); - expectPattern(*trans1, (UnicodeString)"\\u##0000", (UnicodeString)"\\u##0061\\u##0062", "FAIL"); - expectPattern(*trans1, (UnicodeString)"\\*0000", (UnicodeString)"*0061*0062*004B*0066", str); - expectPattern(*trans1, (UnicodeString)"\\u####", (UnicodeString)"\\u##0061\\u##0062", "FAIL"); + expectPattern(*transdefault, pattern1, UnicodeString("\\U+0061\\U+0062\\U+004B\\U+0066", ""), str); + expectPattern(*transdefault, UnicodeString("\\U##00,", ""), UnicodeString("U61,U62,U4B,U66,", ""), str); + expectPattern(*transdefault, defaultpattern, UnicodeString("\\u0061\\u0062\\u004B\\u0066", ""), str); + expectPattern(*trans1, UnicodeString("\\uni0000", ""), UnicodeString("uni0061uni0062uni004Buni0066", ""), str); + expectPattern(*trans1, UnicodeString("\\\\S-0000-E", ""), UnicodeString("\\S-0061-E\\S-0062-E\\S-004B-E\\S-0066-E", ""), str); + expectPattern(*trans1, UnicodeString("\\u##0000", ""), UnicodeString("\\u##0061\\u##0062", ""), "FAIL"); + expectPattern(*trans1, UnicodeString("\\*0000", ""), UnicodeString("*0061*0062*004B*0066", ""), str); + expectPattern(*trans1, UnicodeString("\\u####", ""), UnicodeString("\\u##0061\\u##0062", ""), "FAIL"); delete trans1; delete transdefault; @@ -238,20 +238,20 @@ void HexToUniTransliteratorTest::TestPattern(){ void HexToUniTransliteratorTest::TestSimpleTransliterate(){ logln("Testing the handleTransliterate() API of HexToUnicodeTransliterator"); UErrorCode status=U_ZERO_ERROR; - UnicodeString pattern1("\\\\U+0000"); + UnicodeString pattern1("\\\\U+0000", ""); HexToUnicodeTransliterator *trans1=new HexToUnicodeTransliterator(pattern1, NULL, status); if(U_FAILURE(status)){ errln("HexToUnicodeTransliterator construction failed with pattern =" + pattern1 + "Error: " + (UnicodeString)u_errorName(status)); status=U_ZERO_ERROR; return; } - UnicodeString source("He\\U+006C\\U+006C\\U+006F"); + UnicodeString source("He\\U+006C\\U+006C\\U+006F", ""); UnicodeString rsource(source); UTransPosition index={1, source.length(),2,source.length()}; UnicodeString expected("Hello"); trans1->handleTransliterate(rsource, index, FALSE); expectAux(trans1->getID() + ":handleTransliterator ", source + "-->" + rsource, rsource==expected, expected); - expect(*trans1, "", (UnicodeString)"\\U+0048\\U+0065\\U+006C\\U+006C\\U+006F", expected); + expect(*trans1, "", UnicodeString("\\U+0048\\U+0065\\U+006C\\U+006C\\U+006F", ""), expected); delete trans1; HexToUnicodeTransliterator *trans2=new HexToUnicodeTransliterator(new TestHexFilter); @@ -264,12 +264,12 @@ void HexToUniTransliteratorTest::TestTransliterate(){ UErrorCode status=U_ZERO_ERROR; UnicodeString Data[]={ //pattern, source, index.contextStart, index.contextLimit, index.start, expectedResult, - (UnicodeString)"U+##00", (UnicodeString)"abU+63", "1", "7", "2", (UnicodeString)"abc", - (UnicodeString)"\\\\u0000", (UnicodeString)"a\\u0062c", "1", "7", "1", (UnicodeString)"abc", - (UnicodeString)"Uni0000", (UnicodeString)"abUni0063", "1", "9", "2", (UnicodeString)"abc", - (UnicodeString)"U[0000]", (UnicodeString)"heU[006C]U[006C]o", "0", "16", "2", (UnicodeString)"hello", - (UnicodeString)"prefix-0000-suffix", (UnicodeString)"aprefix-0062-suffixprefix-0063-suffix", "1", "39", "1", (UnicodeString)"abc", - (UnicodeString)"*##00*", (UnicodeString)"hell*6F**74**68**65*re", "1", "20", "4", (UnicodeString)"hellothere", + UnicodeString("U+##00", ""), UnicodeString("abU+63", ""), "1", "7", "2", UnicodeString("abc", ""), + UnicodeString("\\\\u0000", ""), UnicodeString("a\\u0062c", ""), "1", "7", "1", UnicodeString("abc", ""), + UnicodeString("Uni0000", ""), UnicodeString("abUni0063", ""), "1", "9", "2", UnicodeString("abc", ""), + UnicodeString("U[0000]", ""), UnicodeString("heU[006C]U[006C]o", ""), "0", "16", "2", UnicodeString("hello", ""), + UnicodeString("prefix-0000-suffix", ""), UnicodeString("aprefix-0062-suffixprefix-0063-suffix", ""), "1", "39", "1", UnicodeString("abc", ""), + UnicodeString("*##00*", ""), UnicodeString("hell*6F**74**68**65*re", ""), "1", "20", "4", UnicodeString("hellothere", ""), }; int i; diff --git a/icu4c/source/test/intltest/transapi.cpp b/icu4c/source/test/intltest/transapi.cpp index 89856f9bb8..090f5a2be7 100644 --- a/icu4c/source/test/intltest/transapi.cpp +++ b/icu4c/source/test/intltest/transapi.cpp @@ -221,7 +221,7 @@ void TransliteratorAPITest::TestGetDisplayName() { } t->getDisplayName(t->getID(), name); message="Display name for ID:" + t->getID(); - doTest(message, name, dispNames[i+1]); + // doTest(message, name, dispNames[i+1]); //!!! This will obviously fail for any locale other than english and its children!!! name=""; t->getDisplayName(t->getID(), Locale::US, name); message.remove(); @@ -243,9 +243,9 @@ void TransliteratorAPITest::TestTransliterate1(){ UnicodeString Data[]={ //ID, input string, transliterated string - "Unicode-Hex", "hello", "\\u0068\\u0065\\u006C\\u006C\\u006F" , - "Hex-Unicode", "\\u0068\\u0065\\u006C\\u006C\\u006F", "hello" , - "Latin-Devanagari", "bhaarata", CharsToUnicodeString("\\u092D\\u093E\\u0930\\u0924") , + "Unicode-Hex", "hello", UnicodeString("\\u0068\\u0065\\u006C\\u006C\\u006F", "") , + "Hex-Unicode", UnicodeString("\\u0068\\u0065\\u006C\\u006C\\u006F", ""), "hello" , + "Latin-Devanagari", "bhaarata", CharsToUnicodeString("\\u092D\\u093E\\u0930\\u0924") , "Devanagari-Latin", CharsToUnicodeString("\\u092D\\u093E\\u0930\\u0924"), "bhaarata" , // "Contracted-Expanded", CharsToUnicodeString("\\u00C0\\u00C1\\u0042"), CharsToUnicodeString("\\u0041\\u0300\\u0041\\u0301\\u0042") , // "Expanded-Contracted", CharsToUnicodeString("\\u0041\\u0300\\u0041\\u0301\\u0042"), CharsToUnicodeString("\\u00C0\\u00C1\\u0042") , @@ -289,8 +289,8 @@ void TransliteratorAPITest::TestTransliterate2(){ //testing tranliterate(String text, int start, int limit, StringBuffer result) UnicodeString Data2[]={ //ID, input string, start, limit, transliterated string - "Unicode-Hex", "hello! How are you?", "0", "5", "\\u0068\\u0065\\u006C\\u006C\\u006F", "\\u0068\\u0065\\u006C\\u006C\\u006F! How are you?" , - "Unicode-Hex", "hello! How are you?", "7", "12", "\\u0048\\u006F\\u0077\\u0020\\u0061", "hello! \\u0048\\u006F\\u0077\\u0020\\u0061re you?", + "Unicode-Hex", "hello! How are you?", "0", "5", UnicodeString("\\u0068\\u0065\\u006C\\u006C\\u006F", ""), UnicodeString("\\u0068\\u0065\\u006C\\u006C\\u006F! How are you?", "") , + "Unicode-Hex", "hello! How are you?", "7", "12", UnicodeString("\\u0048\\u006F\\u0077\\u0020\\u0061", ""), UnicodeString("hello! \\u0048\\u006F\\u0077\\u0020\\u0061re you?", ""), "Hex-Unicode", CharsToUnicodeString("\\u0068\\u0065\\u006C\\u006C\\u006F\\u0021\\u0020"), "0", "5", "hello", "hello! " , // "Contracted-Expanded", CharsToUnicodeString("\\u00C0\\u00C1\\u0042"), "1", "2", CharsToUnicodeString("\\u0041\\u0301"), CharsToUnicodeString("\\u00C0\\u0041\\u0301\\u0042") , "Devanagari-Latin", CharsToUnicodeString("\\u092D\\u093E\\u0930\\u0924"), "0", "1", "bha", CharsToUnicodeString("bha\\u093E\\u0930\\u0924") , @@ -338,9 +338,9 @@ void TransliteratorAPITest::TestTransliterate3(){ UnicodeString rs="This is the replaceable String"; UnicodeString Data[] = { "0", "0", "This is the replaceable String", - "2", "3", "Th\\u0069s is the replaceable String", - "21", "23", "Th\\u0069s is the repl\\u0061\\u0063eable String", - "14", "17", "Th\\u0069s is t\\u0068\\u0065\\u0020repl\\u0061\\u0063eable String", + "2", "3", UnicodeString("Th\\u0069s is the replaceable String", ""), + "21", "23", UnicodeString("Th\\u0069s is the repl\\u0061\\u0063eable String", ""), + "14", "17", UnicodeString("Th\\u0069s is t\\u0068\\u0065\\u0020repl\\u0061\\u0063eable String", ""), }; int start, limit; @@ -366,7 +366,7 @@ void TransliteratorAPITest::TestSimpleKeyboardTransliterator(){ UTransPosition index={19,20,20,20}; UnicodeString rs= "Transliterate this-''"; UnicodeString insertion="abc"; - UnicodeString expected="Transliterate this-'\\u0061\\u0062\\u0063'"; + UnicodeString expected=UnicodeString("Transliterate this-'\\u0061\\u0062\\u0063'", ""); t->transliterate(rs, index, insertion, status); if(U_FAILURE(status)) errln("FAIL: " + t->getID()+ ".translitere(Replaceable, int[], UnicodeString, UErrorCode)-->" + (UnicodeString)u_errorName(status)); @@ -396,16 +396,16 @@ void TransliteratorAPITest::TestSimpleKeyboardTransliterator(){ void TransliteratorAPITest::TestKeyboardTransliterator1(){ UnicodeString Data[]={ //insertion, buffer - "a", "\\u0061" , - "bbb", "\\u0061\\u0062\\u0062\\u0062" , - "ca", "\\u0061\\u0062\\u0062\\u0062\\u0063\\u0061" , - " ", "\\u0061\\u0062\\u0062\\u0062\\u0063\\u0061\\u0020" , - "", "\\u0061\\u0062\\u0062\\u0062\\u0063\\u0061\\u0020" , + "a", UnicodeString("\\u0061", "") , + "bbb", UnicodeString("\\u0061\\u0062\\u0062\\u0062", "") , + "ca", UnicodeString("\\u0061\\u0062\\u0062\\u0062\\u0063\\u0061", "") , + " ", UnicodeString("\\u0061\\u0062\\u0062\\u0062\\u0063\\u0061\\u0020", "") , + "", UnicodeString("\\u0061\\u0062\\u0062\\u0062\\u0063\\u0061\\u0020", "") , - "a", "\\u0061" , - "b", "\\u0061\\u0062" , - "z", "\\u0061\\u0062\\u007A" , - "", "\\u0061\\u0062\\u007A" + "a", UnicodeString("\\u0061", "") , + "b", UnicodeString("\\u0061\\u0062", "") , + "z", UnicodeString("\\u0061\\u0062\\u007A", "") , + "", UnicodeString("\\u0061\\u0062\\u007A", "") }; Transliterator* t=Transliterator::createInstance("Unicode-Hex"); @@ -460,10 +460,10 @@ void TransliteratorAPITest::TestKeyboardTransliterator2(){ UnicodeString Data[]={ //insertion, buffer, index[START], index[LIMIT], index[CURSOR] //data for Unicode-Hex - "abc", "Initial String: add-\\u0061\\u0062\\u0063-", "19", "20", "20", - "a", "In\\u0069\\u0061tial String: add-\\u0061\\u0062\\u0063-", "2", "3", "2" , - "b", "\\u0062In\\u0069\\u0061tial String: add-\\u0061\\u0062\\u0063-", "0", "0", "0" , - "", "\\u0062In\\u0069\\u0061tial String: add-\\u0061\\u0062\\u0063-", "0", "0", "0" , + "abc", UnicodeString("Initial String: add-\\u0061\\u0062\\u0063-", ""), "19", "20", "20", + "a", UnicodeString("In\\u0069\\u0061tial String: add-\\u0061\\u0062\\u0063-", ""), "2", "3", "2" , + "b", UnicodeString("\\u0062In\\u0069\\u0061tial String: add-\\u0061\\u0062\\u0063-", ""), "0", "0", "0" , + "", UnicodeString("\\u0062In\\u0069\\u0061tial String: add-\\u0061\\u0062\\u0063-", ""), "0", "0", "0" , //data for Latin-Devanagiri "aa", CharsToUnicodeString("Hindi -\\u0906-"), "6", "7", "6", "maa", CharsToUnicodeString("Hindi -\\u0906\\u092E\\u093E-"), "7", "8", "7", @@ -507,8 +507,8 @@ void TransliteratorAPITest::TestKeyboardTransliterator3(){ UnicodeString s="This is the main string"; UnicodeString Data[] = { "0", "0", "0", "This is the main string", - "1", "3", "2", "Th\\u0069s is the main string", - "20", "21", "20", "Th\\u0069s is the mai\\u006E string" + "1", "3", "2", UnicodeString("Th\\u0069s is the main string", ""), + "20", "21", "20", UnicodeString("Th\\u0069s is the mai\\u006E string", "") }; UErrorCode status=U_ZERO_ERROR; @@ -670,7 +670,7 @@ void TransliteratorAPITest::TestGetAdoptFilter(){ got = data; t->transliterate(got); - UnicodeString exp="A\\u0042Ca\\u0062c\\u0062\\u0062C\\u0042a"; + UnicodeString exp=UnicodeString("A\\u0042Ca\\u0062c\\u0062\\u0062C\\u0042a", ""); message="transliteration after adoptFilter(a,A,c,C) "; doTest(message, got, exp); @@ -683,7 +683,7 @@ void TransliteratorAPITest::TestGetAdoptFilter(){ got = data; t->transliterate(got); - exp="\\u0041\\u0042\\u0043\\u0061\\u0062\\u0063\\u0062\\u0062\\u0043\\u0042\\u0061"; + exp=UnicodeString("\\u0041\\u0042\\u0043\\u0061\\u0062\\u0063\\u0062\\u0062\\u0043\\u0042\\u0061", ""); message="transliteration after adopting null filter"; doTest(message, got, exp); message="adoptFilter round trip"; @@ -691,28 +691,28 @@ void TransliteratorAPITest::TestGetAdoptFilter(){ t->adoptFilter(new TestFilter2); data="heelloe"; - exp="\\u0068eell\\u006Fe"; + exp=UnicodeString("\\u0068eell\\u006Fe", ""); got = data; t->transliterate(got); message="transliteration using (e,l) filter"; doTest("transliteration using (e,l) filter", got, exp); data="are well"; - exp="\\u0061\\u0072e\\u0020\\u0077ell"; + exp=UnicodeString("\\u0061\\u0072e\\u0020\\u0077ell", ""); got = data; t->transliterate(got); doTest(message, got, exp); t->adoptFilter(new TestFilter3); data="ho, wow!"; - exp="\\u0068o\\u002C\\u0020wow\\u0021"; + exp=UnicodeString("\\u0068o\\u002C\\u0020wow\\u0021", ""); got = data; t->transliterate(got); message="transliteration using (o,w) filter"; doTest("transliteration using (o,w) filter", got, exp); data="owl"; - exp="ow\\u006C"; + exp=UnicodeString("ow\\u006C", ""); got = data; t->transliterate(got); doTest("transliteration using (o,w) filter", got, exp); diff --git a/icu4c/source/test/intltest/transrt.cpp b/icu4c/source/test/intltest/transrt.cpp index 8114f5cf3b..c1d86dcf7a 100644 --- a/icu4c/source/test/intltest/transrt.cpp +++ b/icu4c/source/test/intltest/transrt.cpp @@ -456,25 +456,25 @@ UBool RTHangulTest::isSource(UChar c) { void TransliteratorRoundTripTest::TestHiragana() { RTTest test("Latin-Kana", TestUtility::LATIN_SCRIPT, TestUtility::HIRAGANA_SCRIPT); - test.test("[a-z]", "[\\u3040-\\u3094]", this); + test.test("[a-z]", UnicodeString("[\\u3040-\\u3094]", ""), this); } void TransliteratorRoundTripTest::TestKatakana() { RTTest test("Latin-Kana", TestUtility::LATIN_SCRIPT, TestUtility::KATAKANA_SCRIPT); - test.test("[A-Z]", "[\\u30A1-\\u30FA]", this); + test.test("[A-Z]", UnicodeString("[\\u30A1-\\u30FA]", ""), this); } void TransliteratorRoundTripTest::TestArabic() { RTTest test("Latin-Arabic", TestUtility::LATIN_SCRIPT, TestUtility::ARABIC_SCRIPT); - test.test("[a-z]", "[\\u0620-\\u065F-[\\u0640]]", this); + test.test("[a-z]", UnicodeString("[\\u0620-\\u065F-[\\u0640]]", ""), this); } void TransliteratorRoundTripTest::TestHebrew() { RTTest test("Latin-Hebrew", TestUtility::LATIN_SCRIPT, TestUtility::HEBREW_SCRIPT); - test.test("", "[\\u05D0-\\u05EF]", this); + test.test("", UnicodeString("[\\u05D0-\\u05EF]", ""), this); } void TransliteratorRoundTripTest::TestHangul() { @@ -500,11 +500,11 @@ void TransliteratorRoundTripTest::TestJamoHangul() { void TransliteratorRoundTripTest::TestGreek() { RTTest test("Latin-Greek", TestUtility::LATIN_SCRIPT, TestUtility::GREEK_SCRIPT); - test.test("", "[\\u0380-\\u03CF]", this); + test.test("", UnicodeString("[\\u0380-\\u03CF]", ""), this); } void TransliteratorRoundTripTest::TestCyrillic() { RTTest test("Latin-Cyrillic", TestUtility::LATIN_SCRIPT, TestUtility::CYRILLIC_SCRIPT); - test.test("", "[\\u0401\\u0410-\\u044F\\u0451]", this); + test.test("", UnicodeString("[\\u0401\\u0410-\\u044F\\u0451]", ""), this); } diff --git a/icu4c/source/test/intltest/transtst.cpp b/icu4c/source/test/intltest/transtst.cpp index 9a2547f5b3..d3bdbb885e 100644 --- a/icu4c/source/test/intltest/transtst.cpp +++ b/icu4c/source/test/intltest/transtst.cpp @@ -420,12 +420,13 @@ void TransliteratorTest::TestCompoundHex(void) { delete b; return; } - + // Do some basic tests of a + expect(*a, "01", UnicodeString("\\u0030\\u0031", "")); // Do some basic tests of b expect(*b, UnicodeString("\\u0030\\u0031", ""), "01"); Transliterator* ab = new CompoundTransliterator(transab, 2); - UnicodeString s("abcde"); + UnicodeString s("abcde", ""); expect(*ab, s, s); UnicodeString str(s); @@ -592,7 +593,7 @@ void TransliteratorTest::TestJ243(void) { "abcd5fx0123"); // Try custom Unicode-Hex (default is tested elsewhere) status = U_ZERO_ERROR; - UnicodeToHexTransliterator hex3("&\\#x###0;", status); + UnicodeToHexTransliterator hex3(UnicodeString("&\\#x###0;", ""), status); expect(hex3, "012", "012"); #endif } diff --git a/icu4c/source/test/intltest/ufltlgts.cpp b/icu4c/source/test/intltest/ufltlgts.cpp index e3c27ff571..66aeef089f 100644 --- a/icu4c/source/test/intltest/ufltlgts.cpp +++ b/icu4c/source/test/intltest/ufltlgts.cpp @@ -69,12 +69,12 @@ void UnicodeFilterLogicTest::TestAll(){ UnicodeString source("abcdABCDyzYZ"); //sanity testing wihtout any filter - expect(*t1, "without any Filter", source, "\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A"); + expect(*t1, "without any Filter", source, UnicodeString("\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A", "")); //sanity testing using the Filter1(acAC) and Filter2(acyzYZ) t1->adoptFilter(new Filter1); - expect(*t1, "with Filter(acAC)", source, "a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A"); + expect(*t1, "with Filter(acAC)", source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A", "")); t1->adoptFilter(new Filter2); - expect(*t1, "with Filter2(acyzYZ)", source, "a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ"); + expect(*t1, "with Filter2(acyzYZ)", source, UnicodeString("a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ", "")); UnicodeFilter *filterNOT=UnicodeFilterLogic::createNot(new Filter1); @@ -82,81 +82,81 @@ void UnicodeFilterLogicTest::TestAll(){ UnicodeFilter *filterOR=UnicodeFilterLogic::createOr(new Filter1, new Filter2); TestNOT(*t1, new Filter1, "Filter(acAC)", - source, "\\u0061b\\u0063d\\u0041B\\u0043DyzYZ"); + source, UnicodeString("\\u0061b\\u0063d\\u0041B\\u0043DyzYZ", "")); TestNOT(*t1, new Filter2, "Filter(acyzYZ)", - source, "\\u0061b\\u0063dABCD\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("\\u0061b\\u0063dABCD\\u0079\\u007A\\u0059\\u005A", "")); TestNOT(*t1, NULL, "NULL", - source, "abcdABCDyzYZ"); + source, UnicodeString("abcdABCDyzYZ", "")); TestNOT(*t1, filterNOT, "FilterNOT(Fitler1(acAC))", - source, "a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A", "")); TestNOT(*t1, filterAND, "FilterAND(Fitler1(acAC), Filter2(acyzYZ))", - source, "\\u0061b\\u0063d\\u0041B\\u0043D\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("\\u0061b\\u0063d\\u0041B\\u0043D\\u0079\\u007A\\u0059\\u005A", "")); TestNOT(*t1, filterOR, "FilterOR(Fitler1(acAC), Filter2(acyzYZ))", - source, "\\u0061b\\u0063dABCDyzYZ"); + source, UnicodeString("\\u0061b\\u0063dABCDyzYZ", "")); TestAND(*t1, new Filter1, new Filter2, "Filter1(a,c,A,C), Filter2(acyzYZ)", - source, "a\\u0062c\\u0064A\\u0042C\\u0044yzYZ"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044yzYZ", "")); TestAND(*t1, new Filter2, new Filter1, "Filter2(acyzYZ), Filter1(a,c,A,C), ", - source, "a\\u0062c\\u0064A\\u0042C\\u0044yzYZ"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044yzYZ", "")); TestAND(*t1, new Filter1, NULL, "Filter1(a,c,A,C), NULL", - source, "a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A", "")); TestAND(*t1, NULL, new Filter2, "NULL, Filter2(acyzYZ)", - source, "a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ"); + source, UnicodeString("a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ", "")); TestAND(*t1, NULL, NULL, "NULL, NULL", - source, "\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A", "")); TestAND(*t1, filterAND, NULL, "FilterAND(Fitler1(acAC), Filter2(acyzYZ)), NULL", - source, "a\\u0062c\\u0064A\\u0042C\\u0044yzYZ"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044yzYZ", "")); TestAND(*t1, filterAND, new Filter1, "FilterAND(Fitler1(acAC), Filter2(acyzYZ)), Filter1(acAC)", - source, "a\\u0062c\\u0064A\\u0042C\\u0044yzYZ"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044yzYZ", "")); TestAND(*t1, filterAND, new Filter2, "FilterAND(Fitler1(acAC), Filter2(acyzYZ)), Filter2(acyzYZ)", - source, "a\\u0062c\\u0064A\\u0042C\\u0044yzYZ"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044yzYZ", "")); TestAND(*t1, new Filter1, filterAND, "Filter1(acAC), FilterAND(Filter1(acAC), Fitler1(acAC))", - source, "a\\u0062c\\u0064A\\u0042C\\u0044yzYZ"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044yzYZ", "")); TestAND(*t1, new Filter2, filterAND, "Filter2(acyzYZ), FilterAND(Filter1(acAC), Fitler1(acAC))", - source, "a\\u0062c\\u0064A\\u0042C\\u0044yzYZ"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044yzYZ", "")); TestAND(*t1, filterOR, NULL, "FilterOR(Fitler1(acAC), Filter2(acyzYZ)), NULL", - source, "a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A", "")); TestAND(*t1, filterOR, new Filter1, "FilterOR(Fitler1(acAC), Filter2(acyzYZ)), Fitler1(acAC)", - source, "a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A", "")); TestAND(*t1, filterOR, new Filter2, "FilterOR(Fitler1(acAC), Filter2(acyzYZ)), Fitler2(acyzYZ)", - source, "a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ"); + source, UnicodeString("a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ", "")); TestAND(*t1, filterNOT, new Filter1, "FilterNOT(Fitler1(acAC)), Fitler1(acAC)", - source, "abcdABCDyzYZ"); + source, UnicodeString("abcdABCDyzYZ", "")); TestAND(*t1, new Filter1, filterNOT, "Fitler1(acAC), FilterNOT(Fitler1(acAC))", - source, "abcdABCDyzYZ"); + source, UnicodeString("abcdABCDyzYZ", "")); TestAND(*t1, filterNOT, new Filter2, "FilterNOT(Fitler1(acAC)), Fitler2(acyzYZ)", - source, "abcd\\u0041B\\u0043DyzYZ"); + source, UnicodeString("abcd\\u0041B\\u0043DyzYZ", "")); TestAND(*t1, new Filter2, filterNOT, "Fitler2(acyzYZ), FilterNOT(Fitler1(acAC))", - source, "abcd\\u0041B\\u0043DyzYZ"); + source, UnicodeString("abcd\\u0041B\\u0043DyzYZ", "")); TestOR(*t1, new Filter1, new Filter2, "Filter1(a,c,A,C), Filter2(acyzYZ)", - source, "a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A", "")); TestOR(*t1, new Filter2, new Filter1, "Filter2(acyzYZ), Filter1(a,c,A,C)", - source, "a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A", "")); TestOR(*t1, new Filter1, NULL, "Filter1(a,c,A,C), NULL", - source, "a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A", "")); TestOR(*t1, NULL, new Filter2, "NULL, Filter2(acyzYZ)", - source, "a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ"); + source, UnicodeString("a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ", "")); TestOR(*t1, NULL, NULL, "NULL, NULL", - source, "\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A", "")); TestOR(*t1, filterAND, NULL, "FilterAND(Fitler1(acAC), Filter2(acyzYZ)), NULL", - source, "a\\u0062c\\u0064A\\u0042C\\u0044yzYZ"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044yzYZ", "")); TestOR(*t1, filterAND, new Filter1, "FilterAND(Fitler1(acAC), Filter2(acyzYZ)), Filter1(acAC)", - source, "a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A", "")); TestOR(*t1, filterAND, new Filter2, "FilterAND(Fitler1(acAC), Filter2(acyzYZ)), Filter2(acyzYZ)", - source, "a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ"); + source, UnicodeString("a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ", "")); TestOR(*t1, new Filter1, filterAND, "Filter1(acAC), FilterAND(Filter1(acAC), Fitler1(acAC))", - source, "a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("a\\u0062c\\u0064A\\u0042C\\u0044\\u0079\\u007A\\u0059\\u005A", "")); TestOR(*t1, new Filter2, filterAND, "Filter2(acyzYZ), FilterAND(Filter1(acAC), Fitler1(acAC))", - source, "a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ"); + source, UnicodeString("a\\u0062c\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ", "")); TestOR(*t1, filterNOT, new Filter1, "FilterNOT(Fitler1(acAC)), Fitler1(acAC)", - source, "\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A", "")); TestOR(*t1, new Filter1, filterNOT, "Fitler1(acAC), FilterNOT(Fitler1(acAC))", - source, "\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A"); + source, UnicodeString("\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044\\u0079\\u007A\\u0059\\u005A", "")); TestOR(*t1, filterNOT, new Filter2, "FilterNOT(Fitler1(acAC)), Fitler1(acyzYZ)", - source, "\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ"); + source, UnicodeString("\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ", "")); TestOR(*t1, new Filter2, filterNOT, "Fitler2(acyzYZ), FilterNOT(Fitler1(acAC))", - source, "\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ"); + source, UnicodeString("\\u0061\\u0062\\u0063\\u0064\\u0041\\u0042\\u0043\\u0044yzYZ", "")); delete filterNOT; diff --git a/icu4c/source/test/intltest/unhxtrts.cpp b/icu4c/source/test/intltest/unhxtrts.cpp index 5dcd118b15..67976d56e2 100644 --- a/icu4c/source/test/intltest/unhxtrts.cpp +++ b/icu4c/source/test/intltest/unhxtrts.cpp @@ -213,9 +213,9 @@ void UniToHexTransliteratorTest::TestUpperCase(){ errln("UnicodeToHexTransliterator construction failed"); return; } - expect(*transdefault, "where uppercase=default", str, UnicodeString("\\u0061\\u0062\\u006B")); + expect(*transdefault, "where uppercase=default", str, UnicodeString("\\u0061\\u0062\\u006B", "")); - UnicodeString pattern("\\\\u0000"); + UnicodeString pattern("\\\\u0000", ""); /*transliterator with Uppercase FALSE*/ UnicodeToHexTransliterator *trans1=new UnicodeToHexTransliterator(pattern, FALSE, NULL, status); if(U_FAILURE(status) && status==U_ILLEGAL_ARGUMENT_ERROR){ @@ -223,7 +223,7 @@ void UniToHexTransliteratorTest::TestUpperCase(){ status=U_ZERO_ERROR; return; } - expect(*trans1, "where uppercase=FALSE", str, UnicodeString("\\u0061\\u0062\\u006b")); /*doesn't display uppercase*/ + expect(*trans1, "where uppercase=FALSE", str, UnicodeString("\\u0061\\u0062\\u006b", "")); /*doesn't display uppercase*/ if(transdefault->isUppercase() != TRUE || trans1->isUppercase() != FALSE ){ errln("isUpperCase() failed"); @@ -234,7 +234,7 @@ void UniToHexTransliteratorTest::TestUpperCase(){ errln("setUppercase() failed"); } /*doesn't ouput uppercase hex, since transdefault's uppercase is set to FALSE using setUppercase*/ - expect(*transdefault, "where uppercase=FALSE", str, UnicodeString("\\u0061\\u0062\\u006b")); + expect(*transdefault, "where uppercase=FALSE", str, UnicodeString("\\u0061\\u0062\\u006b", "")); /*trying round trip*/ transdefault->setUppercase(TRUE); @@ -242,7 +242,7 @@ void UniToHexTransliteratorTest::TestUpperCase(){ errln("setUppercase() failed"); } /*displays upper case since it is set to TRUE*/ - expect(*transdefault, "where uppercase=TRUE", str, UnicodeString("\\u0061\\u0062\\u006B")); + expect(*transdefault, "where uppercase=TRUE", str, UnicodeString("\\u0061\\u0062\\u006B", "")); delete transdefault; delete trans1; @@ -259,7 +259,7 @@ void UniToHexTransliteratorTest::TestPattern(){ } UnicodeString defaultpattern=transdefault->toPattern(); - UnicodeString pattern1("\\\\U+0000"); + UnicodeString pattern1("\\\\U+0000", ""); UnicodeToHexTransliterator *trans1=new UnicodeToHexTransliterator(pattern1, TRUE, NULL, status); if(U_FAILURE(status) && status==U_ILLEGAL_ARGUMENT_ERROR){ errln("UnicodeToHexTransliterator construction failed with pattern =" + pattern1); @@ -268,21 +268,21 @@ void UniToHexTransliteratorTest::TestPattern(){ } /*test toPattern() */ if(transdefault->toPattern() == trans1->toPattern() || - transdefault->toPattern() != UnicodeString("\\\\u0000") || + transdefault->toPattern() != UnicodeString("\\\\u0000", "") || trans1->toPattern() != pattern1 ){ errln("Error: toPattern() failed"); } /*apply patterns for transdefault*/ UnicodeString str("abKf"); - expectPattern(*transdefault, pattern1, str, "\\U+0061\\U+0062\\U+004B\\U+0066"); - expectPattern(*transdefault, "\\U##00,", str, "U61,U62,U4B,U66,"); - expectPattern(*transdefault, defaultpattern, str, "\\u0061\\u0062\\u004B\\u0066"); - expectPattern(*trans1, "\\uni0000", str, "uni0061uni0062uni004Buni0066"); - expectPattern(*trans1, "\\\\S-0000-E", str, "\\S-0061-E\\S-0062-E\\S-004B-E\\S-0066-E"); - expectPattern(*trans1, "\\u##0000", str, "FAIL"); - expectPattern(*trans1, "\\*0000", str, "*0061*0062*004B*0066"); - expectPattern(*trans1, "\\u####", str, "FAIL"); + expectPattern(*transdefault, pattern1, str, UnicodeString("\\U+0061\\U+0062\\U+004B\\U+0066", "")); + expectPattern(*transdefault, UnicodeString("\\U##00,", ""), str, UnicodeString("U61,U62,U4B,U66,", "")); + expectPattern(*transdefault, defaultpattern, str, UnicodeString("\\u0061\\u0062\\u004B\\u0066", "")); + expectPattern(*trans1, UnicodeString("\\uni0000", ""), str, UnicodeString("uni0061uni0062uni004Buni0066", "")); + expectPattern(*trans1, UnicodeString("\\\\S-0000-E", ""), str, UnicodeString("\\S-0061-E\\S-0062-E\\S-004B-E\\S-0066-E", "")); + expectPattern(*trans1, UnicodeString("\\u##0000", ""), str, UnicodeString("FAIL", "")); + expectPattern(*trans1, UnicodeString("\\*0000", ""), str, UnicodeString("*0061*0062*004B*0066", "")); + expectPattern(*trans1, UnicodeString("\\u####", ""), str, UnicodeString("FAIL", "")); delete trans1; delete transdefault; @@ -290,7 +290,7 @@ void UniToHexTransliteratorTest::TestPattern(){ } void UniToHexTransliteratorTest::TestSimpleTransliterate(){ UErrorCode status=U_ZERO_ERROR; - UnicodeString pattern1("\\\\U+0000"); + UnicodeString pattern1("\\\\U+0000", ""); UnicodeToHexTransliterator *trans1=new UnicodeToHexTransliterator(pattern1, TRUE, NULL, status); if(U_FAILURE(status) && status==U_ILLEGAL_ARGUMENT_ERROR){ errln("UnicodeToHexTransliterator construction failed with pattern =" + pattern1); @@ -300,7 +300,7 @@ void UniToHexTransliteratorTest::TestSimpleTransliterate(){ UTransPosition index={1,5,2,5}; UnicodeString source("Hello"); UnicodeString rsource(source); - UnicodeString expected("He\\U+006C\\U+006C\\U+006F"); + UnicodeString expected("He\\U+006C\\U+006C\\U+006F", ""); trans1->handleTransliterate(rsource, index, FALSE); expectAux(trans1->getID() + ":handleTransliterator ", source + "-->" + rsource, rsource==expected, expected); delete trans1; @@ -310,12 +310,12 @@ void UniToHexTransliteratorTest::TestTransliterate(){ UErrorCode status=U_ZERO_ERROR; UnicodeString Data[]={ //pattern, source, index.contextStart, index.contextLimit, index.start, expectedResult, expectedResult using filter(a, b) - (UnicodeString)"U+##00", (UnicodeString)"abc", "1", "3", "2", (UnicodeString)"abU+63", (UnicodeString)"abc", - (UnicodeString)"\\\\u0000", (UnicodeString)"abc", "1", "2", "1", (UnicodeString)"a\\u0062c", (UnicodeString)"a\\u0062c", - (UnicodeString)"Uni0000", (UnicodeString)"abc", "1", "3", "2", (UnicodeString)"abUni0063", (UnicodeString)"abc", - (UnicodeString)"U[0000]", (UnicodeString)"hello", "0", "4", "2", (UnicodeString)"heU[006C]U[006C]o", (UnicodeString)"heU[006C]U[006C]o", - (UnicodeString)"prefix-0000-suffix", (UnicodeString)"abc", "1", "3", "1", (UnicodeString)"aprefix-0062-suffixprefix-0063-suffix", (UnicodeString)"aprefix-0062-suffixc", - (UnicodeString)"*##00*", (UnicodeString)"hellothere", "1", "8", "4", (UnicodeString)"hell*6F**74**68**65*re", (UnicodeString)"hell*6F**74**68**65*re", + UnicodeString("U+##00", ""), UnicodeString("abc", ""), "1", "3", "2", UnicodeString("abU+63", ""), UnicodeString("abc", ""), + UnicodeString("\\\\u0000", ""), UnicodeString("abc", ""), "1", "2", "1", UnicodeString("a\\u0062c", ""), UnicodeString("a\\u0062c", ""), + UnicodeString("Uni0000", ""), UnicodeString("abc", ""), "1", "3", "2", UnicodeString("abUni0063", ""), UnicodeString("abc", ""), + UnicodeString("U[0000]", ""), UnicodeString("hello", ""), "0", "4", "2", UnicodeString("heU[006C]U[006C]o", ""), UnicodeString("heU[006C]U[006C]o", ""), + UnicodeString("prefix-0000-suffix", ""), UnicodeString("abc", ""), "1", "3", "1", UnicodeString("aprefix-0062-suffixprefix-0063-suffix", ""), UnicodeString("aprefix-0062-suffixc", ""), + UnicodeString("*##00*", ""), UnicodeString("hellothere", ""), "1", "8", "4", UnicodeString("hell*6F**74**68**65*re", ""), UnicodeString("hell*6F**74**68**65*re", ""), }; int i; diff --git a/icu4c/source/test/intltest/usettest.cpp b/icu4c/source/test/intltest/usettest.cpp index 5a87611154..3684fa027c 100644 --- a/icu4c/source/test/intltest/usettest.cpp +++ b/icu4c/source/test/intltest/usettest.cpp @@ -46,12 +46,12 @@ UnicodeSetTest::runIndexedTest(int32_t index, UBool exec, void UnicodeSetTest::TestPatterns(void) { UnicodeSet set; - expectPattern(set, "[[a-m]&[d-z]&[k-y]]", "km"); - expectPattern(set, "[[a-z]-[m-y]-[d-r]]", "aczz"); - expectPattern(set, "[a\\-z]", "--aazz"); - expectPattern(set, "[-az]", "--aazz"); - expectPattern(set, "[az-]", "--aazz"); - expectPattern(set, "[[[a-z]-[aeiou]i]]", "bdfnptvz"); + expectPattern(set, UnicodeString("[[a-m]&[d-z]&[k-y]]", ""), "km"); + expectPattern(set, UnicodeString("[[a-z]-[m-y]-[d-r]]", ""), "aczz"); + expectPattern(set, UnicodeString("[a\\-z]", ""), "--aazz"); + expectPattern(set, UnicodeString("[-az]", ""), "--aazz"); + expectPattern(set, UnicodeString("[az-]", ""), "--aazz"); + expectPattern(set, UnicodeString("[[[a-z]-[aeiou]i]]", ""), "bdfnptvz"); // Throw in a test of complement set.complement();