]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/cintltst/cldrtest.c
ICU-64252.0.1.tar.gz
[apple/icu.git] / icuSources / test / cintltst / cldrtest.c
index c89d74901a4a3a7d5681fd2e0a6b5ecf385c4101..bc8d07e8789f0b8b76182dcd3185f94f268fbffc 100644 (file)
@@ -1,6 +1,8 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /********************************************************************
  * COPYRIGHT:
- * Copyright (c) 1997-2010, International Business Machines Corporation and
+ * Copyright (c) 1997-2016, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -12,6 +14,8 @@
 #include "unicode/udat.h"
 #include "unicode/uscript.h"
 #include "unicode/ulocdata.h"
+#include "unicode/utf16.h"
+#include "cmemory.h"
 #include "cstring.h"
 #include "locmap.h"
 #include "uresimp.h"
@@ -38,7 +42,7 @@ createFlattenSet(USet *origSet, UErrorCode *status) {
     for (idx = 0; idx < origItemCount; idx++) {
         graphmeSize = uset_getItem(origSet, idx,
             &start, &end,
-            graphme, (int32_t)(sizeof(graphme)/sizeof(graphme[0])),
+            graphme, UPRV_LENGTHOF(graphme),
             status);
         if (U_FAILURE(*status)) {
             log_err("ERROR: uset_getItem returned %s\n", u_errorName(*status));
@@ -51,8 +55,10 @@ createFlattenSet(USet *origSet, UErrorCode *status) {
             uset_addRange(newSet, start, end);
         }
     }
+    uset_closeOver(newSet,USET_CASE_INSENSITIVE);
     return newSet;
 }
+
 static UBool
 isCurrencyPreEuro(const char* currencyKey){
     if( strcmp(currencyKey, "PTE") == 0 ||
@@ -66,6 +72,7 @@ isCurrencyPreEuro(const char* currencyKey){
     }
     return FALSE;
 }
+#if !UCONFIG_NO_FILE_IO && !UCONFIG_NO_LEGACY_CONVERSION
 static void
 TestKeyInRootRecursive(UResourceBundle *root, const char *rootName,
                        UResourceBundle *currentBundle, const char *locale) {
@@ -80,6 +87,7 @@ TestKeyInRootRecursive(UResourceBundle *root, const char *rootName,
 
         errorCode = U_ZERO_ERROR;
         currentBundleKey = ures_getKey(currentBundle);
+        (void)currentBundleKey;    /* Suppress set but not used warning. */
         subBundle = ures_getNextResource(currentBundle, NULL, &errorCode);
         if (U_FAILURE(errorCode)) {
             log_err("Can't open a resource for lnocale %s. Error: %s\n", locale, u_errorName(errorCode));
@@ -311,6 +319,7 @@ TestKeyInRootRecursive(UResourceBundle *root, const char *rootName,
                                 locale);
                     }
                 }
+                (void)sameArray;    /* Suppress set but not used warning. */
 /*                if (sameArray && strcmp(rootName, "root") == 0) {
                     log_err("Arrays are the same with key \"%s\" in \"%s\" from root for locale \"%s\"\n",
                             subBundleKey,
@@ -439,7 +448,7 @@ TestKeyInRootRecursive(UResourceBundle *root, const char *rootName,
         ures_close(subBundle);
     }
 }
-
+#endif
 
 static void
 testLCID(UResourceBundle *currentBundle,
@@ -448,6 +457,7 @@ testLCID(UResourceBundle *currentBundle,
     UErrorCode status = U_ZERO_ERROR;
     uint32_t expectedLCID;
     char lcidStringC[64] = {0};
+    int32_t len;
 
     expectedLCID = uloc_getLCID(localeName);
     if (expectedLCID == 0) {
@@ -457,11 +467,12 @@ testLCID(UResourceBundle *currentBundle,
     }
 
     status = U_ZERO_ERROR;
-    uprv_strcpy(lcidStringC, uprv_convertToPosix(expectedLCID, &status));
+    len = uprv_convertToPosix(expectedLCID, lcidStringC, UPRV_LENGTHOF(lcidStringC) - 1, &status);
     if (U_FAILURE(status)) {
         log_err("ERROR:   %.4x does not have a POSIX mapping due to %s\n",
             expectedLCID, u_errorName(status));
     }
+    lcidStringC[len] = 0;
 
     if(strcmp(localeName, lcidStringC) != 0) {
         char langName[1024];
@@ -473,15 +484,22 @@ testLCID(UResourceBundle *currentBundle,
             log_verbose("WARNING: %-5s resolves to %s (0x%.4x)\n",
                 localeName, lcidStringC, expectedLCID);
         }
-        else {
+        else if (!(strcmp(localeName, "ku") == 0 && log_knownIssue("20181", "ICU-20181 Fix LCID mapping for ckb vs ku"))) {
             log_err("ERROR:   %-5s has 0x%.4x and the number resolves wrongfully to %s\n",
                 localeName, expectedLCID, lcidStringC);
         }
     }
 }
 
+#if !UCONFIG_NO_FILE_IO && !UCONFIG_NO_LEGACY_CONVERSION
 static void
 TestLocaleStructure(void) {
+    // This test checks the locale structure against a key file located
+    // at source/test/testdata/structLocale.txt. When adding new data to
+    // a locale file such as en.txt, the structLocale.txt file must be changed
+    // too to include the the template of the new data. Otherwise this test
+    // will fail!
+
     UResourceBundle *root, *currentLocale;
     int32_t locCount = uloc_countAvailable();
     int32_t locIndex;
@@ -546,7 +564,9 @@ TestLocaleStructure(void) {
                 currLoc);
         }
         resolvedLoc = ures_getLocaleByType(currentLocale, ULOC_ACTUAL_LOCALE, &errorCode);
-        if (strcmp(resolvedLoc, currLoc) != 0) {
+        if (strcmp(resolvedLoc, currLoc) != 0 && strcmp(currLoc, "ars") != 0 && strcmp(currLoc, "wuu") != 0 // /* ars,wuu are aliased locales */
+                && strcmp(currLoc, "ur_Arab_IN") != 0 && strcmp(currLoc, "ur_Aran_IN") != 0 /* so are ur_Ara?_IN <rdar://problem/47494884> */
+                && strcmp(currLoc, "pa_Aran") != 0) { /* and pa_Aran <rdar://problem/51418203> */
             /* All locales have at least a Version resource.
                If it's absolutely empty, then the previous test will fail too.*/
             log_err("Locale resolves to different locale. Is %s an alias of %s?\n",
@@ -561,6 +581,7 @@ TestLocaleStructure(void) {
 
     ures_close(root);
 }
+#endif
 
 static void
 compareArrays(const char *keyName,
@@ -599,7 +620,6 @@ compareArrays(const char *keyName,
 static void
 compareConsistentCountryInfo(const char *fromLocale, const char *toLocale) {
     UErrorCode errorCode = U_ZERO_ERROR;
-    UResourceBundle *fromDateTimeElements, *toDateTimeElements, *fromWeekendData = NULL, *toWeekendData = NULL;
     UResourceBundle *fromArray, *toArray;
     UResourceBundle *fromLocaleBund = ures_open(NULL, fromLocale, &errorCode);
     UResourceBundle *toLocaleBund = ures_open(NULL, toLocale, &errorCode);
@@ -611,77 +631,9 @@ compareConsistentCountryInfo(const char *fromLocale, const char *toLocale) {
     }
     fromCalendar = ures_getByKey(fromLocaleBund, "calendar", NULL, &errorCode);
     fromGregorian = ures_getByKeyWithFallback(fromCalendar, "gregorian", NULL, &errorCode);
-    fromDateTimeElements = ures_getByKeyWithFallback(fromGregorian, "DateTimeElements", NULL, &errorCode);
 
     toCalendar = ures_getByKey(toLocaleBund, "calendar", NULL, &errorCode);
     toGregorian = ures_getByKeyWithFallback(toCalendar, "gregorian", NULL, &errorCode);
-    toDateTimeElements = ures_getByKeyWithFallback(toGregorian, "DateTimeElements", NULL, &errorCode);
-
-    if(U_FAILURE(errorCode)){
-        log_err("Did not get DateTimeElements from the bundle %s or %s\n", fromLocale, toLocale);
-        goto cleanup;
-    }
-
-    fromWeekendData = ures_getByKeyWithFallback(fromGregorian, "weekend", NULL, &errorCode);
-    if(U_FAILURE(errorCode)){
-        log_err("Did not get weekend data from the bundle %s to compare against %s\n", fromLocale, toLocale);
-        goto cleanup;
-    }
-    toWeekendData = ures_getByKeyWithFallback(toGregorian, "weekend", NULL, &errorCode);
-    if(U_FAILURE(errorCode)){
-        log_err("Did not get weekend data from the bundle %s to compare against %s\n", toLocale, fromLocale);
-        goto cleanup;
-    }
-
-    if (strcmp(fromLocale, "ar_IN") != 0)
-    {
-        int32_t fromSize;
-        int32_t toSize;
-        int32_t idx;
-        const int32_t *fromBundleArr = ures_getIntVector(fromDateTimeElements, &fromSize, &errorCode);
-        const int32_t *toBundleArr = ures_getIntVector(toDateTimeElements, &toSize, &errorCode);
-
-        if (fromSize > toSize) {
-            fromSize = toSize;
-            log_err("Arrays are different size with key \"DateTimeElements\" from \"%s\" to \"%s\"\n",
-                    fromLocale,
-                    toLocale);
-        }
-
-        for (idx = 0; idx < fromSize; idx++) {
-            if (fromBundleArr[idx] != toBundleArr[idx]) {
-                log_err("Difference with key \"DateTimeElements\" at index %d from \"%s\" to \"%s\"\n",
-                        idx,
-                        fromLocale,
-                        toLocale);
-            }
-        }
-    }
-
-    /* test for weekend data */
-    {
-        int32_t fromSize;
-        int32_t toSize;
-        int32_t idx;
-        const int32_t *fromBundleArr = ures_getIntVector(fromWeekendData, &fromSize, &errorCode);
-        const int32_t *toBundleArr = ures_getIntVector(toWeekendData, &toSize, &errorCode);
-
-        if (fromSize > toSize) {
-            fromSize = toSize;
-            log_err("Arrays are different size with key \"weekend\" data from \"%s\" to \"%s\"\n",
-                    fromLocale,
-                    toLocale);
-        }
-
-        for (idx = 0; idx < fromSize; idx++) {
-            if (fromBundleArr[idx] != toBundleArr[idx]) {
-                log_err("Difference with key \"weekend\" data at index %d from \"%s\" to \"%s\"\n",
-                        idx,
-                        fromLocale,
-                        toLocale);
-            }
-        }
-    }
 
     fromArray = ures_getByKey(fromLocaleBund, "CurrencyElements", NULL, &errorCode);
     toArray = ures_getByKey(toLocaleBund, "CurrencyElements", NULL, &errorCode);
@@ -722,13 +674,6 @@ compareConsistentCountryInfo(const char *fromLocale, const char *toLocale) {
     }
     ures_close(fromArray);
     ures_close(toArray);
-
-cleanup:
-    ures_close(fromDateTimeElements);
-    ures_close(toDateTimeElements);
-    ures_close(fromWeekendData);
-    ures_close(toWeekendData);
-
     ures_close(fromCalendar);
     ures_close(toCalendar);
     ures_close(fromGregorian);
@@ -763,7 +708,7 @@ TestConsistentCountryInfo(void) {
         }
         fromVariantLen = uloc_getVariant(fromLocale, fromVariant, ULOC_FULLNAME_CAPACITY, &errorCode);
         if (fromVariantLen > 0) {
-            /* Most variants are ignorable like PREEURO, or collation variants. */
+            /* Most variants are ignorable like collation variants. */
             continue;
         }
         /* Start comparing only after the current index.
@@ -785,7 +730,7 @@ TestConsistentCountryInfo(void) {
             }
             toVariantLen = uloc_getVariant(toLocale, toVariant, ULOC_FULLNAME_CAPACITY, &errorCode);
             if (toVariantLen > 0) {
-                /* Most variants are ignorable like PREEURO, or collation variants. */
+                /* Most variants are ignorable like collation variants. */
                 /* They're a variant for a reason. */
                 continue;
             }
@@ -800,26 +745,30 @@ TestConsistentCountryInfo(void) {
 
 static int32_t
 findStringSetMismatch(const char *currLoc, const UChar *string, int32_t langSize,
-                      const UChar *exemplarCharacters, int32_t exemplarLen,
-                      UBool ignoreNumbers, UChar* badCharPtr) {
+                      USet * mergedExemplarSet,
+                      UBool ignoreNumbers, UChar32* badCharPtr) {
     UErrorCode errorCode = U_ZERO_ERROR;
-    USet *origSet = uset_openPatternOptions(exemplarCharacters, exemplarLen, USET_CASE_INSENSITIVE, &errorCode);
-    USet *exemplarSet = createFlattenSet(origSet, &errorCode);
+    USet *exemplarSet;
     int32_t strIdx;
-    uset_close(origSet);
+    if (mergedExemplarSet == NULL) {
+        return -1;
+    }
+    exemplarSet = createFlattenSet(mergedExemplarSet, &errorCode);
     if (U_FAILURE(errorCode)) {
-        log_err("%s: error uset_openPattern returned %s\n", currLoc, u_errorName(errorCode));
+        log_err("%s: error createFlattenSet returned %s\n", currLoc, u_errorName(errorCode));
         return -1;
     }
 
-    for (strIdx = 0; strIdx < langSize; strIdx++) {
-        if (!uset_contains(exemplarSet, string[strIdx])
-            && string[strIdx] != 0x0020 && string[strIdx] != 0x00A0 && string[strIdx] != 0x002e && string[strIdx] != 0x002c && string[strIdx] != 0x002d && string[strIdx] != 0x0027 && string[strIdx] != 0x2019 && string[strIdx] != 0x0f0b
-            && string[strIdx] != 0x200C && string[strIdx] != 0x200D) {
-            if (!ignoreNumbers || (ignoreNumbers && (string[strIdx] < 0x30 || string[strIdx] > 0x39))) {
+    for (strIdx = 0; strIdx < langSize;) {
+        UChar32 testChar;
+        U16_NEXT(string, strIdx, langSize, testChar);
+        if (!uset_contains(exemplarSet, testChar)
+            && testChar != 0x0020 && testChar != 0x00A0 && testChar != 0x002e && testChar != 0x002c && testChar != 0x002d && testChar != 0x0027
+            && testChar != 0x005B && testChar != 0x005D && testChar != 0x2019 && testChar != 0x0f0b && testChar != 0x200C && testChar != 0x200D) {
+            if (!ignoreNumbers || (ignoreNumbers && (testChar < 0x30 || testChar > 0x39))) {
                 uset_close(exemplarSet);
                 if (badCharPtr) {
-                    *badCharPtr = string[strIdx];
+                    *badCharPtr = testChar;
                 }
                 return strIdx;
             }
@@ -938,13 +887,10 @@ findSetMatch( UScriptCode *scriptCodes, int32_t scriptsLen,
 }
 
 static void VerifyTranslation(void) {
-    static const UVersionInfo icu47 = { 4, 7, 0, 0 };
     UResourceBundle *root, *currentLocale;
     int32_t locCount = uloc_countAvailable();
     int32_t locIndex;
     UErrorCode errorCode = U_ZERO_ERROR;
-    int32_t exemplarLen;
-    const UChar *exemplarCharacters;
     const char *currLoc;
     UScriptCode scripts[USCRIPT_CODE_LIMIT];
     int32_t numScripts;
@@ -962,6 +908,7 @@ static void VerifyTranslation(void) {
         return;
     }
     for (locIndex = 0; locIndex < locCount; locIndex++) {
+        USet * mergedExemplarSet = NULL;
         errorCode=U_ZERO_ERROR;
         currLoc = uloc_getAvailable(locIndex);
         currentLocale = ures_open(NULL, currLoc, &errorCode);
@@ -979,44 +926,72 @@ static void VerifyTranslation(void) {
             ures_close(currentLocale);
             continue;
         }
-        exemplarCharacters = ures_getStringByKey(currentLocale, "ExemplarCharacters", &exemplarLen, &errorCode);
-        if (U_FAILURE(errorCode)) {
-            log_err("error ures_getStringByKey returned %s\n", u_errorName(errorCode));
+        {
+            UErrorCode exemplarStatus = U_ZERO_ERROR;
+            ULocaleData * uld = ulocdata_open(currLoc, &exemplarStatus);
+            if (U_SUCCESS(exemplarStatus)) {
+                USet * exemplarSet = ulocdata_getExemplarSet(uld, NULL, USET_ADD_CASE_MAPPINGS, ULOCDATA_ES_STANDARD, &exemplarStatus);
+                if (U_SUCCESS(exemplarStatus)) {
+                    mergedExemplarSet = uset_cloneAsThawed(exemplarSet);
+                    uset_close(exemplarSet);
+                    exemplarSet = ulocdata_getExemplarSet(uld, NULL, USET_ADD_CASE_MAPPINGS, ULOCDATA_ES_AUXILIARY, &exemplarStatus);
+                    if (U_SUCCESS(exemplarStatus)) {
+                        uset_addAll(mergedExemplarSet, exemplarSet);
+                        uset_close(exemplarSet);
+                    }
+                    exemplarStatus = U_ZERO_ERROR;
+                    exemplarSet = ulocdata_getExemplarSet(uld, NULL, 0, ULOCDATA_ES_PUNCTUATION, &exemplarStatus);
+                    if (U_SUCCESS(exemplarStatus)) {
+                        uset_addAll(mergedExemplarSet, exemplarSet);
+                        uset_close(exemplarSet);
+                    }
+                } else {
+                    log_err("error ulocdata_getExemplarSet (main) for locale %s returned %s\n", currLoc, u_errorName(errorCode));
+                }
+                ulocdata_close(uld);
+            } else {
+                log_err("error ulocdata_open for locale %s returned %s\n", currLoc, u_errorName(errorCode));
+            }
         }
-        else if (getTestOption(QUICK_OPTION) && exemplarLen > 2048) {
+        if (mergedExemplarSet == NULL /*|| (getTestOption(QUICK_OPTION) && uset_size() > 2048)*/) {
             log_verbose("skipping test for %s\n", currLoc);
         }
-        else if (uprv_strncmp(currLoc,"bem",3) == 0) {
-            log_verbose("skipping test for %s, some month and country names known to use aux exemplars\n", currLoc);
-        }
+        //else if (uprv_strncmp(currLoc,"bem",3) == 0 || uprv_strncmp(currLoc,"mgo",3) == 0 || uprv_strncmp(currLoc,"nl",2) == 0) {
+        //    log_verbose("skipping test for %s, some month and country names known to use aux exemplars\n", currLoc);
+        //}
         else {
             UChar langBuffer[128];
             int32_t langSize;
             int32_t strIdx;
-            UChar badChar;
-            langSize = uloc_getDisplayLanguage(currLoc, currLoc, langBuffer, sizeof(langBuffer)/sizeof(langBuffer[0]), &errorCode);
+            UChar32 badChar;
+            langSize = uloc_getDisplayLanguage(currLoc, currLoc, langBuffer, UPRV_LENGTHOF(langBuffer), &errorCode);
             if (U_FAILURE(errorCode)) {
                 log_err("error uloc_getDisplayLanguage returned %s\n", u_errorName(errorCode));
-            }
-            else {
-                strIdx = findStringSetMismatch(currLoc, langBuffer, langSize, exemplarCharacters, exemplarLen, FALSE, &badChar);
+            } else if (uprv_strncmp(currLoc,"gez",3) == 0 || uprv_strcmp(currLoc,"sa") == 0 || uprv_strncmp(currLoc,"sa_",3) == 0) { // Apple xtra locales
+                log_verbose("skipping DisplayLanguage test for %s, name or exemplars may need adjustment\n", currLoc);
+            } else {
+                strIdx = findStringSetMismatch(currLoc, langBuffer, langSize, mergedExemplarSet, FALSE, &badChar);
                 if (strIdx >= 0) {
-                    log_err("getDisplayLanguage(%s) at index %d returned characters not in the exemplar characters: %04X.\n",
-                        currLoc, strIdx, badChar);
+                    char bbuf[256];
+                    log_err("getDisplayLanguage(%s) at index %d returned characters not in the exemplar characters: %04X in \"%s\"\n",
+                        currLoc, strIdx, badChar, u_austrncpy(bbuf,langBuffer,langSize));
                 }
             }
-            langSize = uloc_getDisplayCountry(currLoc, currLoc, langBuffer, sizeof(langBuffer)/sizeof(langBuffer[0]), &errorCode);
+            langSize = uloc_getDisplayCountry(currLoc, currLoc, langBuffer, UPRV_LENGTHOF(langBuffer), &errorCode);
             if (U_FAILURE(errorCode)) {
                 log_err("error uloc_getDisplayCountry returned %s\n", u_errorName(errorCode));
             }
-            else if (uprv_strstr(currLoc, "ti_") != currLoc || isICUVersionAtLeast(icu47)) { /* TODO: restore DisplayCountry test for ti_* when cldrbug 3058 is fixed) */
-              strIdx = findStringSetMismatch(currLoc, langBuffer, langSize, exemplarCharacters, exemplarLen, FALSE, &badChar);
-                if (strIdx >= 0) {
-                    log_err("getDisplayCountry(%s) at index %d returned characters not in the exemplar characters: %04X.\n",
-                        currLoc, strIdx, badChar);
-                }
-            }
-            {
+            if (    uprv_strcmp(currLoc,"ba") == 0 || uprv_strncmp(currLoc,"ba_",3) == 0 ||
+                    uprv_strcmp(currLoc,"cv") == 0 || uprv_strncmp(currLoc,"cv_",3) == 0 ||
+                    uprv_strcmp(currLoc,"dv") == 0 || uprv_strncmp(currLoc,"dv_",3) == 0 ||
+                    uprv_strcmp(currLoc,"sa") == 0 || uprv_strncmp(currLoc,"sa_",3) == 0 ||
+                    uprv_strncmp(currLoc,"kaj",3) == 0 || uprv_strncmp(currLoc,"kpe",3) == 0 ||
+                    uprv_strncmp(currLoc,"nqo",3) == 0 || uprv_strncmp(currLoc,"sat",3) == 0 ||
+                    uprv_strncmp(currLoc,"syr",3) == 0 ||
+                    uprv_strcmp(currLoc,"ks_Deva") == 0 || uprv_strncmp(currLoc,"mni_Mtei",8) == 0 ||
+                    uprv_strcmp(currLoc,"sd_Deva") == 0 ) { // Apple xtra locales
+                log_verbose("skipping day/month tests for %s, missing some translated names\n", currLoc);
+            } else {
                 UResourceBundle* cal = ures_getByKey(currentLocale, "calendar", NULL, &errorCode);
                 UResourceBundle* greg = ures_getByKeyWithFallback(cal, "gregorian", NULL, &errorCode);
                 UResourceBundle* names = ures_getByKeyWithFallback(greg,  "dayNames", NULL, &errorCode);
@@ -1033,6 +1008,10 @@ static void VerifyTranslation(void) {
                     end = ures_getSize(resArray);
                 }
 
+                if ((uprv_strncmp(currLoc,"lrc",3) == 0 || uprv_strncmp(currLoc,"mzn",3) == 0) && 
+                        log_knownIssue("cldrbug:8899", "lrc and mzn locales don't have translated day names")) {
+                    end = 0;
+                }
 
                 for (idx = 0; idx < end; idx++) {
                     const UChar *fromBundleStr = ures_getStringByIndex(resArray, idx, &langSize, &errorCode);
@@ -1040,8 +1019,8 @@ static void VerifyTranslation(void) {
                         log_err("error ures_getStringByIndex(%d) returned %s\n", idx, u_errorName(errorCode));
                         continue;
                     }
-                    strIdx = findStringSetMismatch(currLoc, fromBundleStr, langSize, exemplarCharacters, exemplarLen, TRUE, &badChar);
-                    if (strIdx >= 0) {
+                    strIdx = findStringSetMismatch(currLoc, fromBundleStr, langSize, mergedExemplarSet, TRUE, &badChar);
+                    if ( strIdx >= 0 ) { 
                         log_err("getDayNames(%s, %d) at index %d returned characters not in the exemplar characters: %04X.\n",
                             currLoc, idx, strIdx, badChar);
                     }
@@ -1069,7 +1048,7 @@ static void VerifyTranslation(void) {
                         log_err("error ures_getStringByIndex(%d) returned %s\n", idx, u_errorName(errorCode));
                         continue;
                     }
-                    strIdx = findStringSetMismatch(currLoc, fromBundleStr, langSize, exemplarCharacters, exemplarLen, TRUE, &badChar);
+                    strIdx = findStringSetMismatch(currLoc, fromBundleStr, langSize, mergedExemplarSet, TRUE, &badChar);
                     if (strIdx >= 0) {
                         log_err("getMonthNames(%s, %d) at index %d returned characters not in the exemplar characters: %04X.\n",
                             currLoc, idx, strIdx, badChar);
@@ -1082,7 +1061,10 @@ static void VerifyTranslation(void) {
                 ures_close(cal);
             }
             errorCode = U_ZERO_ERROR;
-            numScripts = uscript_getCode(currLoc, scripts, sizeof(scripts)/sizeof(scripts[0]), &errorCode);
+            numScripts = uscript_getCode(currLoc, scripts, UPRV_LENGTHOF(scripts), &errorCode);
+            if (strcmp(currLoc, "yi") == 0 && numScripts > 0 && log_knownIssue("11217", "Fix result of uscript_getCode for yi: USCRIPT_YI -> USCRIPT_HEBREW")) {
+                scripts[0] = USCRIPT_HEBREW;
+            }
             if (numScripts == 0) {
                 log_err("uscript_getCode(%s) doesn't work.\n", currLoc);
             }else if(scripts[0] == USCRIPT_COMMON){
@@ -1110,21 +1092,53 @@ static void VerifyTranslation(void) {
                    log_err("ulocdata_getPaperSize did not return expected data for locale %s \n", currLoc);
                }
            }
-            /* test that the MeasurementSystem works API works */
+            /* test that the MeasurementSystem API works */
            {
-               UMeasurementSystem measurementSystem = ulocdata_getMeasurementSystem(currLoc, &errorCode);
-               if(U_FAILURE(errorCode)){
+               char fullLoc[ULOC_FULLNAME_CAPACITY];
+               UMeasurementSystem measurementSystem;
+               int32_t height = 0, width = 0;
+
+               uloc_addLikelySubtags(currLoc, fullLoc, ULOC_FULLNAME_CAPACITY, &errorCode);
+
+               errorCode = U_ZERO_ERROR;
+               measurementSystem = ulocdata_getMeasurementSystem(currLoc, &errorCode);
+               if (U_FAILURE(errorCode)) {
                    log_err("ulocdata_getMeasurementSystem failed for locale %s with error: %s \n", currLoc, u_errorName(errorCode));
+               } else {
+                   if ( strstr(fullLoc, "_US")!=NULL || strstr(fullLoc, "_MM")!=NULL || strstr(fullLoc, "_LR")!=NULL ) {
+                       if(measurementSystem != UMS_US){
+                            log_err("ulocdata_getMeasurementSystem did not return expected data for locale %s \n", currLoc);
+                       }
+                   } else if ( strstr(fullLoc, "_GB")!=NULL ) {
+                       if(measurementSystem != UMS_UK){
+                            log_err("ulocdata_getMeasurementSystem did not return expected data for locale %s \n", currLoc);
+                       }
+                   } else if (measurementSystem != UMS_SI) {
+                       log_err("ulocdata_getMeasurementSystem did not return expected data for locale %s \n", currLoc);
+                   }
                }
-               if(strstr(currLoc, "_US")!=NULL || strstr(currLoc, "_MM")!=NULL || strstr(currLoc, "_LR")!=NULL){
-                   if(measurementSystem != UMS_US){
-                        log_err("ulocdata_getMeasurementSystem did not return expected data for locale %s \n", currLoc);
+               
+               errorCode = U_ZERO_ERROR;
+               ulocdata_getPaperSize(currLoc, &height, &width, &errorCode);
+               if (U_FAILURE(errorCode)) {
+                   log_err("ulocdata_getPaperSize failed for locale %s with error: %s \n", currLoc, u_errorName(errorCode));
+               } else {
+                   if ( strstr(fullLoc, "_US")!=NULL || strstr(fullLoc, "_BZ")!=NULL || strstr(fullLoc, "_CA")!=NULL || strstr(fullLoc, "_CL")!=NULL ||
+                        strstr(fullLoc, "_CO")!=NULL || strstr(fullLoc, "_CR")!=NULL || strstr(fullLoc, "_GT")!=NULL || strstr(fullLoc, "_MX")!=NULL ||
+                        strstr(fullLoc, "_NI")!=NULL || strstr(fullLoc, "_PA")!=NULL || strstr(fullLoc, "_PH")!=NULL || strstr(fullLoc, "_PR")!=NULL ||
+                        strstr(fullLoc, "_SV")!=NULL || strstr(fullLoc, "_VE")!=NULL ) {
+                       if (height != 279 || width != 216) {
+                            log_err("ulocdata_getPaperSize did not return expected data for locale %s \n", currLoc);
+                       }
+                   } else if (height != 297 || width != 210) {
+                       log_err("ulocdata_getPaperSize did not return expected data for locale %s \n", currLoc);
                    }
-               }else if(measurementSystem != UMS_SI){
-                   log_err("ulocdata_getMeasurementSystem did not return expected data for locale %s \n", currLoc);
                }
            }
         }
+        if (mergedExemplarSet != NULL) {
+            uset_close(mergedExemplarSet);
+        }
         ures_close(currentLocale);
     }
 
@@ -1184,6 +1198,9 @@ static void TestExemplarSet(void){
                 log_err("ExemplarSet contains unassigned characters for locale : %s\n", locale);
             }
             codeLen = uscript_getCode(locale, code, 8, &ec);
+            if (strcmp(locale, "yi") == 0 && codeLen > 0 && log_knownIssue("11217", "Fix result of uscript_getCode for yi: USCRIPT_YI -> USCRIPT_HEBREW")) {
+                code[0] = USCRIPT_HEBREW;
+            }
             if (!assertSuccess("uscript_getCode", &ec)) goto END;
 
             for (j=0; j<MAX_SCRIPTS_PER_LOCALE; ++j) {
@@ -1207,7 +1224,7 @@ static void TestExemplarSet(void){
             itemCount = uset_getItemCount(exemplarSet);
             for (m=0; m<itemCount && !existsInScript; ++m) {
                 strLen = uset_getItem(exemplarSet, m, &start, &end, ubuf,
-                                      sizeof(ubuf)/sizeof(ubuf[0]), &ec);
+                                      UPRV_LENGTHOF(ubuf), &ec);
                 /* failure here might mean str[] needs to be larger */
                 if (!assertSuccess("uset_getItem", &ec)) goto END;
                 if (strLen == 0) {
@@ -1252,26 +1269,58 @@ static void TestExemplarSet(void){
     }
 }
 
+enum { kUBufMax = 32 };
 static void TestLocaleDisplayPattern(void){
-    UErrorCode status = U_ZERO_ERROR;
-    UChar pattern[32] = {0,};
-    UChar separator[32] = {0,};
-    ULocaleData *uld = ulocdata_open(uloc_getDefault(), &status);
+    UErrorCode status;
+    UChar pattern[kUBufMax] = {0,};
+    UChar separator[kUBufMax] = {0,};
+    ULocaleData *uld;
+    static const UChar enExpectPat[] = { 0x007B,0x0030,0x007D,0x0020,0x0028,0x007B,0x0031,0x007D,0x0029,0 }; /* "{0} ({1})" */
+    static const UChar enExpectSep[] = { 0x002C,0x0020,0 }; /* ", " */
+    static const UChar zhExpectPat[] = { 0x007B,0x0030,0x007D,0xFF08,0x007B,0x0031,0x007D,0xFF09,0 };
+    static const UChar zhExpectSep[] = { 0xFF0C,0 };
 
+    status = U_ZERO_ERROR;
+    uld = ulocdata_open("en", &status);
     if(U_FAILURE(status)){
-        log_data_err("ulocdata_open error");
-        return;
-    }
-    ulocdata_getLocaleDisplayPattern(uld, pattern, 32, &status);
-    if (U_FAILURE(status)){
-        log_err("ulocdata_getLocaleDisplayPattern error!");
+        log_data_err("ulocdata_open en error %s", u_errorName(status));
+    } else {
+        ulocdata_getLocaleDisplayPattern(uld, pattern, kUBufMax, &status);
+        if (U_FAILURE(status)){
+            log_err("ulocdata_getLocaleDisplayPattern en error %s", u_errorName(status));
+        } else if (u_strcmp(pattern, enExpectPat) != 0) {
+             log_err("ulocdata_getLocaleDisplayPattern en returns unexpected pattern");
+        }
+        status = U_ZERO_ERROR;
+        ulocdata_getLocaleSeparator(uld, separator, kUBufMax, &status);
+        if (U_FAILURE(status)){
+            log_err("ulocdata_getLocaleSeparator en error %s", u_errorName(status));
+        } else if (u_strcmp(separator, enExpectSep) != 0) {
+             log_err("ulocdata_getLocaleSeparator en returns unexpected string ");
+        }
+        ulocdata_close(uld);
     }
+
     status = U_ZERO_ERROR;
-    ulocdata_getLocaleSeparator(uld, separator, 32, &status);
-    if (U_FAILURE(status)){
-        log_err("ulocdata_getLocaleSeparator error!");
+    uld = ulocdata_open("zh", &status);
+    if(U_FAILURE(status)){
+        log_data_err("ulocdata_open zh error %s", u_errorName(status));
+    } else {
+        ulocdata_getLocaleDisplayPattern(uld, pattern, kUBufMax, &status);
+        if (U_FAILURE(status)){
+            log_err("ulocdata_getLocaleDisplayPattern zh error %s", u_errorName(status));
+        } else if (u_strcmp(pattern, zhExpectPat) != 0) {
+             log_err("ulocdata_getLocaleDisplayPattern zh returns unexpected pattern");
+        }
+        status = U_ZERO_ERROR;
+        ulocdata_getLocaleSeparator(uld, separator, kUBufMax, &status);
+        if (U_FAILURE(status)){
+            log_err("ulocdata_getLocaleSeparator zh error %s", u_errorName(status));
+        } else if (u_strcmp(separator, zhExpectSep) != 0) {
+             log_err("ulocdata_getLocaleSeparator zh returns unexpected string ");
+        }
+        ulocdata_close(uld);
     }
-    ulocdata_close(uld);
 }
 
 static void TestCoverage(void){
@@ -1307,6 +1356,44 @@ static void TestCoverage(void){
     ulocdata_close(uld);
 }
 
+static void TestIndexChars(void) {
+    /* Very basic test of ULOCDATA_ES_INDEX.
+     * No comprehensive test of data, just basic check that the code path is alive.
+     */
+    UErrorCode status = U_ZERO_ERROR;
+    ULocaleData  *uld;
+    USet *exemplarChars;
+    USet *indexChars;
+
+    uld = ulocdata_open("en", &status);
+    exemplarChars = uset_openEmpty();
+    indexChars = uset_openEmpty();
+    ulocdata_getExemplarSet(uld, exemplarChars, 0, ULOCDATA_ES_STANDARD, &status);
+    ulocdata_getExemplarSet(uld, indexChars, 0, ULOCDATA_ES_INDEX, &status);
+    if (U_FAILURE(status)) {
+        log_data_err("File %s, line %d, Failure opening exemplar chars: %s", __FILE__, __LINE__, u_errorName(status));
+        goto close_sets;
+    }
+    /* en data, standard exemplars are [a-z], lower case. */
+    /* en data, index characters are [A-Z], upper case. */
+    if ((uset_contains(exemplarChars, (UChar32)0x41) || uset_contains(indexChars, (UChar32)0x61))) {
+        log_err("File %s, line %d, Exemplar characters incorrect.", __FILE__, __LINE__ );
+        goto close_sets;
+    }
+    if (!(uset_contains(exemplarChars, (UChar32)0x61) && uset_contains(indexChars, (UChar32)0x41) )) {
+        log_err("File %s, line %d, Exemplar characters incorrect.", __FILE__, __LINE__ );
+        goto close_sets;
+    }
+
+  close_sets:
+    uset_close(exemplarChars);
+    uset_close(indexChars);
+    ulocdata_close(uld);
+}
+
+
+
+#if !UCONFIG_NO_FILE_IO && !UCONFIG_NO_LEGACY_CONVERSION
 static void TestCurrencyList(void){
 #if !UCONFIG_NO_FORMATTING
     UErrorCode errorCode = U_ZERO_ERROR;
@@ -1341,6 +1428,157 @@ static void TestCurrencyList(void){
     uenum_close(en);
 #endif
 }
+#endif
+
+static void TestAvailableIsoCodes(void){
+#if !UCONFIG_NO_FORMATTING
+    UErrorCode errorCode = U_ZERO_ERROR;
+    const char* eurCode = "EUR";
+    const char* usdCode = "USD";
+    const char* lastCode = "RHD";
+    const char* zzzCode = "ZZZ";
+    UDate date1950 = (UDate)-630720000000.0;/* year 1950 */
+    UDate date1970 = (UDate)0.0;            /* year 1970 */
+    UDate date1975 = (UDate)173448000000.0; /* year 1975 */
+    UDate date1978 = (UDate)260172000000.0; /* year 1978 */
+    UDate date1981 = (UDate)346896000000.0; /* year 1981 */
+    UDate date1992 = (UDate)693792000000.0; /* year 1992 */
+    UChar* isoCode = (UChar*)malloc(sizeof(UChar) * (uprv_strlen(usdCode) + 1));
+
+    /* testing available codes with no time ranges */
+    u_charsToUChars(eurCode, isoCode, (int32_t)uprv_strlen(usdCode) + 1);
+    if (ucurr_isAvailable(isoCode, U_DATE_MIN, U_DATE_MAX, &errorCode) == FALSE) {
+       log_data_err("FAIL: ISO code (%s) is not found.\n", eurCode);
+    }
+
+    u_charsToUChars(usdCode, isoCode, (int32_t)uprv_strlen(zzzCode) + 1);
+    if (ucurr_isAvailable(isoCode, U_DATE_MIN, U_DATE_MAX, &errorCode) == FALSE) {
+       log_data_err("FAIL: ISO code (%s) is not found.\n", usdCode);
+    }
+
+    u_charsToUChars(zzzCode, isoCode, (int32_t)uprv_strlen(zzzCode) + 1);
+    if (ucurr_isAvailable(isoCode, U_DATE_MIN, U_DATE_MAX, &errorCode) == TRUE) {
+       log_err("FAIL: ISO code (%s) is reported as available, but it doesn't exist.\n", zzzCode);
+    }
+
+    u_charsToUChars(lastCode, isoCode, (int32_t)uprv_strlen(zzzCode) + 1);
+    if (ucurr_isAvailable(isoCode, U_DATE_MIN, U_DATE_MAX, &errorCode) == FALSE) {
+       log_data_err("FAIL: ISO code (%s) is not found.\n", lastCode);
+    }
+
+    /* RHD was used from 1970-02-17  to 1980-04-18*/
+    
+    /* to = null */
+    if (ucurr_isAvailable(isoCode, date1970, U_DATE_MAX, &errorCode) == FALSE) {
+       log_data_err("FAIL: ISO code (%s) was available in time range >1970-01-01.\n", lastCode);
+    }
+
+    if (ucurr_isAvailable(isoCode, date1975, U_DATE_MAX, &errorCode) == FALSE) {
+       log_data_err("FAIL: ISO code (%s) was available in time range >1975.\n", lastCode);
+    }
+
+    if (ucurr_isAvailable(isoCode, date1981, U_DATE_MAX, &errorCode) == TRUE) {
+       log_err("FAIL: ISO code (%s) was not available in time range >1981.\n", lastCode);
+    }
+
+    /* from = null */
+    if (ucurr_isAvailable(isoCode, U_DATE_MIN, date1970, &errorCode) == TRUE) {
+       log_err("FAIL: ISO code (%s) was not available in time range <1970.\n", lastCode);
+    }
+
+    if (ucurr_isAvailable(isoCode, U_DATE_MIN, date1975, &errorCode) == FALSE) {
+       log_data_err("FAIL: ISO code (%s) was available in time range <1975.\n", lastCode);
+    }
+
+    if (ucurr_isAvailable(isoCode, U_DATE_MIN, date1981, &errorCode) == FALSE) {
+       log_data_err("FAIL: ISO code (%s) was available in time range <1981.\n", lastCode);
+    }
+
+    /* full ranges */
+    if (ucurr_isAvailable(isoCode, date1975, date1978, &errorCode) == FALSE) {
+       log_data_err("FAIL: ISO code (%s) was available in time range 1975-1978.\n", lastCode);
+    }
+
+    if (ucurr_isAvailable(isoCode, date1970, date1975, &errorCode) == FALSE) {
+       log_data_err("FAIL: ISO code (%s) was available in time range 1970-1975.\n", lastCode);
+    }
+
+    if (ucurr_isAvailable(isoCode, date1975, date1981, &errorCode) == FALSE) {
+       log_data_err("FAIL: ISO code (%s) was available in time range 1975-1981.\n", lastCode);
+    }
+
+    if (ucurr_isAvailable(isoCode, date1970,  date1981, &errorCode) == FALSE) {
+       log_data_err("FAIL: ISO code (%s) was available in time range 1970-1981.\n", lastCode);
+    }
+
+    if (ucurr_isAvailable(isoCode, date1981,  date1992, &errorCode) == TRUE) {
+       log_err("FAIL: ISO code (%s) was not available in time range 1981-1992.\n", lastCode);
+    }
+
+    if (ucurr_isAvailable(isoCode, date1950,  date1970, &errorCode) == TRUE) {
+       log_err("FAIL: ISO code (%s) was not available in time range 1950-1970.\n", lastCode);
+    }
+
+    /* wrong range - from > to*/
+    if (ucurr_isAvailable(isoCode, date1975,  date1970, &errorCode) == TRUE) {
+       log_err("FAIL: Wrong range 1975-1970 for ISO code (%s) was not reported.\n", lastCode);
+    } else if (errorCode != U_ILLEGAL_ARGUMENT_ERROR) {
+       log_data_err("FAIL: Error code not reported for wrong range 1975-1970 for ISO code (%s).\n", lastCode);
+    }
+
+    free(isoCode);
+#endif
+}
+
+// Apple-specific
+typedef struct {
+    const char* locale;
+    const UChar* quoteStart;
+    const UChar* quoteEnd;
+    const UChar* altQuoteStart;
+    const UChar* altQuoteEnd;
+} DelimItem;
+static const DelimItem delimItems[] = {
+    { "en",    u"“", u"”", u"‘", u"’"},
+    { "es",    u"«", u"»", u"“", u"”"},
+    { "es_MX", u"“", u"”", u"‘", u"’"},
+    { "ja",    u"「", u"」", u"『", u"』"},
+    { NULL,NULL,NULL,NULL,NULL }
+};
+enum {kMaxDelimLen = 8};
+
+static void TestDelimiters(void){
+    const DelimItem* itemPtr;
+    for (itemPtr = delimItems; itemPtr->locale != NULL; itemPtr++) {
+        UErrorCode status = U_ZERO_ERROR;
+        ULocaleData* uldat = ulocdata_open(itemPtr->locale, &status);
+        if (U_FAILURE(status)) {
+            log_data_err("FAIL: ulocdata_open fails for locale %s: %s\n", itemPtr->locale, u_errorName(status));
+        } else {
+            UChar quoteStart[kMaxDelimLen+1];
+            UChar quoteEnd[kMaxDelimLen+1];
+            UChar altQuoteStart[kMaxDelimLen+1];
+            UChar altQuoteEnd[kMaxDelimLen+1];
+
+            ulocdata_getDelimiter(uldat, ULOCDATA_QUOTATION_START, quoteStart, kMaxDelimLen, &status);
+            quoteStart[kMaxDelimLen] = 0;
+            ulocdata_getDelimiter(uldat, ULOCDATA_QUOTATION_END, quoteEnd, kMaxDelimLen, &status);
+            quoteEnd[kMaxDelimLen] = 0;
+            ulocdata_getDelimiter(uldat, ULOCDATA_ALT_QUOTATION_START, altQuoteStart, kMaxDelimLen, &status);
+            altQuoteStart[kMaxDelimLen] = 0;
+            ulocdata_getDelimiter(uldat, ULOCDATA_ALT_QUOTATION_END, altQuoteEnd, kMaxDelimLen, &status);
+            altQuoteEnd[kMaxDelimLen] = 0;
+            if (U_FAILURE(status)) {
+                log_err("FAIL: ulocdata_getDelimiter fails for locale %s: %s\n", itemPtr->locale, u_errorName(status));
+            } else if (u_strcmp(quoteStart, itemPtr->quoteStart) != 0 || u_strcmp(quoteEnd, itemPtr->quoteEnd) != 0 ||
+                       u_strcmp(altQuoteStart, itemPtr->altQuoteStart) != 0 || u_strcmp(altQuoteEnd, itemPtr->altQuoteEnd) != 0) {
+                log_err("FAIL: ulocdata_getDelimiter error for locale %s, one or more delimiters not as expected\n", itemPtr->locale);
+            }
+            ulocdata_close(uldat);
+        }
+    }
+}
+
 
 #define TESTCASE(name) addTest(root, &name, "tsutil/cldrtest/" #name)
 
@@ -1357,4 +1595,8 @@ void addCLDRTest(TestNode** root)
     TESTCASE(TestExemplarSet);
     TESTCASE(TestLocaleDisplayPattern);
     TESTCASE(TestCoverage);
+    TESTCASE(TestIndexChars);
+    TESTCASE(TestAvailableIsoCodes);
+    TESTCASE(TestDelimiters);
 }
+