diff --git a/icu4c/source/test/cintltst/cloctst.c b/icu4c/source/test/cintltst/cloctst.c index 8903c5145d0..6ac44eaa9f4 100644 --- a/icu4c/source/test/cintltst/cloctst.c +++ b/icu4c/source/test/cintltst/cloctst.c @@ -1457,7 +1457,7 @@ TestKeyInRootRecursive(UResourceBundle *root, const char *rootName, } if ((subBundleKey == NULL - || (subBundleKey != NULL && strcmp(subBundleKey, "LocaleScript") != 0)) + || (subBundleKey != NULL && strcmp(subBundleKey, "LocaleScript") != 0 && strcmp(subBundleKey, "PTE") != 0)) && ures_getSize(subRootBundle) != ures_getSize(subBundle)) { log_err("Different size array with key \"%s\" in \"%s\" from root for locale \"%s\"\n" @@ -2167,58 +2167,71 @@ static void VerifyTranslation(void) { currLoc, strIdx); } } + { + UResourceBundle* cal = ures_getByKey(currentLocale, "calendar", NULL, &errorCode); + UResourceBundle* greg = ures_getByKeyWithFallback(cal, "gregorian", NULL, &errorCode); + UResourceBundle* names = ures_getByKeyWithFallback(greg, "dayNames", NULL, &errorCode); + UResourceBundle* format = ures_getByKeyWithFallback(names, "format", NULL, &errorCode); + resArray = ures_getByKeyWithFallback(format, "wide", NULL, &errorCode); - resArray = ures_getByKey(currentLocale, "DayNames", NULL, &errorCode); - if (U_FAILURE(errorCode)) { - log_err("error ures_getByKey returned %s\n", u_errorName(errorCode)); - } - if (QUICK) { - end = 1; - } - else { - end = ures_getSize(resArray); - } - - - for (idx = 0; idx < end; idx++) { - const UChar *fromBundleStr = ures_getStringByIndex(resArray, idx, &langSize, &errorCode); if (U_FAILURE(errorCode)) { - log_err("error ures_getStringByIndex(%d) returned %s\n", idx, u_errorName(errorCode)); - continue; + log_err("error ures_getByKey returned %s\n", u_errorName(errorCode)); } - strIdx = findStringSetMismatch(fromBundleStr, langSize, exemplarCharacters, exemplarLen, TRUE); - if (strIdx >= 0) { - log_err("getDayNames(%s, %d) at index %d returned characters not in the exemplar characters.\n", - currLoc, idx, strIdx); + if (QUICK) { + end = 1; + } + else { + end = ures_getSize(resArray); } - } - ures_close(resArray); - resArray = ures_getByKey(currentLocale, "MonthNames", NULL, &errorCode); - if (U_FAILURE(errorCode)) { - log_err("error ures_getByKey returned %s\n", u_errorName(errorCode)); - } - if (QUICK) { - end = 1; - } - else { - end = ures_getSize(resArray); - } - for (idx = 0; idx < end; idx++) { - const UChar *fromBundleStr = ures_getStringByIndex(resArray, idx, &langSize, &errorCode); + for (idx = 0; idx < end; idx++) { + const UChar *fromBundleStr = ures_getStringByIndex(resArray, idx, &langSize, &errorCode); + if (U_FAILURE(errorCode)) { + log_err("error ures_getStringByIndex(%d) returned %s\n", idx, u_errorName(errorCode)); + continue; + } + strIdx = findStringSetMismatch(fromBundleStr, langSize, exemplarCharacters, exemplarLen, TRUE); + if (strIdx >= 0) { + log_err("getDayNames(%s, %d) at index %d returned characters not in the exemplar characters.\n", + currLoc, idx, strIdx); + } + } + ures_close(resArray); + ures_close(format); + ures_close(names); + + names = ures_getByKeyWithFallback(greg, "monthNames", NULL, &errorCode); + format = ures_getByKeyWithFallback(names,"format", NULL, &errorCode); + resArray = ures_getByKeyWithFallback(format, "wide", NULL, &errorCode); if (U_FAILURE(errorCode)) { - log_err("error ures_getStringByIndex(%d) returned %s\n", idx, u_errorName(errorCode)); - continue; + log_err("error ures_getByKey returned %s\n", u_errorName(errorCode)); } - strIdx = findStringSetMismatch(fromBundleStr, langSize, exemplarCharacters, exemplarLen, TRUE); - if (strIdx >= 0) { - log_err("getMonthNames(%s, %d) at index %d returned characters not in the exemplar characters.\n", - currLoc, idx, strIdx); + if (QUICK) { + end = 1; + } + else { + end = ures_getSize(resArray); } - } - ures_close(resArray); + for (idx = 0; idx < end; idx++) { + const UChar *fromBundleStr = ures_getStringByIndex(resArray, idx, &langSize, &errorCode); + if (U_FAILURE(errorCode)) { + log_err("error ures_getStringByIndex(%d) returned %s\n", idx, u_errorName(errorCode)); + continue; + } + strIdx = findStringSetMismatch(fromBundleStr, langSize, exemplarCharacters, exemplarLen, TRUE); + if (strIdx >= 0) { + log_err("getMonthNames(%s, %d) at index %d returned characters not in the exemplar characters.\n", + currLoc, idx, strIdx); + } + } + ures_close(resArray); + ures_close(format); + ures_close(names); + ures_close(greg); + ures_close(cal); + } errorCode = U_ZERO_ERROR; numScripts = uscript_getCode(currLoc, scripts, sizeof(scripts)/sizeof(scripts[0]), &errorCode); if (numScripts == 0) { diff --git a/icu4c/source/test/cintltst/crestst.c b/icu4c/source/test/cintltst/crestst.c index a1302b1c534..f28eef019dc 100644 --- a/icu4c/source/test/cintltst/crestst.c +++ b/icu4c/source/test/cintltst/crestst.c @@ -447,10 +447,10 @@ static void TestFallback() status = U_ZERO_ERROR; /* and this is a Fallback, to fr */ - junk = ures_getStringByKey(fr_FR, "DayNames", &resultLen, &status); + junk = ures_getStringByKey(fr_FR, "Countries", &resultLen, &status); if(status != U_USING_FALLBACK_WARNING) { - log_data_err("Expected U_USING_FALLBACK_ERROR when trying to get DayNames from fr_FR, got %s\n", + log_data_err("Expected U_USING_FALLBACK_ERROR when trying to get Countries from fr_FR, got %s\n", u_errorName(status)); } diff --git a/icu4c/source/test/cintltst/creststn.c b/icu4c/source/test/cintltst/creststn.c index 5136520ec18..aedcf69210f 100644 --- a/icu4c/source/test/cintltst/creststn.c +++ b/icu4c/source/test/cintltst/creststn.c @@ -1974,10 +1974,10 @@ static void TestFallback() ures_close(subResource); /* and this is a Fallback, to fr */ - junk = ures_getStringByKey(fr_FR, "DayNames", &resultLen, &status); + junk = ures_getStringByKey(fr_FR, "Countries", &resultLen, &status); if(status != U_USING_FALLBACK_WARNING) { - log_data_err("Expected U_USING_FALLBACK_ERROR when trying to get DayNames from fr_FR, got %d\n", + log_data_err("Expected U_USING_FALLBACK_ERROR when trying to get Countries from fr_FR, got %d\n", status); } @@ -2000,9 +2000,9 @@ static void TestFallback() if(u_strcmp(ures_getString(resLocID, &resultLen, &err), versionStr) != 0){ log_data_err("ures_getString(resLocID, &resultLen, &err) returned an unexpected version value\n"); } - tResB = ures_getByKey(myResB, "DayNames", NULL, &err); + tResB = ures_getByKey(myResB, "calendar", NULL, &err); 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)); + log_err("Expected U_USING_FALLBACK_ERROR when trying to test no_NO_NY aliased with nn_NO_NY for calendar err=%s\n",u_errorName(err)); } ures_close(resLocID); ures_close(myResB);