diff --git a/icu4c/source/test/cintltst/capitst.c b/icu4c/source/test/cintltst/capitst.c index 1f7f5e2f36..f6e0723fbc 100644 --- a/icu4c/source/test/cintltst/capitst.c +++ b/icu4c/source/test/cintltst/capitst.c @@ -12,7 +12,6 @@ * Madhu Katragadda Ported for C API ********************************************************************************* *//* C API TEST For COLLATOR */ -#include #include "unicode/utypes.h" #include "ucol_imp.h" #include "unicode/uloc.h" @@ -20,10 +19,13 @@ #include "capitst.h" #include "unicode/ustring.h" #include "unicode/ures.h" +#include "unicode/ucoleitr.h" #include "cmemory.h" #include "cstring.h" #include "ccolltst.h" +#include +static void TestAttribute(void); void addCollAPITest(TestNode** root) { @@ -42,6 +44,8 @@ void addCollAPITest(TestNode** root) addTest(root, &TestBounds, "tscoll/capitst/TestBounds"); addTest(root, &TestGetLocale, "tscoll/capitst/TestGetLocale"); addTest(root, &TestSortKeyBufferOverrun, "tscoll/capitst/TestSortKeyBufferOverrun"); + addTest(root, &TestAttribute, "tscoll/capitst/TestAttribute"); + } void TestGetSetAttr(void) { @@ -178,6 +182,7 @@ void TestGetDefaultRules(){ } #endif +#ifdef U_USE_DEPRECATED_UCOL_API /* * Test ucol_openVersion for some locale. Called by TestProperty(). */ @@ -207,6 +212,7 @@ TestOpenVersion(const char *locale) { } } } +#endif /* Collator Properties ucol_open, ucol_strcoll, getStrength/setStrength @@ -289,11 +295,13 @@ void TestProperty() doAssert( (ucol_getStrength(col) != UCOL_PRIMARY), "collation object's strength is primary difference"); doAssert( (ucol_getStrength(col) == UCOL_SECONDARY), "collation object has the wrong strength"); +#ifdef ICU_NORMALIZER_USE_DEPRECATES log_verbose("testing ucol_setDecomposition() method ...\n"); ucol_setNormalization(col, UNORM_NONE); doAssert( (ucol_getNormalization(col) != UNORM_NFC), "collation object's normalization mode is Canonical decomposition followed by canonical composition"); doAssert( (ucol_getNormalization(col) != UNORM_NFD), "collation object's normalization mode is canonical decomposition"); doAssert( (ucol_getNormalization(col) == UNORM_NONE), "collation object has the wrong normalization mode"); +#endif log_verbose("Get display name for the default collation in German : \n"); @@ -368,6 +376,7 @@ void TestProperty() } log_verbose("Default collation getDisplayName ended.\n"); +#ifdef U_USE_DEPRECATED_UCOL_API /* test ucol_openVersion */ TestOpenVersion(""); TestOpenVersion("da"); @@ -384,6 +393,7 @@ void TestProperty() log_err("error: ucol_openVersion(bogus version) succeeded\n"); ucol_close(col); } +#endif } /* Test RuleBasedCollator and getRules*/ @@ -566,6 +576,27 @@ void TestDecomposition() { return; } + if (ucol_getAttribute(vi_VN, UCOL_NORMALIZATION_MODE, &status) != UCOL_ON || + U_FAILURE(status)) + { + log_err("ERROR: vi_VN collation did not have cannonical decomposition for normalization!\n"); + } + + status = U_ZERO_ERROR; + if (ucol_getAttribute(el_GR, UCOL_NORMALIZATION_MODE, &status) != UCOL_ON || + U_FAILURE(status)) + { + log_err("ERROR: el_GR collation did not have cannonical decomposition for normalization!\n"); + } + + status = U_ZERO_ERROR; + if (ucol_getAttribute(en_US, UCOL_NORMALIZATION_MODE, &status) != UCOL_OFF || + U_FAILURE(status)) + { + log_err("ERROR: en_US collation had cannonical decomposition for normalization!\n"); + } + +#ifdef ICU_NORMALIZER_USE_DEPRECATES /* there is no reason to have canonical decomposition in en_US OR default locale */ if(ucol_getNormalization(vi_VN) != UNORM_NFD) { @@ -581,6 +612,7 @@ void TestDecomposition() { { log_err("ERROR: en_US collation had cannonical decomposition for normalization!\n"); } +#endif ucol_close(en_US); ucol_close(el_GR); @@ -658,7 +690,7 @@ void TestSafeClone() { if (col) ucol_close(col); /* size one byte too small - should allocate & let us know */ --bufferSize; - if (0 == (col = ucol_safeClone(someCollators[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_ERROR) + if (0 == (col = ucol_safeClone(someCollators[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_WARNING) { log_err("FAIL: Cloned Collator failed to deal correctly with too-small buffer size\n"); } @@ -668,7 +700,7 @@ void TestSafeClone() { /* Null buffer pointer - return Collator & set error to U_SAFECLONE_ALLOCATED_ERROR */ - if (0 == (col = ucol_safeClone(someCollators[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_ERROR) + if (0 == (col = ucol_safeClone(someCollators[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_WARNING) { log_err("FAIL: Cloned Collator failed to deal correctly with null buffer pointer\n"); } @@ -921,7 +953,7 @@ void TestElemIter() UErrorCode status = U_ZERO_ERROR; log_verbose("testing UCollatorElements begins...\n"); col = ucol_open("en_US", &status); - ucol_setNormalization(col, UNORM_NONE); + ucol_setAttribute(col, UCOL_NORMALIZATION_MODE, UCOL_OFF, &status); if (U_FAILURE(status)) { log_err("ERROR: Default collation creation failed.: %s\n", myErrorName(status)); return; @@ -1363,3 +1395,105 @@ void TestSortKeyBufferOverrun(void) { ucol_close(coll); } +static void TestAttribute() +{ + UErrorCode error = U_ZERO_ERROR; + UCollator *coll = ucol_open(NULL, &error); + + if (U_FAILURE(error)) { + log_err("Creation of default collator failed"); + return; + } + + ucol_setAttribute(coll, UCOL_FRENCH_COLLATION, UCOL_OFF, &error); + if (ucol_getAttribute(coll, UCOL_FRENCH_COLLATION, &error) != UCOL_OFF || + U_FAILURE(error)) { + log_err("Setting and retrieving of the french collation failed"); + } + + ucol_setAttribute(coll, UCOL_FRENCH_COLLATION, UCOL_ON, &error); + if (ucol_getAttribute(coll, UCOL_FRENCH_COLLATION, &error) != UCOL_ON || + U_FAILURE(error)) { + log_err("Setting and retrieving of the french collation failed"); + } + + ucol_setAttribute(coll, UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, &error); + if (ucol_getAttribute(coll, UCOL_ALTERNATE_HANDLING, &error) != UCOL_SHIFTED || + U_FAILURE(error)) { + log_err("Setting and retrieving of the alternate handling failed"); + } + + ucol_setAttribute(coll, UCOL_ALTERNATE_HANDLING, UCOL_NON_IGNORABLE, &error); + if (ucol_getAttribute(coll, UCOL_ALTERNATE_HANDLING, &error) != UCOL_NON_IGNORABLE || + U_FAILURE(error)) { + log_err("Setting and retrieving of the alternate handling failed"); + } + + ucol_setAttribute(coll, UCOL_CASE_FIRST, UCOL_LOWER_FIRST, &error); + if (ucol_getAttribute(coll, UCOL_CASE_FIRST, &error) != UCOL_LOWER_FIRST || + U_FAILURE(error)) { + log_err("Setting and retrieving of the case first attribute failed"); + } + + ucol_setAttribute(coll, UCOL_CASE_FIRST, UCOL_UPPER_FIRST, &error); + if (ucol_getAttribute(coll, UCOL_CASE_FIRST, &error) != UCOL_UPPER_FIRST || + U_FAILURE(error)) { + log_err("Setting and retrieving of the case first attribute failed"); + } + + ucol_setAttribute(coll, UCOL_CASE_LEVEL, UCOL_ON, &error); + if (ucol_getAttribute(coll, UCOL_CASE_LEVEL, &error) != UCOL_ON || + U_FAILURE(error)) { + log_err("Setting and retrieving of the case level attribute failed"); + } + + ucol_setAttribute(coll, UCOL_CASE_LEVEL, UCOL_OFF, &error); + if (ucol_getAttribute(coll, UCOL_CASE_LEVEL, &error) != UCOL_OFF || + U_FAILURE(error)) { + log_err("Setting and retrieving of the case level attribute failed"); + } + + ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_ON, &error); + if (ucol_getAttribute(coll, UCOL_NORMALIZATION_MODE, &error) != UCOL_ON || + U_FAILURE(error)) { + log_err("Setting and retrieving of the normalization on/off attribute failed"); + } + + ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_OFF, &error); + if (ucol_getAttribute(coll, UCOL_NORMALIZATION_MODE, &error) != UCOL_OFF || + U_FAILURE(error)) { + log_err("Setting and retrieving of the normalization on/off attribute failed"); + } + + ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_PRIMARY, &error); + if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_PRIMARY || + U_FAILURE(error)) { + log_err("Setting and retrieving of the collation strength failed"); + } + + ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_SECONDARY, &error); + if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_SECONDARY || + U_FAILURE(error)) { + log_err("Setting and retrieving of the collation strength failed"); + } + + ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_TERTIARY, &error); + if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_TERTIARY || + U_FAILURE(error)) { + log_err("Setting and retrieving of the collation strength failed"); + } + + ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_QUATERNARY, &error); + if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_QUATERNARY || + U_FAILURE(error)) { + log_err("Setting and retrieving of the collation strength failed"); + } + + ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_IDENTICAL, &error); + if (ucol_getAttribute(coll, UCOL_STRENGTH, &error) != UCOL_IDENTICAL || + U_FAILURE(error)) { + log_err("Setting and retrieving of the collation strength failed"); + } + + ucol_close(coll); +} diff --git a/icu4c/source/test/cintltst/cbiapts.c b/icu4c/source/test/cintltst/cbiapts.c index 9f5c64e594..7282b4860e 100644 --- a/icu4c/source/test/cintltst/cbiapts.c +++ b/icu4c/source/test/cintltst/cbiapts.c @@ -371,7 +371,7 @@ static void TestBreakIteratorSafeClone(void) ubrk_close(brk); /* size one byte too small - should allocate & let us know */ --bufferSize; - if (0 == (brk = ubrk_safeClone(someIterators[i], 0, &bufferSize, &status)) || status != U_SAFECLONE_ALLOCATED_ERROR) + if (0 == (brk = ubrk_safeClone(someIterators[i], 0, &bufferSize, &status)) || status != U_SAFECLONE_ALLOCATED_WARNING) { log_err("FAIL: Cloned Iterator failed to deal correctly with too-small buffer size\n"); } @@ -381,7 +381,7 @@ static void TestBreakIteratorSafeClone(void) bufferSize = U_BRK_SAFECLONE_BUFFERSIZE; /* Null buffer pointer - return Iterator & set error to U_SAFECLONE_ALLOCATED_ERROR */ - if (0 == (brk = ubrk_safeClone(someIterators[i], 0, &bufferSize, &status)) || status != U_SAFECLONE_ALLOCATED_ERROR) + if (0 == (brk = ubrk_safeClone(someIterators[i], 0, &bufferSize, &status)) || status != U_SAFECLONE_ALLOCATED_WARNING) { log_err("FAIL: Cloned Iterator failed to deal correctly with null buffer pointer\n"); } @@ -399,7 +399,7 @@ static void TestBreakIteratorSafeClone(void) if (U_FAILURE(status) || brk == 0) { log_err("FAIL: Cloned Iterator failed with misaligned buffer pointer\n"); } - if (status == U_SAFECLONE_ALLOCATED_ERROR) { + if (status == U_SAFECLONE_ALLOCATED_WARNING) { log_err("FAIL: Cloned Iterator allocated when using a mis-aligned buffer.\n"); } offset = (int32_t)((char *)&p-(char*)brk); diff --git a/icu4c/source/test/cintltst/ccapitst.c b/icu4c/source/test/cintltst/ccapitst.c index 80bc641589..3ff0c2bddc 100644 --- a/icu4c/source/test/cintltst/ccapitst.c +++ b/icu4c/source/test/cintltst/ccapitst.c @@ -1546,7 +1546,7 @@ static void TestConvertSafeClone() ucnv_close(cnv); /* size one byte too small - should allocate & let us know */ --bufferSize; - if (0 == (cnv = ucnv_safeClone(someConverters[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_ERROR) + if (0 == (cnv = ucnv_safeClone(someConverters[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_WARNING) { log_err("FAIL: Cloned converter failed to deal correctly with too-small buffer size\n"); } @@ -1556,7 +1556,7 @@ static void TestConvertSafeClone() bufferSize = U_CNV_SAFECLONE_BUFFERSIZE; /* Null buffer pointer - return converter & set error to U_SAFECLONE_ALLOCATED_ERROR */ - if (0 == (cnv = ucnv_safeClone(someConverters[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_ERROR) + if (0 == (cnv = ucnv_safeClone(someConverters[0], 0, &bufferSize, &err)) || err != U_SAFECLONE_ALLOCATED_WARNING) { log_err("FAIL: Cloned converter failed to deal correctly with null buffer pointer\n"); } diff --git a/icu4c/source/test/cintltst/cdetst.c b/icu4c/source/test/cintltst/cdetst.c index 9d2589933d..6daf1bb86a 100644 --- a/icu4c/source/test/cintltst/cdetst.c +++ b/icu4c/source/test/cintltst/cdetst.c @@ -104,7 +104,7 @@ static void TestTertiary( ) return; } log_verbose("Testing German Collation with Tertiary strength\n"); - ucol_setNormalization(myCollation, UNORM_NFC); + ucol_setAttribute(myCollation, UCOL_NORMALIZATION_MODE, UCOL_ON, &status); ucol_setStrength(myCollation, UCOL_TERTIARY); for (i = 0; i < 12 ; i++) { diff --git a/icu4c/source/test/cintltst/citertst.h b/icu4c/source/test/cintltst/citertst.h index f75cfc8631..fae48474fa 100644 --- a/icu4c/source/test/cintltst/citertst.h +++ b/icu4c/source/test/cintltst/citertst.h @@ -23,6 +23,7 @@ #include "cintltst.h" #include "unicode/utypes.h" #include "unicode/ucol.h" +#include "unicode/ucoleitr.h" #define MAX_TOKEN_LEN 16 diff --git a/icu4c/source/test/cintltst/cmsccoll.c b/icu4c/source/test/cintltst/cmsccoll.c index cb77b52d38..3c6036a062 100644 --- a/icu4c/source/test/cintltst/cmsccoll.c +++ b/icu4c/source/test/cintltst/cmsccoll.c @@ -2196,7 +2196,7 @@ static void TestIncrementalNormalize(void) { strB = malloc((maxSLen+1) * sizeof(UChar)); coll = ucol_open("en_US", &status); - ucol_setNormalization(coll, UNORM_NFD); + ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, UCOL_ON, &status); /* for (sLen = 4; sLen"); + for(n=0;result2[n];n++) + { + log_verbose("%04X ",result2[n]); + } + log_verbose("<\n"); + + log_verbose("\nWant>"); + for(n=0;temp[n];n++) + { + log_verbose("%04X ",temp[n]); + } + log_verbose("<\n"); + + } log_verbose("for string_in_Root_te_te_IN, default.txt had %s\n", austrdup(result1)); log_verbose("for string_in_Root_te_te_IN, te_IN.txt had %s\n", austrdup(result2)); @@ -186,6 +215,7 @@ void TestConstruction1() ures_close(test2); } +#ifdef ICU_URES_USE_DEPRECATES void TestConstruction2() { int n; @@ -244,6 +274,7 @@ void TestConstruction2() ures_close(test4); } +#endif /*****************************************************************************/ /*****************************************************************************/ @@ -325,9 +356,9 @@ UBool testTag(const char* frag, if(j == actual_bundle) /* it's in the same bundle OR it's a nonexistent=default bundle (5) */ expected_resource_status = U_ZERO_ERROR; else if(j == 0) - expected_resource_status = U_USING_DEFAULT_ERROR; + expected_resource_status = U_USING_DEFAULT_WARNING; else - expected_resource_status = U_USING_FALLBACK_ERROR; + expected_resource_status = U_USING_FALLBACK_WARNING; log_verbose("%s[%d]::%s: in<%d:%s> inherits<%d:%s>. actual_bundle=%s\n", param[i].name, @@ -458,7 +489,7 @@ static void TestFallback() /* OK first one. This should be a Default value. */ junk = ures_getStringByKey(fr_FR, "%%PREEURO", &resultLen, &status); - if(status != U_USING_DEFAULT_ERROR) + if(status != U_USING_DEFAULT_WARNING) { log_err("Expected U_USING_DEFAULT_ERROR when trying to get %%PREEURO from fr_FR, got %s\n", u_errorName(status)); @@ -468,7 +499,7 @@ static void TestFallback() /* and this is a Fallback, to fr */ junk = ures_getStringByKey(fr_FR, "DayNames", &resultLen, &status); - if(status != U_USING_FALLBACK_ERROR) + if(status != U_USING_FALLBACK_WARNING) { log_err("Expected U_USING_FALLBACK_ERROR when trying to get DayNames from fr_FR, got %s\n", u_errorName(status)); @@ -523,7 +554,7 @@ TestOpenDirect(void) { /* now make sure that "translit_index" will not work with ures_open() */ errorCode=U_ZERO_ERROR; translit_index=ures_open(NULL, "translit_index", &errorCode); - if(U_FAILURE(errorCode) || errorCode==U_USING_DEFAULT_ERROR || errorCode==U_USING_FALLBACK_ERROR) { + if(U_FAILURE(errorCode) || errorCode==U_USING_DEFAULT_WARNING || errorCode==U_USING_FALLBACK_WARNING) { /* falling back to default or root is ok */ errorCode=U_ZERO_ERROR; } else if(0!=uprv_strcmp("translit_INDEX", ures_getLocale(translit_index, &errorCode))) { diff --git a/icu4c/source/test/cintltst/creststn.c b/icu4c/source/test/cintltst/creststn.c index b9788a0fb4..fdf0c1fee9 100644 --- a/icu4c/source/test/cintltst/creststn.c +++ b/icu4c/source/test/cintltst/creststn.c @@ -146,12 +146,12 @@ param[] = /* "IN" means inherits */ /* "NE" or "ne" means "does not exist" */ - { "root", U_ZERO_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }, - { "te", U_ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, - { "te_IN", U_ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, - { "te_NE", U_USING_FALLBACK_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, - { "te_IN_NE", U_USING_FALLBACK_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, - { "ne", U_USING_DEFAULT_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } } + { "root", U_ZERO_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }, + { "te", U_ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, + { "te_IN", U_ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, + { "te_NE", U_USING_FALLBACK_WARNING, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, + { "te_IN_NE", U_USING_FALLBACK_WARNING, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, + { "ne", U_USING_DEFAULT_WARNING, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } } }; static int32_t bundles_count = sizeof(param) / sizeof(param[0]); @@ -168,7 +168,6 @@ void addNEWResourceBundleTest(TestNode** root) { addTest(root, &TestEmptyBundle, "tsutil/creststn/TestEmptyBundle"); addTest(root, &TestConstruction1, "tsutil/creststn/TestConstruction1"); - addTest(root, &TestConstruction2, "tsutil/creststn/TestConstruction2"); addTest(root, &TestResourceBundles, "tsutil/creststn/TestResourceBundle"); addTest(root, &TestFallback, "tsutil/creststn/TestFallback"); addTest(root, &TestGetVersion, "tsutil/creststn/TestGetVersion"); @@ -181,6 +180,10 @@ void addNEWResourceBundleTest(TestNode** root) addTest(root, &TestDecodedBundle, "tsutil/creststn/TestDecodedBundle"); addTest(root, &TestResourceLevelAliasing, "tsutil/creststn/TestResourceLevelAliasing"); addTest(root, &TestDirectAccess, "tsutil/creststn/TestDirectAccess"); + +#ifdef ICU_URES_USE_DEPRECATES + addTest(root, &TestConstruction2, "tsutil/creststn/TestConstruction2"); +#endif } @@ -1134,6 +1137,7 @@ static void TestConstruction1() } +#ifdef ICU_URES_USE_DEPRECATES static void TestConstruction2() { @@ -1184,6 +1188,7 @@ static void TestConstruction2() ures_close(test4); } +#endif /*****************************************************************************/ /*****************************************************************************/ @@ -1266,9 +1271,9 @@ static UBool testTag(const char* frag, if(j == actual_bundle) /* it's in the same bundle OR it's a nonexistent=default bundle (5) */ expected_resource_status = U_ZERO_ERROR; else if(j == 0) - expected_resource_status = U_USING_DEFAULT_ERROR; + expected_resource_status = U_USING_DEFAULT_WARNING; else - expected_resource_status = U_USING_FALLBACK_ERROR; + expected_resource_status = U_USING_FALLBACK_WARNING; log_verbose("%s[%d]::%s: in<%d:%s> inherits<%d:%s>. actual_bundle=%s\n", param[i].name, @@ -1653,7 +1658,7 @@ static void TestFallback() /* OK first one. This should be a Default value. */ junk = ures_getStringByKey(fr_FR, "%%PREEURO", &resultLen, &status); - if(status != U_USING_DEFAULT_ERROR) + if(status != U_USING_DEFAULT_WARNING) { log_err("Expected U_USING_DEFAULT_ERROR when trying to get %%PREEURO from fr_FR, got %s\n", u_errorName(status)); @@ -1663,7 +1668,7 @@ static void TestFallback() /* and this is a Fallback, to fr */ junk = ures_getStringByKey(fr_FR, "DayNames", &resultLen, &status); - if(status != U_USING_FALLBACK_ERROR) + if(status != U_USING_FALLBACK_WARNING) { log_err("Expected U_USING_FALLBACK_ERROR when trying to get DayNames from fr_FR, got %d\n", status); @@ -1687,7 +1692,7 @@ static void TestFallback() log_err("Expected LocaleID=814, but got 0x%X\n", ures_getInt(resLocID, &err)); } tResB = ures_getByKey(myResB, "DayNames", NULL, &err); - if(err != U_USING_FALLBACK_ERROR){ + if(err != U_USING_FALLBACK_WARNING){ log_err("Expected U_USING_FALLBACK_ERROR when trying to test no_NO_NY aliased with nn_NO_NY for DayNames err=%s\n",u_errorName(err)); } ures_close(resLocID); diff --git a/icu4c/source/test/cintltst/ctstdep.c b/icu4c/source/test/cintltst/ctstdep.c index 19a92f1762..f6bb20d8c0 100644 --- a/icu4c/source/test/cintltst/ctstdep.c +++ b/icu4c/source/test/cintltst/ctstdep.c @@ -20,10 +20,6 @@ ********************************************************************************* */ -#ifndef U_USE_DEPRECATED_FORMAT_API -#define U_USE_DEPRECATED_FORMAT_API 1 -#endif - #include "unicode/unum.h" #include "unicode/ucol.h" #include "unicode/udat.h" @@ -72,13 +68,18 @@ void addTestDeprecatedAPI(TestNode** root); void addTestDeprecatedAPI(TestNode** root) { - addTest(root, &TestDeprecatedCollationAPI, "ctstdep/TestDeprecatedCollationAPI"); - addTest(root, &TestDeprecatedNumFmtAPI, "ctstdep/TestDeprecatedNumFmtAPI"); - addTest(root, &TestDeprecatedDateFmtAPI, "ctstdep/TestDeprecatedDateFmtAPI"); - addTest(root, &TestDeprecatedDateFmtAPI, "ctstdep/TestDeprecatedUErrorCode"); - addTest(root, &TestDeprecatedDateFmtAPI, "ctstdep/TestDeprecatedUCharScript"); +#ifdef U_USE_DEPRECATED_UCOL_API + addTest(root, &TestDeprecatedCollationAPI, "ctstdep/TestDeprecatedCollationAPI"); +#endif +#ifdef U_USE_DEPRECATED_FORMAT_API + addTest(root, &TestDeprecatedNumFmtAPI, "ctstdep/TestDeprecatedNumFmtAPI"); + addTest(root, &TestDeprecatedDateFmtAPI, "ctstdep/TestDeprecatedDateFmtAPI"); + addTest(root, &TestDeprecatedUErrorCode, "ctstdep/TestDeprecatedUErrorCode"); + addTest(root, &TestDeprecatedUCharScript, "ctstdep/TestDeprecatedUCharScript"); +#endif } +#ifdef U_USE_DEPRECATED_UCOL_API /* *TODO: The ucol_openRules method which does not take UParseError as one of its params * has been deprecated in 2.0 release.Please remove this API by 10/1/2002 @@ -141,7 +142,9 @@ TestDeprecatedCollationAPI(void) ucol_close(coll); } +#endif +#ifdef U_USE_DEPRECATED_FORMAT_API /* *TODO: The unum_open,unum_applyPattern, which does not take UParseError as one of their params *and unum_openPattern methods have been deprecated in 2.0 release.Please remove this API by 10/1/2002 @@ -513,3 +516,4 @@ TestDeprecatedUErrorCode(void){ log_err("U_USING_FALLBACK_WARNING != U_USING_FALLBACK_ERROR"); } } +#endif diff --git a/icu4c/source/test/cintltst/cucdtst.c b/icu4c/source/test/cintltst/cucdtst.c index fc76bc51ac..8c1dcb5e42 100644 --- a/icu4c/source/test/cintltst/cucdtst.c +++ b/icu4c/source/test/cintltst/cucdtst.c @@ -40,6 +40,9 @@ static void TestMisc(void); static void TestControlPrint(void); static void TestIdentifier(void); static void TestUnicodeData(void); +static void TestCodeUnit(void); +static void TestCodePoint(void); +static void TestCharLength(void); static void TestStringCopy(void); static void TestStringFunctions(void); static void TestStringSearching(void); @@ -126,6 +129,9 @@ void addUnicodeTest(TestNode** root); void addUnicodeTest(TestNode** root) { addTest(root, &TestUnicodeData, "tsutil/cucdtst/TestUnicodeData"); + addTest(root, &TestCodeUnit, "tsutil/cucdtst/TestCodeUnit"); + addTest(root, &TestCodePoint, "tsutil/cucdtst/TestCodePoint"); + addTest(root, &TestCharLength, "tsutil/cucdtst/TestCharLength"); addTest(root, &TestAdditionalProperties, "tsutil/cucdtst/TestAdditionalProperties"); addTest(root, &TestNumericProperties, "tsutil/cucdtst/TestNumericProperties"); addTest(root, &TestUpperLower, "tsutil/cucdtst/TestUpperLower"); @@ -162,6 +168,20 @@ static void TestUpperLower() U_STRING_INIT(upperTest, "abcdefg123hij.?:klmno", 21); U_STRING_INIT(lowerTest, "ABCDEFG123HIJ.?:KLMNO", 21); +/* +Checks LetterLike Symbols which were previously a source of confusion +[Bertrand A. D. 02/04/98] +*/ + for (i=0x2100;i<0x2138;i++) + { + if(i!=0x2126 && i!=0x212a && i!=0x212b) + { + if (i != (int)u_tolower(i)) /* itself */ + log_err("Failed case conversion with itself: \\u%4X\n", i); + if (i != (int)u_toupper(i)) + log_err("Failed case conversion with itself: \\u%4X\n", i); + } + } for(i=0; i < u_strlen(upper); i++){ if(u_tolower(upper[i]) != lower[i]){ @@ -350,9 +370,9 @@ static void TestMisc() #if defined(ICU_VERSION) /* test only happens where we have configure.in with VERSION - sanity check. */ if(strcmp(U_ICU_VERSION, ICU_VERSION)) - { + { log_err("ICU version mismatch: Header says %s, build environment says %s.\n", U_ICU_VERSION, ICU_VERSION); - } + } #endif /* test U_GC_... */ @@ -816,7 +836,7 @@ static void TestUnicodeData() errorCode=U_ZERO_ERROR; u_parseDelimitedFile(newPath, ';', fields, 15, unicodeDataLineFn, NULL, &errorCode); - if(errorCode==U_FILE_ACCESS_ERROR) { + if(errorCode==U_FILE_ACCESS_ERROR) { errorCode=U_ZERO_ERROR; u_parseDelimitedFile(backupPath, ';', fields, 15, unicodeDataLineFn, NULL, &errorCode); } @@ -857,6 +877,155 @@ static void TestUnicodeData() u_enumCharTypes(enumTypeRange, "a1"); } +static void TestCodeUnit(){ + const UChar codeunit[]={0x0000,0xe065,0x20ac,0xd7ff,0xd800,0xd841,0xd905,0xdbff,0xdc00,0xdc02,0xddee,0xdfff,0}; + + int32_t i; + + for(i=0; i<(int32_t)(sizeof(codeunit)/sizeof(codeunit[0])); i++){ + UChar c=codeunit[i]; + log_verbose("Testing code unit value of \\u%4X\n", c); + if(i<4){ + if(!(UTF_IS_SINGLE(c)) || (UTF_IS_LEAD(c)) || (UTF_IS_TRAIL(c)) ||(UTF_IS_SURROGATE(c))){ + log_err("ERROR: \\u%4X is a single", c); + } + + } + if(i >= 4 && i< 8){ + if(!(UTF_IS_LEAD(c)) || UTF_IS_SINGLE(c) || UTF_IS_TRAIL(c) || !(UTF_IS_SURROGATE(c))){ + log_err("ERROR: \\u%4X is a first surrogate", c); + } + } + if(i >= 8 && i< 12){ + if(!(UTF_IS_TRAIL(c)) || UTF_IS_SINGLE(c) || UTF_IS_LEAD(c) || !(UTF_IS_SURROGATE(c))){ + log_err("ERROR: \\u%4X is a second surrogate", c); + } + } + } + +} + +static void TestCodePoint(){ + const UChar32 codePoint[]={ + /*surrogate, notvalid(codepoint), not a UnicodeChar, not Error */ + 0xd800, + 0xdbff, + 0xdc00, + 0xdfff, + 0xdc04, + 0xd821, + /*not a surrogate, valid, isUnicodeChar , not Error*/ + 0x20ac, + 0xd7ff, + 0xe000, + 0xe123, + 0x0061, + 0xe065, + 0x20402, + 0x24506, + 0x23456, + 0x20402, + 0x10402, + 0x23456, + /*not a surrogate, not valid, isUnicodeChar, isError */ + 0x0015, + 0x009f, + /*not a surrogate, not valid, not isUnicodeChar, isError */ + 0xffff, + 0xfffe, + }; + int32_t i; + for(i=0; i<(int32_t)(sizeof(codePoint)/sizeof(codePoint[0])); i++){ + UChar32 c=codePoint[i]; + log_verbose("Testing code unit value of \\u%4X\n", c); + if(i<6){ + if(!UTF_IS_SURROGATE(c)){ + log_err("ERROR: isSurrogate() failed for \\u%4X\n", c); + } + if(UTF_IS_VALID(c)){ + log_err("ERROR: isValid() failed for \\u%4X\n", c); + } + if(UTF_IS_UNICODE_CHAR(c)){ + log_err("ERROR: isUnicodeChar() failed for \\u%4X\n", c); + } + if(UTF_IS_ERROR(c)){ + log_err("ERROR: isError() failed for \\u%4X\n", c); + } + }else if(i >=6 && i<18){ + if(UTF_IS_SURROGATE(c)){ + log_err("ERROR: isSurrogate() failed for \\u%4X\n", c); + } + if(!UTF_IS_VALID(c)){ + log_err("ERROR: isValid() failed for \\u%4X\n", c); + } + if(!UTF_IS_UNICODE_CHAR(c)){ + log_err("ERROR: isUnicodeChar() failed for \\u%4X\n", c); + } + if(UTF_IS_ERROR(c)){ + log_err("ERROR: isError() failed for \\u%4X\n", c); + } + }else if(i >=18 && i<20){ + if(UTF_IS_SURROGATE(c)){ + log_err("ERROR: isSurrogate() failed for \\u%4X\n", c); + } + if(UTF_IS_VALID(c)){ + log_err("ERROR: isValid() failed for \\u%4X\n", c); + } + if(!UTF_IS_UNICODE_CHAR(c)){ + log_err("ERROR: isUnicodeChar() failed for \\u%4X\n", c); + } + if(!UTF_IS_ERROR(c)){ + log_err("ERROR: isError() failed for \\u%4X\n", c); + } + } + else if(i >=18 && i<(int32_t)(sizeof(codePoint)/sizeof(codePoint[0]))){ + if(UTF_IS_SURROGATE(c)){ + log_err("ERROR: isSurrogate() failed for \\u%4X\n", c); + } + if(UTF_IS_VALID(c)){ + log_err("ERROR: isValid() failed for \\u%4X\n", c); + } + if(UTF_IS_UNICODE_CHAR(c)){ + log_err("ERROR: isUnicodeChar() failed for \\u%4X\n", c); + } + if(!UTF_IS_ERROR(c)){ + log_err("ERROR: isError() failed for \\u%4X\n", c); + } + } + } + +} + +static void TestCharLength() +{ + const int32_t codepoint[]={ + 1, 0x0061, + 1, 0xe065, + 1, 0x20ac, + 2, 0x20402, + 2, 0x23456, + 2, 0x24506, + 2, 0x20402, + 2, 0x10402, + 1, 0xd7ff, + 1, 0xe000 + }; + + int32_t i; + UBool multiple; + for(i=0; i<(int32_t)(sizeof(codepoint)/sizeof(codepoint[0])); i=(int16_t)(i+2)){ + UChar32 c=codepoint[i+1]; + if(UTF_CHAR_LENGTH(c) != codepoint[i]){ + log_err("The no: of code units for \\u%4X:- Expected: %d Got: %d", c, codepoint[i], UTF_CHAR_LENGTH(c)); + }else{ + log_verbose("The no: of code units for \\u%4X is %d", c, UTF_CHAR_LENGTH(c)); + } + multiple=(UBool)(codepoint[i] == 1 ? FALSE : TRUE); + if(UTF_NEED_MULTIPLE_UCHAR(c) != multiple){ + log_err("ERROR: Unicode::needMultipleUChar() failed for \\u%4X\n", c); + } + } +} /*internal functions ----*/ static int32_t MakeProp(char* str) diff --git a/icu4c/source/test/intltest/apicoll.cpp b/icu4c/source/test/intltest/apicoll.cpp index 8fb68e8298..b516f93ad1 100644 --- a/icu4c/source/test/intltest/apicoll.cpp +++ b/icu4c/source/test/intltest/apicoll.cpp @@ -145,11 +145,14 @@ CollationAPITest::TestProperty(/* char* par */) doAssert((col->getStrength() != Collator::PRIMARY), "collation object's strength is primary difference"); doAssert((col->getStrength() == Collator::SECONDARY), "collation object has the wrong strength"); +#ifdef ICU_NORMALIZER_USE_DEPRECATES +/* The replacement API is tested in TestAttribute() */ logln("testing Collator::setDecomposition() method ..."); col->setDecomposition(Normalizer::NO_OP); doAssert((col->getDecomposition() != Normalizer::DECOMP), "collation object's strength is secondary difference"); doAssert((col->getDecomposition() != Normalizer::DECOMP_COMPAT), "collation object's strength is primary difference"); doAssert((col->getDecomposition() == Normalizer::NO_OP), "collation object has the wrong strength"); +#endif UnicodeString name; @@ -374,6 +377,7 @@ CollationAPITest::TestDecomposition() { return; } +#ifdef ICU_NORMALIZER_USE_DEPRECATES /* there is no reason to have canonical decomposition in en_US OR default locale */ if (vi_VN->getDecomposition() != Normalizer::DECOMP) { @@ -389,6 +393,23 @@ CollationAPITest::TestDecomposition() { { errln("ERROR: en_US collation had cannonical decomposition for normalization!\n"); } +#else + /* there is no reason to have canonical decomposition in en_US OR default locale */ + if (vi_VN->getAttribute(UCOL_NORMALIZATION_MODE, status) != UCOL_ON) + { + errln("ERROR: vi_VN collation did not have cannonical decomposition for normalization!\n"); + } + + if (el_GR->getAttribute(UCOL_NORMALIZATION_MODE, status) != UCOL_ON) + { + errln("ERROR: el_GR collation did not have cannonical decomposition for normalization!\n"); + } + + if (en_US->getAttribute(UCOL_NORMALIZATION_MODE, status) != UCOL_OFF) + { + errln("ERROR: en_US collation had cannonical decomposition for normalization!\n"); + } +#endif delete en_US; delete el_GR; @@ -859,13 +880,13 @@ CollationAPITest::TestOperators(/* char* par */) return; } success = U_ZERO_ERROR; - RuleBasedCollator *col8 = new RuleBasedCollator(ruleset2, Normalizer::NO_OP, success); + RuleBasedCollator *col8 = new RuleBasedCollator(ruleset2, UCOL_OFF, success); if (U_FAILURE(success)) { errln("The RuleBasedCollator constructor failed when building with the 2nd rule set with Normalizer::NO_OP."); return; } success = U_ZERO_ERROR; - RuleBasedCollator *col9 = new RuleBasedCollator(ruleset2, Collator::PRIMARY, Normalizer::DECOMP_COMPAT, success); + RuleBasedCollator *col9 = new RuleBasedCollator(ruleset2, Collator::PRIMARY, UCOL_ON, success); if (U_FAILURE(success)) { errln("The RuleBasedCollator constructor failed when building with the 2nd rule set with tertiary strength and Normalizer::NO_OP."); return; diff --git a/icu4c/source/test/intltest/biditst.cpp b/icu4c/source/test/intltest/biditst.cpp index 58f288ea8e..3f5b3a3b3d 100644 --- a/icu4c/source/test/intltest/biditst.cpp +++ b/icu4c/source/test/intltest/biditst.cpp @@ -15,6 +15,7 @@ #include "biditst.h" #include "cmemory.h" +#ifdef ICU_UBIDI_USE_DEPRECATES static const char levelString[]="..............................................................."; static const char *dirPropNames[dirPropCount]={ @@ -910,3 +911,4 @@ void BiDiTest::runIndexedTest(int32_t index, UBool exec, const char *&name, char break; } } +#endif diff --git a/icu4c/source/test/intltest/biditst.h b/icu4c/source/test/intltest/biditst.h index aee7057b72..8bd880b221 100644 --- a/icu4c/source/test/intltest/biditst.h +++ b/icu4c/source/test/intltest/biditst.h @@ -19,6 +19,7 @@ #include "unicode/uchar.h" #include "unicode/bidi.h" #include "intltest.h" +#ifdef ICU_UBIDI_USE_DEPRECATES #define MAX_STRING_LENGTH 200 @@ -95,5 +96,6 @@ public: void runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par = NULL */); }; +#endif /* ICU_UBIDI_USE_DEPRECATES */ #endif diff --git a/icu4c/source/test/intltest/caltest.cpp b/icu4c/source/test/intltest/caltest.cpp index 5ac27bf110..b9bcd018f6 100644 --- a/icu4c/source/test/intltest/caltest.cpp +++ b/icu4c/source/test/intltest/caltest.cpp @@ -661,7 +661,7 @@ CalendarTest::test4064654(int32_t yr, int32_t mo, int32_t dt, int32_t hr, int32_ cal->get(Calendar::MONTH, status), cal->get(Calendar::DATE, status), (uint8_t)cal->get(Calendar::DAY_OF_WEEK, status), - cal->get(Calendar::MILLISECOND, status)); + cal->get(Calendar::MILLISECOND, status), status); if (U_FAILURE(status)) { errln("Calendar::get failed"); return; } logln("offset for " + dateToString(date, str) + "= " + (offset / 1000 / 60 / 60.0) + "hr"); int32_t utc = ((cal->get(Calendar::HOUR_OF_DAY, status) * 60 + diff --git a/icu4c/source/test/intltest/cpdtrtst.cpp b/icu4c/source/test/intltest/cpdtrtst.cpp index 29733e4ab8..4bc6541b1c 100644 --- a/icu4c/source/test/intltest/cpdtrtst.cpp +++ b/icu4c/source/test/intltest/cpdtrtst.cpp @@ -8,6 +8,9 @@ * 03/09/2000 Madhu Creation. ************************************************************************/ +/* These APIs are becoming private */ +#define ICU_COMPOUNDTRANSLITERATOR_USE_DEPRECATES 1 + #include "ittrans.h" #include "cpdtrtst.h" #include "unicode/utypes.h" diff --git a/icu4c/source/test/intltest/cppcnvt.cpp b/icu4c/source/test/intltest/cppcnvt.cpp index d5db0601b3..8420f984f3 100644 --- a/icu4c/source/test/intltest/cppcnvt.cpp +++ b/icu4c/source/test/intltest/cppcnvt.cpp @@ -4,13 +4,14 @@ * others. All Rights Reserved. ********************************************************************/ -#include +#include "cppcnvt.h" + +#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES #include "unicode/locid.h" #include "unicode/unistr.h" -#include "unicode/convert.h" #include "unicode/ucnv_err.h" -#include "cppcnvt.h" #include "cstring.h" +#include #define NUM_CODEPAGE 1 #define MAX_FILE_LEN 1024*20 @@ -36,6 +37,7 @@ void ConvertTest::runIndexedTest( int32_t index, UBool exec, const char* &name, } } +/* Test is also located in ccapitst.c */ void ConvertTest::TestConvert() { char myptr[4]; @@ -677,6 +679,7 @@ UConverterToUCallback otherCharAction(UConverterToUCallback MIA) return (MIA==(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP)?(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE:(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP; } +/* Test is also located in nucnvtst.c */ void ConvertTest::TestAmbiguous() { UErrorCode status = U_ZERO_ERROR; @@ -745,3 +748,4 @@ void ConvertTest::TestAmbiguous() delete ascii_cnv; } +#endif diff --git a/icu4c/source/test/intltest/cppcnvt.h b/icu4c/source/test/intltest/cppcnvt.h index 743cdd5f17..bdfe2d3f5e 100644 --- a/icu4c/source/test/intltest/cppcnvt.h +++ b/icu4c/source/test/intltest/cppcnvt.h @@ -5,7 +5,9 @@ ********************************************************************/ #include "intltest.h" +#include "unicode/convert.h" +#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES /** * Test for APIs of CPPUnicodeConverter **/ @@ -22,6 +24,7 @@ public: void TestConvert(void); void TestAmbiguous(void); }; +#endif diff --git a/icu4c/source/test/intltest/decoll.cpp b/icu4c/source/test/intltest/decoll.cpp index 9e9514bada..903896cb63 100644 --- a/icu4c/source/test/intltest/decoll.cpp +++ b/icu4c/source/test/intltest/decoll.cpp @@ -123,8 +123,9 @@ void CollationGermanTest::TestTertiary(/* char* par */) } int32_t i = 0; + UErrorCode status = U_ZERO_ERROR; myCollation->setStrength(Collator::TERTIARY); - myCollation->setDecomposition(Normalizer::COMPOSE_COMPAT); + myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); for (i = 0; i < 12 ; i++) { doTest(testSourceCases[i], testTargetCases[i], results[i][1]); @@ -137,8 +138,9 @@ void CollationGermanTest::TestPrimary(/* char* par */) return; } int32_t i; + UErrorCode status = U_ZERO_ERROR; myCollation->setStrength(Collator::PRIMARY); - myCollation->setDecomposition(Normalizer::DECOMP); + myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); for (i = 0; i < 12 ; i++) { doTest(testSourceCases[i], testTargetCases[i], results[i][0]); diff --git a/icu4c/source/test/intltest/dtfmtrtts.cpp b/icu4c/source/test/intltest/dtfmtrtts.cpp index 91f29aa257..29cb356038 100644 --- a/icu4c/source/test/intltest/dtfmtrtts.cpp +++ b/icu4c/source/test/intltest/dtfmtrtts.cpp @@ -5,13 +5,13 @@ ********************************************************************/ -#include #include "unicode/datefmt.h" #include "unicode/smpdtfmt.h" #include "unicode/gregocal.h" #include "dtfmtrtts.h" +#include // ***************************************************************************** // class DateFormatRoundTripTest diff --git a/icu4c/source/test/intltest/itconv.cpp b/icu4c/source/test/intltest/itconv.cpp index a881c50aef..d94db0b3ac 100644 --- a/icu4c/source/test/intltest/itconv.cpp +++ b/icu4c/source/test/intltest/itconv.cpp @@ -13,6 +13,7 @@ #include "itconv.h" #include "cppcnvt.h" +#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES void IntlTestConvert::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par ) { if (exec) logln("TestSuite Convert: "); @@ -39,3 +40,4 @@ void IntlTestConvert::runIndexedTest( int32_t index, UBool exec, const char* &na } } +#endif /* ICU_UNICODECONVERTER_USE_DEPRECATES */ diff --git a/icu4c/source/test/intltest/itconv.h b/icu4c/source/test/intltest/itconv.h index 8f04a91e62..2b070d6e0e 100644 --- a/icu4c/source/test/intltest/itconv.h +++ b/icu4c/source/test/intltest/itconv.h @@ -12,13 +12,16 @@ #define _INTLTESTCONVERT +#include "cppcnvt.h" #include "intltest.h" +#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES class IntlTestConvert: public IntlTest { public: virtual void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ); }; +#endif /* ICU_UNICODECONVERTER_USE_DEPRECATES */ #endif diff --git a/icu4c/source/test/intltest/itercoll.cpp b/icu4c/source/test/intltest/itercoll.cpp index 4194fea9a7..f8818b8a4e 100644 --- a/icu4c/source/test/intltest/itercoll.cpp +++ b/icu4c/source/test/intltest/itercoll.cpp @@ -407,7 +407,7 @@ void CollationIteratorTest::TestAssignment() } source = CharsToUnicodeString("a\\u0300\\u0325"); - coll->setDecomposition(Normalizer::DECOMP); + coll->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); CollationElementIterator *iter4 = coll->createCollationElementIterator(source); CollationElementIterator iter5(*iter4); diff --git a/icu4c/source/test/intltest/itmajor.cpp b/icu4c/source/test/intltest/itmajor.cpp index 3f8fa59475..c53c86cfe9 100644 --- a/icu4c/source/test/intltest/itmajor.cpp +++ b/icu4c/source/test/intltest/itmajor.cpp @@ -50,15 +50,7 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam } break; - case 1: name = "convert"; - if (exec) { - logln("TestSuite Convert---"); logln(); - IntlTestConvert test; - callTest( test, par ); - } - break; - - case 2: name = "normalize"; + case 1: name = "normalize"; if (exec) { logln("TestSuite Normalize---"); logln(); IntlTestNormalize test; @@ -66,7 +58,7 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam } break; - case 3: name = "collate"; + case 2: name = "collate"; if (exec) { logln("TestSuite Collator---"); logln(); IntlTestCollator test; @@ -74,7 +66,7 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam } break; - case 4: name = "textbounds"; + case 3: name = "textbounds"; if (exec) { logln("TestSuite TextBoundary---"); logln(); IntlTestTextBoundary test; @@ -82,7 +74,7 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam } break; - case 5: name = "format"; + case 4: name = "format"; if (exec) { logln("TestSuite Format---"); logln(); IntlTestFormat test; @@ -90,7 +82,7 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam } break; - case 6: name = "translit"; + case 5: name = "translit"; if (exec) { logln("TestSuite Transliterator---"); logln(); IntlTestTransliterator test; @@ -98,27 +90,38 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam } break; - case 7: name = "rbbi"; + case 6: name = "rbbi"; if (exec) { logln("TestSuite RuleBasedBreakIterator---"); logln(); IntlTestRBBI test; callTest( test, par ); } break; - case 8: name = "rbnf"; - if (exec) { + case 7: name = "rbnf"; + if (exec) { logln("TestSuite RuleBasedNumberFormat----"); logln(); IntlTestRBNF test; callTest(test, par); - } - break; - case 9: name = "rbnfrt"; - if (exec) { + } + break; + case 8: name = "rbnfrt"; + if (exec) { logln("TestSuite RuleBasedNumberFormat RT----"); logln(); RbnfRoundTripTest test; callTest(test, par); - } - break; + } + break; + +/* Only the C API is exists */ +#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES + case 9: name = "convert"; + if (exec) { + logln("TestSuite Convert---"); logln(); + IntlTestConvert test; + callTest( test, par ); + } + break; +#endif /* ICU_UNICODECONVERTER_USE_DEPRECATES */ default: name = ""; break; } diff --git a/icu4c/source/test/intltest/ittxtbd.cpp b/icu4c/source/test/intltest/ittxtbd.cpp index ca9f82bb8a..054f4bccf2 100644 --- a/icu4c/source/test/intltest/ittxtbd.cpp +++ b/icu4c/source/test/intltest/ittxtbd.cpp @@ -739,16 +739,16 @@ void IntlTestTextBoundary::TestLineInvariants() UChar c1 = work[1] = dashes[j]; for (k = 0; k < testCharsLen; k++) { UChar c2 = work[2] = testChars[k]; - int8_t type = Unicode::getType(c2); - if (type == Unicode::DECIMAL_DIGIT_NUMBER || - type == Unicode::OTHER_NUMBER || - type == Unicode::NON_SPACING_MARK || - type == Unicode::ENCLOSING_MARK || - type == Unicode::CURRENCY_SYMBOL || - type == Unicode::SPACE_SEPARATOR || - type == Unicode::DASH_PUNCTUATION || - type == Unicode::CONTROL || - type == Unicode::FORMAT || + int8_t type = u_charType(c2); + if (type == U_DECIMAL_DIGIT_NUMBER || + type == U_OTHER_NUMBER || + type == U_NON_SPACING_MARK || + type == U_ENCLOSING_MARK || + type == U_CURRENCY_SYMBOL || + type == U_SPACE_SEPARATOR || + type == U_DASH_PUNCTUATION || + type == U_CONTROL_CHAR || + type == U_FORMAT_CHAR || c2 == '\n' || c2 == '\r' || c2 == 0x2028 || c2 == 0x2029 || c2 == 0x0003 || c2 == 0x00a0 || c2 == 0x2007 || c2 == 0x2011 || c2 == 0xfeff) @@ -1626,9 +1626,9 @@ void IntlTestTextBoundary::doOtherInvariantTest(BreakIterator& tb, UnicodeString work[1] = c1; for (j = 0; j < testCharsLen; j++) { UChar c2 = testChars[j]; - type = Unicode::getType(c2); - if ((type != Unicode::NON_SPACING_MARK) && - (type != Unicode::ENCLOSING_MARK)) { + type = u_charType(c2); + if ((type != U_NON_SPACING_MARK) && + (type != U_ENCLOSING_MARK)) { continue; } work[2] = c2; diff --git a/icu4c/source/test/intltest/itutil.cpp b/icu4c/source/test/intltest/itutil.cpp index 549ceb9f9a..d411f0ca26 100644 --- a/icu4c/source/test/intltest/itutil.cpp +++ b/icu4c/source/test/intltest/itutil.cpp @@ -121,6 +121,7 @@ void IntlTestUtilities::runIndexedTest( int32_t index, UBool exec, const char* & } break; +#ifdef ICU_UBIDI_USE_DEPRECATES case 10: name = "BiDiTest"; if(exec){ @@ -129,7 +130,7 @@ void IntlTestUtilities::runIndexedTest( int32_t index, UBool exec, const char* & callTest(test,par); } break; - +#endif /* case 8: name = "LocaleTest"; diff --git a/icu4c/source/test/intltest/jacoll.cpp b/icu4c/source/test/intltest/jacoll.cpp index eeddea078d..bd003771bf 100644 --- a/icu4c/source/test/intltest/jacoll.cpp +++ b/icu4c/source/test/intltest/jacoll.cpp @@ -24,7 +24,7 @@ CollationKanaTest::CollationKanaTest() return; } - myCollation->setDecomposition(Normalizer::DECOMP); + myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); } CollationKanaTest::~CollationKanaTest() diff --git a/icu4c/source/test/intltest/jamotest.cpp b/icu4c/source/test/intltest/jamotest.cpp index f308b91459..81448a8c28 100644 --- a/icu4c/source/test/intltest/jamotest.cpp +++ b/icu4c/source/test/intltest/jamotest.cpp @@ -9,6 +9,10 @@ * 03/01/2001 George port to HP/UX ************************************************************************/ +/* These APIs are becoming private */ +#define ICU_COMPOUNDTRANSLITERATOR_USE_DEPRECATES 1 +#define ICU_RULEBASEDTRANSLITERATOR_USE_DEPRECATES 1 + #include "jamotest.h" #include "unicode/utypes.h" #include "unicode/translit.h" diff --git a/icu4c/source/test/intltest/lcukocol.cpp b/icu4c/source/test/intltest/lcukocol.cpp index a67039ed6b..9b6d7387cb 100644 --- a/icu4c/source/test/intltest/lcukocol.cpp +++ b/icu4c/source/test/intltest/lcukocol.cpp @@ -28,7 +28,7 @@ LotusCollationKoreanTest::LotusCollationKoreanTest() { UErrorCode status = U_ZERO_ERROR; myCollation = Collator::createInstance("ko_kr", status); - myCollation->setDecomposition(Normalizer::DECOMP); + myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); } LotusCollationKoreanTest::~LotusCollationKoreanTest() diff --git a/icu4c/source/test/intltest/regcoll.cpp b/icu4c/source/test/intltest/regcoll.cpp index db08945de3..e45365140b 100644 --- a/icu4c/source/test/intltest/regcoll.cpp +++ b/icu4c/source/test/intltest/regcoll.cpp @@ -137,7 +137,8 @@ void CollationRegressionTest::Test4054238(/* char* par */) // NOTE: The Java code uses en_us to create the CollationElementIterators // but I'm pretty sure that's wrong, so I've changed this to use c. - c->setDecomposition(Normalizer::DECOMP); + UErrorCode status = U_ZERO_ERROR; + c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); CollationElementIterator *i1 = c->createCollationElementIterator(test3); delete i1; delete c; @@ -173,11 +174,12 @@ void CollationRegressionTest::Test4054734(/* char* par */) }; + UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); c->setStrength(Collator::IDENTICAL); - c->setDecomposition(Normalizer::DECOMP); + c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); compareArray(*c, decomp, ARRAY_LENGTH(decomp)); delete c; @@ -189,10 +191,11 @@ void CollationRegressionTest::Test4054734(/* char* par */) // void CollationRegressionTest::Test4054736(/* char* par */) { + UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); c->setStrength(Collator::SECONDARY); - c->setDecomposition(Normalizer::DECOMP_COMPAT); + c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] = { @@ -238,7 +241,7 @@ void CollationRegressionTest::Test4058613(/* char* par */) // Since the fix to this bug was to turn off decomposition for Korean collators, // ensure that's what we got - if (c->getDecomposition() != Normalizer::NO_OP) + if (c->getAttribute(UCOL_NORMALIZATION_MODE, status) != UCOL_OFF) { errln("Decomposition is not set to NO_DECOMPOSITION for Korean collator"); } @@ -304,7 +307,7 @@ void CollationRegressionTest::Test4060154(/* char* par */) return; } - c->setDecomposition(Normalizer::DECOMP); + c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); /* String[] tertiary = { @@ -408,16 +411,17 @@ void CollationRegressionTest::Test4066189(/* char* par */) static const UChar chars2[] = {0x61, 0x0306, 0x0300, 0}; const UnicodeString test1(chars1); const UnicodeString test2(chars2); + UErrorCode status = U_ZERO_ERROR; // NOTE: The java code used en_us to create the // CollationElementIterator's. I'm pretty sure that // was wrong, so I've change the code to use c1 and c2 RuleBasedCollator *c1 = (RuleBasedCollator *) en_us->clone(); - c1->setDecomposition(Normalizer::DECOMP_COMPAT); + c1->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); CollationElementIterator *i1 = c1->createCollationElementIterator(test1); RuleBasedCollator *c2 = (RuleBasedCollator *) en_us->clone(); - c2->setDecomposition(Normalizer::NO_OP); + c2->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_OFF, status); CollationElementIterator *i2 = c2->createCollationElementIterator(test2); assertEqual(*i1, *i2); @@ -559,13 +563,14 @@ void CollationRegressionTest::Test4081866(/* char* par */) static const UChar s1[] = {0x41, 0x0300, 0x0316, 0x0327, 0x0315, 0}; static const UChar s2[] = {0x41, 0x0327, 0x0316, 0x0315, 0x0300, 0}; + UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); c->setStrength(Collator::TERTIARY); // Now that the default collators are set to NO_DECOMPOSITION // (as a result of fixing bug 4114077), we must set it explicitly // when we're testing reordering behavior. -- lwerner, 5/5/98 - c->setDecomposition(Normalizer::DECOMP); + c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); if (c->compare(s1,s2) != 0) { @@ -744,6 +749,7 @@ void CollationRegressionTest::Test4103436(/* char* par */) // void CollationRegressionTest::Test4114076(/* char* par */) { + UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); c->setStrength(Collator::TERTIARY); @@ -757,7 +763,7 @@ void CollationRegressionTest::Test4114076(/* char* par */) {0xd4db, 0}, {0x3d, 0}, {0x1111, 0x1171, 0x11b6, 0} }; - c->setDecomposition(Normalizer::DECOMP); + c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); compareArray(*c, test1, ARRAY_LENGTH(test1)); // From UTR #15: @@ -866,6 +872,7 @@ void CollationRegressionTest::Test4114077(/* char* par */) // Ensure that we get the same results with decomposition off // as we do with it on.... + UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone(); c->setStrength(Collator::TERTIARY); @@ -879,7 +886,7 @@ void CollationRegressionTest::Test4114077(/* char* par */) {0x41, 0x0300, 0x0316, 0}, {0x3c, 0}, {0x41, 0x0316, 0x0300, 0} // No reordering --> unequal }; - c->setDecomposition(Normalizer::NO_OP); + c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_OFF, status); compareArray(*c, test1, ARRAY_LENGTH(test1)); static const UChar test2[][CollationRegressionTest::MAX_TOKEN_LEN] = @@ -887,7 +894,7 @@ void CollationRegressionTest::Test4114077(/* char* par */) {0x41, 0x0300, 0x0316, 0}, {0x3d, 0}, {0x41, 0x0316, 0x0300, 0} // Reordering --> equal }; - c->setDecomposition(Normalizer::DECOMP); + c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); compareArray(*c, test2, ARRAY_LENGTH(test2)); delete c; diff --git a/icu4c/source/test/intltest/restest.cpp b/icu4c/source/test/intltest/restest.cpp index 68de434f1e..4abc52a056 100644 --- a/icu4c/source/test/intltest/restest.cpp +++ b/icu4c/source/test/intltest/restest.cpp @@ -103,9 +103,9 @@ param[] = { "root", NULL, U_ZERO_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }, { "te", NULL, U_ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, { "te_IN", NULL, U_ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, - { "te_NE", NULL, U_USING_FALLBACK_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, - { "te_IN_NE", NULL, U_USING_FALLBACK_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, - { "ne", NULL, U_USING_DEFAULT_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } } + { "te_NE", NULL, U_USING_FALLBACK_WARNING, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, + { "te_IN_NE", NULL, U_USING_FALLBACK_WARNING, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, + { "ne", NULL, U_USING_DEFAULT_WARNING, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } } }; int32_t bundles_count = sizeof(param) / sizeof(param[0]); @@ -358,9 +358,9 @@ ResourceBundleTest::testTag(const char* frag, if(j == actual_bundle) /* it's in the same bundle OR it's a nonexistent=default bundle (5) */ expected_resource_status = U_ZERO_ERROR; else if(j == 0) - expected_resource_status = U_USING_DEFAULT_ERROR; + expected_resource_status = U_USING_DEFAULT_WARNING; else - expected_resource_status = U_USING_FALLBACK_ERROR; + expected_resource_status = U_USING_FALLBACK_WARNING; break; } diff --git a/icu4c/source/test/intltest/restsnew.cpp b/icu4c/source/test/intltest/restsnew.cpp index 6c9d8c68c0..52bcf4e00e 100644 --- a/icu4c/source/test/intltest/restsnew.cpp +++ b/icu4c/source/test/intltest/restsnew.cpp @@ -102,9 +102,9 @@ param[] = { "root", 0, U_ZERO_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } }, { "te", 0, U_ZERO_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, { "te_IN", 0, U_ZERO_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, - { "te_NE", 0, U_USING_FALLBACK_ERROR, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, - { "te_IN_NE", 0, U_USING_FALLBACK_ERROR, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, - { "ne", 0, U_USING_DEFAULT_ERROR, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } } + { "te_NE", 0, U_USING_FALLBACK_WARNING, e_te, { FALSE, TRUE, FALSE }, { TRUE, TRUE, FALSE } }, + { "te_IN_NE", 0, U_USING_FALLBACK_WARNING, e_te_IN, { FALSE, FALSE, TRUE }, { TRUE, TRUE, TRUE } }, + { "ne", 0, U_USING_DEFAULT_WARNING, e_Root, { TRUE, FALSE, FALSE }, { TRUE, FALSE, FALSE } } }; static int32_t bundles_count = sizeof(param) / sizeof(param[0]); @@ -631,9 +631,9 @@ NewResourceBundleTest::testTag(const char* frag, if(j == actual_bundle) /* it's in the same bundle OR it's a nonexistent=default bundle (5) */ expected_resource_status = U_ZERO_ERROR; else if(j == 0) - expected_resource_status = U_USING_DEFAULT_ERROR; + expected_resource_status = U_USING_DEFAULT_WARNING; else - expected_resource_status = U_USING_FALLBACK_ERROR; + expected_resource_status = U_USING_FALLBACK_WARNING; break; } diff --git a/icu4c/source/test/intltest/srchtest.cpp b/icu4c/source/test/intltest/srchtest.cpp index 688898a5c2..92ece5b09a 100644 --- a/icu4c/source/test/intltest/srchtest.cpp +++ b/icu4c/source/test/intltest/srchtest.cpp @@ -1401,7 +1401,7 @@ void StringSearchTest::TestContraction() UnicodeString rules; rules.setTo(temp, u_strlen(temp)); RuleBasedCollator *collator = new RuleBasedCollator(rules, - getECollationStrength(UCOL_TERTIARY), Normalizer::DECOMP, status); + getECollationStrength(UCOL_TERTIARY), UCOL_ON, status); if (U_FAILURE(status)) { errln("Error opening collator %s", u_errorName(status)); } @@ -1440,7 +1440,7 @@ void StringSearchTest::TestIgnorable() int count = 0; RuleBasedCollator *collator = new RuleBasedCollator(rules, getECollationStrength(IGNORABLE[count].strength), - Normalizer::DECOMP, status); + UCOL_ON, status); if (U_FAILURE(status)) { errln("Error opening collator %s", u_errorName(status)); return; @@ -1681,7 +1681,7 @@ void StringSearchTest::TestCollatorCanonical() rules.setTo(temp, u_strlen(temp)); RuleBasedCollator *tailored = new RuleBasedCollator(rules, getECollationStrength(COLLATORCANONICAL[1].strength), - Normalizer::DECOMP, status); + UCOL_ON, status); if (U_FAILURE(status)) { errln("Error opening rule based collator %s", u_errorName(status)); @@ -1952,7 +1952,7 @@ void StringSearchTest::TestContractionCanonical() UErrorCode status = U_ZERO_ERROR; RuleBasedCollator *collator = new RuleBasedCollator(rules, - getECollationStrength(UCOL_TERTIARY), Normalizer::DECOMP, status); + getECollationStrength(UCOL_TERTIARY), UCOL_ON, status); if (U_FAILURE(status)) { errln("Error opening collator %s", u_errorName(status)); } diff --git a/icu4c/source/test/intltest/transapi.cpp b/icu4c/source/test/intltest/transapi.cpp index adc71e6ed1..e25d4bc754 100644 --- a/icu4c/source/test/intltest/transapi.cpp +++ b/icu4c/source/test/intltest/transapi.cpp @@ -8,6 +8,10 @@ * 1/03/2000 Madhu Creation. ************************************************************************/ +/* These APIs are becoming private */ +#define ICU_NULLTRANSLITERATOR_USE_DEPRECATES 1 +#define ICU_RULEBASEDTRANSLITERATOR_USE_DEPRECATES 1 + #include "ittrans.h" #include "transapi.h" #include "unicode/utypes.h" diff --git a/icu4c/source/test/intltest/transtst.cpp b/icu4c/source/test/intltest/transtst.cpp index 02b7eb0e1e..d99260871c 100644 --- a/icu4c/source/test/intltest/transtst.cpp +++ b/icu4c/source/test/intltest/transtst.cpp @@ -7,6 +7,13 @@ * 11/10/99 aliu Creation. ********************************************************************** */ + +/* These APIs are becoming private */ +#define ICU_COMPOUNDTRANSLITERATOR_USE_DEPRECATES 1 +#define ICU_NULLTRANSLITERATOR_USE_DEPRECATES 1 +#define ICU_RULEBASEDTRANSLITERATOR_USE_DEPRECATES 1 +#define ICU_UNICODETOHEXTRANSLITERATOR_USE_DEPRECATES 1 + #include "transtst.h" #include "unicode/cpdtrans.h" #include "unicode/dtfmtsym.h" diff --git a/icu4c/source/test/intltest/trnserr.cpp b/icu4c/source/test/intltest/trnserr.cpp index 4b83fae6c0..f7e69f0e7d 100644 --- a/icu4c/source/test/intltest/trnserr.cpp +++ b/icu4c/source/test/intltest/trnserr.cpp @@ -13,6 +13,10 @@ * ************************************************************************/ +/* These APIs are becoming private */ +#define ICU_RULEBASEDTRANSLITERATOR_USE_DEPRECATES 1 +#define ICU_UNICODETOHEXTRANSLITERATOR_USE_DEPRECATES 1 + #include "ittrans.h" #include "trnserr.h" #include "unicode/utypes.h" diff --git a/icu4c/source/test/intltest/tstnorm.cpp b/icu4c/source/test/intltest/tstnorm.cpp index bec6b6ce15..10019560ca 100644 --- a/icu4c/source/test/intltest/tstnorm.cpp +++ b/icu4c/source/test/intltest/tstnorm.cpp @@ -739,7 +739,8 @@ BasicNormalizerTest::TestNormalizerAPI() { } // test setIndex() - if(norm.setIndex(3)!=0x4e3d) { + norm.setIndexOnly(3); + if(norm.current()!=0x4e3d) { errln("error in Normalizer(CharacterIterator).setIndex(3)"); } diff --git a/icu4c/source/test/intltest/tzbdtest.cpp b/icu4c/source/test/intltest/tzbdtest.cpp index 336637aaf7..9bd81b76b0 100644 --- a/icu4c/source/test/intltest/tzbdtest.cpp +++ b/icu4c/source/test/intltest/tzbdtest.cpp @@ -197,7 +197,8 @@ TimeZoneBoundaryTest::verifyDST(UDate d, TimeZone* time_zone, UBool expUseDaylig int32_t offset = time_zone->getOffset((uint8_t)gc->get(gc->ERA, status), gc->get(gc->YEAR, status), gc->get(gc->MONTH, status), gc->get(gc->DAY_OF_MONTH, status), (uint8_t)gc->get(gc->DAY_OF_WEEK, status), - ((gc->get(gc->HOUR_OF_DAY, status) * 60 + gc->get(gc->MINUTE, status)) * 60 + gc->get(gc->SECOND, status)) * 1000 + gc->get(gc->MILLISECOND, status)); + ((gc->get(gc->HOUR_OF_DAY, status) * 60 + gc->get(gc->MINUTE, status)) * 60 + gc->get(gc->SECOND, status)) * 1000 + gc->get(gc->MILLISECOND, status), + status); if (failure(status, "GregorianCalendar::get")) return; if (offset == expDSTOffset) logln(UnicodeString("PASS: getOffset() = ") + (offset / ONE_HOUR)); else errln(UnicodeString("FAIL: getOffset() = ") + (offset / ONE_HOUR) + "; expected " + (expDSTOffset / ONE_HOUR)); diff --git a/icu4c/source/test/intltest/tzregts.cpp b/icu4c/source/test/intltest/tzregts.cpp index 6297421d91..81508a0849 100644 --- a/icu4c/source/test/intltest/tzregts.cpp +++ b/icu4c/source/test/intltest/tzregts.cpp @@ -191,17 +191,18 @@ void TimeZoneRegressionTest:: Test4073215() * 1:00 AM STD = display name 1:00 AM ST */ void TimeZoneRegressionTest:: Test4084933() { + UErrorCode status = U_ZERO_ERROR; TimeZone *tz = TimeZone::createTimeZone("PST"); int32_t offset1 = tz->getOffset(1, - 1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (2*60*60*1000)); + 1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (2*60*60*1000), status); int32_t offset2 = tz->getOffset(1, - 1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (2*60*60*1000)-1); + 1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (2*60*60*1000)-1, status); int32_t offset3 = tz->getOffset(1, - 1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (1*60*60*1000)); + 1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (1*60*60*1000), status); int32_t offset4 = tz->getOffset(1, - 1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (1*60*60*1000)-1); + 1997, Calendar::OCTOBER, 26, Calendar::SUNDAY, (1*60*60*1000)-1, status); /* * The following was added just for consistency. It shows that going *to* Daylight @@ -209,21 +210,22 @@ void TimeZoneRegressionTest:: Test4084933() { */ int32_t offset5 = tz->getOffset(1, - 1997, Calendar::APRIL, 6, Calendar::SUNDAY, (2*60*60*1000)); + 1997, Calendar::APRIL, 6, Calendar::SUNDAY, (2*60*60*1000), status); int32_t offset6 = tz->getOffset(1, - 1997, Calendar::APRIL, 6, Calendar::SUNDAY, (2*60*60*1000)-1); + 1997, Calendar::APRIL, 6, Calendar::SUNDAY, (2*60*60*1000)-1, status); int32_t offset7 = tz->getOffset(1, - 1997, Calendar::APRIL, 6, Calendar::SUNDAY, (1*60*60*1000)); + 1997, Calendar::APRIL, 6, Calendar::SUNDAY, (1*60*60*1000), status); int32_t offset8 = tz->getOffset(1, - 1997, Calendar::APRIL, 6, Calendar::SUNDAY, (1*60*60*1000)-1); + 1997, Calendar::APRIL, 6, Calendar::SUNDAY, (1*60*60*1000)-1, status); int32_t SToffset = (int32_t)(-8 * 60*60*1000L); int32_t DToffset = (int32_t)(-7 * 60*60*1000L); if (offset1 != SToffset || offset2 != SToffset || offset3 != SToffset || offset4 != DToffset || offset5 != DToffset || offset6 != SToffset || - offset7 != SToffset || offset8 != SToffset) + offset7 != SToffset || offset8 != SToffset + || U_FAILURE(status)) errln("Fail: TimeZone misbehaving"); delete tz; @@ -426,7 +428,7 @@ void TimeZoneRegressionTest:: Test4126678() cal->set(1998 - 1900, Calendar::APRIL, 5, 10, 0); //Date dt = new Date(1998-1900, Calendar::APRIL, 5, 10, 0); - if (! tz->inDaylightTime(cal->getTime(status), status) || U_FAILURE(status)) + if (! tz->useDaylightTime() || U_FAILURE(status)) errln("We're not in Daylight Savings Time and we should be.\n"); //cal.setTime(dt); @@ -442,7 +444,7 @@ void TimeZoneRegressionTest:: Test4126678() cal->get(Calendar::DST_OFFSET, status); failure(status, "cal->get"); - int32_t offset = tz->getOffset((uint8_t)era, year, month, day, (uint8_t)dayOfWeek, millis); + int32_t offset = tz->getOffset((uint8_t)era, year, month, day, (uint8_t)dayOfWeek, millis, status); int32_t raw_offset = tz->getRawOffset(); if (offset == raw_offset) errln("Offsets should not match when in DST"); diff --git a/icu4c/source/test/intltest/tztest.cpp b/icu4c/source/test/intltest/tztest.cpp index f09c1f349b..b105086790 100644 --- a/icu4c/source/test/intltest/tztest.cpp +++ b/icu4c/source/test/intltest/tztest.cpp @@ -267,7 +267,7 @@ TimeZoneTest::TestVariousAPI518() gc->setTime(d, status); if (U_FAILURE(status)) { errln("FAIL: GregorianCalendar::setTime failed"); return; } if (time_zone->getOffset(gc->AD, gc->get(gc->YEAR, status), gc->get(gc->MONTH, status), - gc->get(gc->DAY_OF_MONTH, status), (uint8_t)gc->get(gc->DAY_OF_WEEK, status), 0) != - 7 * millisPerHour) + gc->get(gc->DAY_OF_MONTH, status), (uint8_t)gc->get(gc->DAY_OF_WEEK, status), 0, status) != - 7 * millisPerHour) errln("FAIL: getOffset returned wrong value"); if (U_FAILURE(status)) { errln("FAIL: GregorianCalendar::set failed"); return; } delete gc; diff --git a/icu4c/source/test/intltest/ucdtest.cpp b/icu4c/source/test/intltest/ucdtest.cpp index f73bf68a71..37e933cdc8 100644 --- a/icu4c/source/test/intltest/ucdtest.cpp +++ b/icu4c/source/test/intltest/ucdtest.cpp @@ -26,16 +26,18 @@ void UnicodeTest::runIndexedTest( int32_t index, UBool exec, const char* &name, { if (exec) logln("TestSuite UnicodeTest: "); switch (index) { - case 0: name = "TestUpperLower"; if (exec) TestUpperLower(); break; - case 1: name = "TestLetterNumber"; if (exec) TestLetterNumber(); break; - case 2: name = "TestMisc"; if (exec) TestMisc(); break; - case 3: name = "TestUnicodeData"; if (exec) TestUnicodeData(); break; - case 4: name = "TestCodeUnit"; if(exec) TestCodeUnit(); break; - case 5: name = "TestCodePoint"; if(exec) TestCodePoint(); break; - case 6: name = "TestCharLength"; if(exec) TestCharLength(); break; - case 7: name = "TestIdentifier"; if(exec) TestIdentifier(); break; - case 8: name = "TestScript"; if(exec) TestScript(); break; - case 9: name = "TestAdditionalProperties"; if(exec) TestAdditionalProperties(); break; + case 0: name = "TestAdditionalProperties"; if(exec) TestAdditionalProperties(); break; +#ifdef ICU_UNICODE_CLASS_USE_DEPRECATES + case 1: name = "TestUpperLower"; if (exec) TestUpperLower(); break; + case 2: name = "TestLetterNumber"; if (exec) TestLetterNumber(); break; + case 3: name = "TestMisc"; if (exec) TestMisc(); break; + case 4: name = "TestUnicodeData"; if (exec) TestUnicodeData(); break; + case 5: name = "TestCodeUnit"; if(exec) TestCodeUnit(); break; + case 6: name = "TestCodePoint"; if(exec) TestCodePoint(); break; + case 7: name = "TestCharLength"; if(exec) TestCharLength(); break; + case 8: name = "TestIdentifier"; if(exec) TestIdentifier(); break; + case 9: name = "TestScript"; if(exec) TestScript(); break; +#endif default: name = ""; break; //needed to end loop } } @@ -44,6 +46,7 @@ void UnicodeTest::runIndexedTest( int32_t index, UBool exec, const char* &name, // private data used by the tests //==================================================== +#ifdef ICU_UNICODE_CLASS_USE_DEPRECATES const UChar LAST_CHAR_CODE_IN_FILE = 0xFFFD; const char tagStrings[] = "MnMcMeNdNlNoZsZlZpCcCfCsCoCnLuLlLtLmLoPcPdPsPePoSmScSkSoPiPf"; const int32_t tagValues[] = @@ -728,6 +731,7 @@ void UnicodeTest::TestScript() errln("ERROR: Diffe rent Thai values in EUnicodeScript and UCharScript"); } } +#endif // test DerivedCoreProperties.txt ------------------------------------------- diff --git a/icu4c/source/test/intltest/unhxtrts.h b/icu4c/source/test/intltest/unhxtrts.h index 5c30889d0e..fef1cd114d 100644 --- a/icu4c/source/test/intltest/unhxtrts.h +++ b/icu4c/source/test/intltest/unhxtrts.h @@ -11,6 +11,9 @@ #ifndef UNITOHEXTRTST_H #define UNITOHEXTRTST_H +#define ICU_UNICODETOHEXTRANSLITERATOR_USE_DEPRECATES 1 + + #include "unicode/translit.h" #include "unicode/unitohex.h" #include "intltest.h" diff --git a/icu4c/source/test/intltest/usettest.cpp b/icu4c/source/test/intltest/usettest.cpp index 9585377864..86e08bb1cd 100644 --- a/icu4c/source/test/intltest/usettest.cpp +++ b/icu4c/source/test/intltest/usettest.cpp @@ -182,7 +182,7 @@ UnicodeSetTest::TestCategories(void) { set.applyPattern("[:L:]", status); if (U_FAILURE(status)) { errln("FAIL"); return; } for (i=0; i<0x200; ++i) { - UBool l = Unicode::isLetter((UChar)i); + UBool l = u_isalpha((UChar)i); if (l != set.contains(i)) { errln((UnicodeString)"FAIL: L contains " + (unsigned short)i + " = " + set.contains(i)); @@ -193,7 +193,7 @@ UnicodeSetTest::TestCategories(void) { set.applyPattern("[:Lu:]", status); if (U_FAILURE(status)) { errln("FAIL"); return; } for (i=0; i<0x200; ++i) { - UBool lu = (Unicode::getType((UChar)i) == Unicode::UPPERCASE_LETTER); + UBool lu = (u_charType((UChar)i) == U_UPPERCASE_LETTER); if (lu != set.contains(i)) { errln((UnicodeString)"FAIL: Lu contains " + (unsigned short)i + " = " + set.contains(i)); @@ -204,14 +204,14 @@ UnicodeSetTest::TestCategories(void) { void UnicodeSetTest::TestCloneEqualHash(void) { UErrorCode status = U_ZERO_ERROR; - int8_t category=Unicode::LOWERCASE_LETTER; + int8_t category=U_LOWERCASE_LETTER; UnicodeSet *set1=new UnicodeSet(category, status); // :Ll: Letter, lowercase UnicodeSet *set1a=new UnicodeSet("[:Ll:]", status); // Letter, lowercase if (U_FAILURE(status)){ errln((UnicodeString)"FAIL: Can't construst set with category->Ll"); return; } - category=Unicode::DECIMAL_DIGIT_NUMBER; + category=U_DECIMAL_DIGIT_NUMBER; UnicodeSet *set2=new UnicodeSet(category, status); //Number, Decimal digit UnicodeSet *set2a=new UnicodeSet("[:Nd:]", status); //Number, Decimal digit if (U_FAILURE(status)){ diff --git a/icu4c/source/test/intltest/ustrtest.cpp b/icu4c/source/test/intltest/ustrtest.cpp index d1eb14fc42..b8370572fe 100644 --- a/icu4c/source/test/intltest/ustrtest.cpp +++ b/icu4c/source/test/intltest/ustrtest.cpp @@ -1137,7 +1137,7 @@ UnicodeStringTest::TestStackAllocation() // test the UChar32 constructor UnicodeString c32Test((UChar32)0x10ff2a); - if( c32Test.length() != Unicode::charLength(0x10ff2a) || + if( c32Test.length() != UTF_CHAR_LENGTH(0x10ff2a) || c32Test.char32At(c32Test.length() - 1) != 0x10ff2a ) { errln("The UnicodeString(UChar32) constructor does not work with a 0x10ff2a filler"); @@ -1145,7 +1145,7 @@ UnicodeStringTest::TestStackAllocation() // test the (new) capacity constructor UnicodeString capTest(5, (UChar32)0x2a, 5); - if( capTest.length() != 5 * Unicode::charLength(0x2a) || + if( capTest.length() != 5 * UTF_CHAR_LENGTH(0x2a) || capTest.char32At(0) != 0x2a || capTest.char32At(4) != 0x2a ) { @@ -1153,7 +1153,7 @@ UnicodeStringTest::TestStackAllocation() } capTest = UnicodeString(5, (UChar32)0x10ff2a, 5); - if( capTest.length() != 5 * Unicode::charLength(0x10ff2a) || + if( capTest.length() != 5 * UTF_CHAR_LENGTH(0x10ff2a) || capTest.char32At(0) != 0x10ff2a || capTest.char32At(4) != 0x10ff2a ) {