]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/cintltst/cucdtst.c
ICU-551.51.4.tar.gz
[apple/icu.git] / icuSources / test / cintltst / cucdtst.c
index d188ec801f6620e2a58626997c9b3a4569bb17b7..b7ea2740440ccbb805ab1c25b764f0902cf43733 100644 (file)
@@ -1,16 +1,16 @@
 /********************************************************************
  * COPYRIGHT:
- * Copyright (c) 1997-2003, International Business Machines Corporation and
+ * Copyright (c) 1997-2014, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
-/********************************************************************************
+/*******************************************************************************
 *
 * File CUCDTST.C
 *
 * Modification History:
 *        Name                     Description
 *     Madhu Katragadda            Ported for C API, added tests for string functions
-*********************************************************************************
+********************************************************************************
 */
 
 #include <string.h>
 #include "unicode/putil.h"
 #include "unicode/ustring.h"
 #include "unicode/uloc.h"
+#include "unicode/unorm2.h"
 
 #include "cintltst.h"
+#include "putilimp.h"
 #include "uparse.h"
+#include "ucase.h"
+#include "ubidi_props.h"
 #include "uprops.h"
+#include "uset_imp.h"
 #include "usc_impl.h"
-#include "unormimp.h"
-
-#define LENGTHOF(array) (sizeof(array)/sizeof((array)[0]))
+#include "udatamem.h" /* for testing ucase_openBinary() */
+#include "cucdapi.h"
+#include "cmemory.h"
 
 /* prototypes --------------------------------------------------------------- */
 
@@ -44,24 +49,61 @@ static void TestCodeUnit(void);
 static void TestCodePoint(void);
 static void TestCharLength(void);
 static void TestCharNames(void);
+static void TestUCharFromNameUnderflow(void);
 static void TestMirroring(void);
-       void TestUScriptCodeAPI(void);    /* defined in cucdapi.c */
 static void TestUScriptRunAPI(void);
 static void TestAdditionalProperties(void);
 static void TestNumericProperties(void);
 static void TestPropertyNames(void);
 static void TestPropertyValues(void);
 static void TestConsistency(void);
+static void TestUCase(void);
+static void TestUBiDiProps(void);
+static void TestCaseFolding(void);
 
 /* internal methods used */
 static int32_t MakeProp(char* str);
 static int32_t MakeDir(char* str);
 
-#define LENGTHOF(array) (sizeof(array)/sizeof((array)[0]))
+/* helpers ------------------------------------------------------------------ */
+
+static void
+parseUCDFile(const char *filename,
+             char *fields[][2], int32_t fieldCount,
+             UParseLineFn *lineFn, void *context,
+             UErrorCode *pErrorCode) {
+    char path[256];
+    char backupPath[256];
+
+    if(U_FAILURE(*pErrorCode)) {
+        return;
+    }
+
+    /* Look inside ICU_DATA first */
+    strcpy(path, u_getDataDirectory());
+    strcat(path, ".." U_FILE_SEP_STRING "unidata" U_FILE_SEP_STRING);
+    strcat(path, filename);
+
+    /* As a fallback, try to guess where the source data was located
+     *    at the time ICU was built, and look there.
+     */
+    strcpy(backupPath, ctest_dataSrcDir());
+    strcat(backupPath, U_FILE_SEP_STRING);
+    strcat(backupPath, "unidata" U_FILE_SEP_STRING);
+    strcat(backupPath, filename);
+
+    u_parseDelimitedFile(path, ';', fields, fieldCount, lineFn, context, pErrorCode);
+    if(*pErrorCode==U_FILE_ACCESS_ERROR) {
+        *pErrorCode=U_ZERO_ERROR;
+        u_parseDelimitedFile(backupPath, ';', fields, fieldCount, lineFn, context, pErrorCode);
+    }
+    if(U_FAILURE(*pErrorCode)) {
+        log_err_status(*pErrorCode, "error parsing %s: %s\n", filename, u_errorName(*pErrorCode));
+    }
+}
 
 /* test data ---------------------------------------------------------------- */
 
-static const UChar  LAST_CHAR_CODE_IN_FILE = 0xFFFD;
 static const char tagStrings[] = "MnMcMeNdNlNoZsZlZpCcCfCsCoCnLuLlLtLmLoPcPdPsPePoSmScSkSoPiPf";
 static const int32_t tagValues[] =
     {
@@ -116,17 +158,23 @@ static const char dirStrings[][5] = {
     "RLO",
     "PDF",
     "NSM",
-    "BN"
+    "BN",
+    /* new in Unicode 6.3/ICU 52 */
+    "FSI",
+    "LRI",
+    "RLI",
+    "PDI"
 };
 
 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, &TestBinaryValues, "tsutil/cucdtst/TestBinaryValues");
+    addTest(root, &TestUnicodeData, "tsutil/cucdtst/TestUnicodeData");
     addTest(root, &TestAdditionalProperties, "tsutil/cucdtst/TestAdditionalProperties");
     addTest(root, &TestNumericProperties, "tsutil/cucdtst/TestNumericProperties");
     addTest(root, &TestUpperLower, "tsutil/cucdtst/TestUpperLower");
@@ -136,12 +184,19 @@ void addUnicodeTest(TestNode** root)
     addTest(root, &TestControlPrint, "tsutil/cucdtst/TestControlPrint");
     addTest(root, &TestIdentifier, "tsutil/cucdtst/TestIdentifier");
     addTest(root, &TestCharNames, "tsutil/cucdtst/TestCharNames");
+    addTest(root, &TestUCharFromNameUnderflow, "tsutil/cucdtst/TestUCharFromNameUnderflow");
     addTest(root, &TestMirroring, "tsutil/cucdtst/TestMirroring");
     addTest(root, &TestUScriptCodeAPI, "tsutil/cucdtst/TestUScriptCodeAPI");
+    addTest(root, &TestHasScript, "tsutil/cucdtst/TestHasScript");
+    addTest(root, &TestGetScriptExtensions, "tsutil/cucdtst/TestGetScriptExtensions");
+    addTest(root, &TestScriptMetadataAPI, "tsutil/cucdtst/TestScriptMetadataAPI");
     addTest(root, &TestUScriptRunAPI, "tsutil/cucdtst/TestUScriptRunAPI");
     addTest(root, &TestPropertyNames, "tsutil/cucdtst/TestPropertyNames");
     addTest(root, &TestPropertyValues, "tsutil/cucdtst/TestPropertyValues");
     addTest(root, &TestConsistency, "tsutil/cucdtst/TestConsistency");
+    addTest(root, &TestUCase, "tsutil/cucdtst/TestUCase");
+    addTest(root, &TestUBiDiProps, "tsutil/cucdtst/TestUBiDiProps");
+    addTest(root, &TestCaseFolding, "tsutil/cucdtst/TestCaseFolding");
 }
 
 /*==================================================== */
@@ -164,7 +219,8 @@ Checks LetterLike Symbols which were previously a source of confusion
 */
     for (i=0x2100;i<0x2138;i++)
     {
-        if(i!=0x2126 && i!=0x212a && i!=0x212b)
+        /* Unicode 5.0 adds lowercase U+214E (TURNED SMALL F) to U+2132 (TURNED CAPITAL F) */
+        if(i!=0x2126 && i!=0x212a && i!=0x212b && i!=0x2132)
         {
             if (i != (int)u_tolower(i)) /* itself */
                 log_err("Failed case conversion with itself: U+%04x\n", i);
@@ -277,57 +333,77 @@ Checks LetterLike Symbols which were previously a source of confusion
     }
 }
 
-/* compare two sets, which is not easy with the current (ICU 2.4) C API... */
-
+/* compare two sets and verify that their difference or intersection is empty */
 static UBool
 showADiffB(const USet *a, const USet *b,
            const char *a_name, const char *b_name,
            UBool expect, UBool diffIsError) {
+    USet *aa;
     int32_t i, start, end, length;
-    UBool equal;
     UErrorCode errorCode;
 
+    /*
+     * expect:
+     * TRUE  -> a-b should be empty, that is, b should contain all of a
+     * FALSE -> a&b should be empty, that is, a should contain none of b (and vice versa)
+     */
+    if(expect ? uset_containsAll(b, a) : uset_containsNone(a, b)) {
+        return TRUE;
+    }
+
+    /* clone a to aa because a is const */
+    aa=uset_open(1, 0);
+    if(aa==NULL) {
+        /* unusual problem - out of memory? */
+        return FALSE;
+    }
+    uset_addAll(aa, a);
+
+    /* compute the set in question */
+    if(expect) {
+        /* a-b */
+        uset_removeAll(aa, b);
+    } else {
+        /* a&b */
+        uset_retainAll(aa, b);
+    }
+
+    /* aa is not empty because of the initial tests above; show its contents */
     errorCode=U_ZERO_ERROR;
-    equal=TRUE;
     i=0;
     for(;;) {
-        length=uset_getItem(a, i, &start, &end, NULL, 0, &errorCode);
+        length=uset_getItem(aa, i, &start, &end, NULL, 0, &errorCode);
         if(errorCode==U_INDEX_OUTOFBOUNDS_ERROR) {
-            return equal; /* done */
+            break; /* done */
         }
         if(U_FAILURE(errorCode)) {
-            log_err("error comparing %s with %s at item %d: %s\n",
+            log_err("error comparing %s with %s at difference item %d: %s\n",
                 a_name, b_name, i, u_errorName(errorCode));
-            return FALSE;
+            break;
         }
         if(length!=0) {
-            return equal; /* done with code points, got a string or -1 */
+            break; /* done with code points, got a string or -1 */
         }
 
-        if(expect!=uset_containsRange(b, start, end)) {
-            equal=FALSE;
-            while(start<=end) {
-                if(expect!=uset_contains(b, start)) {
-                    if(diffIsError) {
-                        if(expect) {
-                            log_err("error: %s contains U+%04x but %s does not\n", a_name, start, b_name);
-                        } else {
-                            log_err("error: %s and %s both contain U+%04x but should not intersect\n", a_name, b_name, start);
-                        }
-                    } else {
-                        if(expect) {
-                            log_verbose("info: %s contains U+%04x but %s does not\n", a_name, start, b_name);
-                        } else {
-                            log_verbose("info: %s and %s both contain U+%04x but should not intersect\n", a_name, b_name, start);
-                        }
-                    }
-                }
-                ++start;
+        if(diffIsError) {
+            if(expect) {
+                log_err("error: %s contains U+%04x..U+%04x but %s does not\n", a_name, start, end, b_name);
+            } else {
+                log_err("error: %s and %s both contain U+%04x..U+%04x but should not intersect\n", a_name, b_name, start, end);
+            }
+        } else {
+            if(expect) {
+                log_verbose("info: %s contains U+%04x..U+%04x but %s does not\n", a_name, start, end, b_name);
+            } else {
+                log_verbose("info: %s and %s both contain U+%04x..U+%04x but should not intersect\n", a_name, b_name, start, end);
             }
         }
 
         ++i;
     }
+
+    uset_close(aa);
+    return FALSE;
 }
 
 static UBool
@@ -348,8 +424,12 @@ static UBool
 compareUSets(const USet *a, const USet *b,
              const char *a_name, const char *b_name,
              UBool diffIsError) {
+    /*
+     * Use an arithmetic & not a logical && so that both branches
+     * are always taken and all differences are shown.
+     */
     return
-        showAMinusB(a, b, a_name, b_name, diffIsError) &&
+        showAMinusB(a, b, a_name, b_name, diffIsError) &
         showAMinusB(b, a, b_name, a_name, diffIsError);
 }
 
@@ -399,9 +479,10 @@ static void TestLetterNumber()
          * The following checks work only starting from Unicode 4.0.
          * Check the version number here.
          */
+        static UVersionInfo u401={ 4, 0, 1, 0 };
         UVersionInfo version;
         u_getUnicodeVersion(version);
-        if(version[0]<4) {
+        if(version[0]<4 || 0==memcmp(version, u401, 4)) {
             return;
         }
     }
@@ -416,13 +497,9 @@ static void TestLetterNumber()
          * (which checks Nd).
          *
          * This was not true in Unicode 3.2 and earlier.
-         * The following characters had decimal digit values but were No not Nd.
-         * (from DerivedNumericType-3.2.0.txt)
-00B2..00B3    ; decimal # No   [2] SUPERSCRIPT TWO..SUPERSCRIPT THREE
-00B9          ; decimal # No       SUPERSCRIPT ONE
-2070          ; decimal # No       SUPERSCRIPT ZERO
-2074..2079    ; decimal # No   [6] SUPERSCRIPT FOUR..SUPERSCRIPT NINE
-2080..2089    ; decimal # No  [10] SUBSCRIPT ZERO..SUBSCRIPT NINE
+         * Unicode 4.0 fixed discrepancies.
+         * Unicode 4.0.1 re-introduced problems in this area due to an
+         * unintentionally incomplete last-minute change.
          */
         U_STRING_DECL(digitsPattern, "[:Nd:]", 6);
         U_STRING_DECL(decimalValuesPattern, "[:Numeric_Type=Decimal:]", 24);
@@ -445,21 +522,33 @@ static void TestLetterNumber()
     }
 }
 
+static void testSampleCharProps(UBool propFn(UChar32), const char *propName,
+                                const UChar32 *sampleChars, int32_t sampleCharsLength,
+                                UBool expected) {
+    int32_t i;
+    for (i = 0; i < sampleCharsLength; ++i) {
+        UBool result = propFn(sampleChars[i]);
+        if (result != expected) {
+            log_err("error: character property function %s(U+%04x)=%d is wrong\n",
+                    propName, sampleChars[i], result);
+        }
+    }
+}
+
 /* Tests for isDefined(u_isdefined)(, isBaseForm(u_isbase()), isSpaceChar(u_isspace()), isWhiteSpace(), u_CharDigitValue() */
 static void TestMisc()
 {
-    static const UChar sampleSpaces[] = {0x0020, 0x00a0, 0x2000, 0x2001, 0x2005};
-    static const UChar sampleNonSpaces[] = {0x61, 0x62, 0x63, 0x64, 0x74};
-    static const UChar sampleUndefined[] = {0xfff1, 0xfff7, 0xfa6b };
-    static const UChar sampleDefined[] = {0x523E, 0x4f88, 0xfffd};
-    static const UChar sampleBase[] = {0x0061, 0x0031, 0x03d2};
-    static const UChar sampleNonBase[] = {0x002B, 0x0020, 0x203B};
+    static const UChar32 sampleSpaces[] = {0x0020, 0x00a0, 0x2000, 0x2001, 0x2005};
+    static const UChar32 sampleNonSpaces[] = {0x61, 0x62, 0x63, 0x64, 0x74};
+    static const UChar32 sampleUndefined[] = {0xfff1, 0xfff7, 0xfa6e};
+    static const UChar32 sampleDefined[] = {0x523E, 0x4f88, 0xfffd};
+    static const UChar32 sampleBase[] = {0x0061, 0x0031, 0x03d2};
+    static const UChar32 sampleNonBase[] = {0x002B, 0x0020, 0x203B};
 /*    static const UChar sampleChars[] = {0x000a, 0x0045, 0x4e00, 0xDC00, 0xFFE8, 0xFFF0};*/
-    static const UChar sampleDigits[]= {0x0030, 0x0662, 0x0F23, 0x0ED5};
-    static const UChar sampleNonDigits[] = {0x0010, 0x0041, 0x0122, 0x68FE};
-    static const UChar sampleWhiteSpaces[] = {0x2008, 0x2009, 0x200a, 0x001c, 0x000c};
-    static const UChar sampleNonWhiteSpaces[] = {0x61, 0x62, 0x3c, 0x28, 0x3f};
-
+    static const UChar32 sampleDigits[]= {0x0030, 0x0662, 0x0F23, 0x0ED5};
+    static const UChar32 sampleNonDigits[] = {0x0010, 0x0041, 0x0122, 0x68FE};
+    static const UChar32 sampleWhiteSpaces[] = {0x2008, 0x2009, 0x200a, 0x001c, 0x000c};
+    static const UChar32 sampleNonWhiteSpaces[] = {0x61, 0x62, 0x3c, 0x28, 0x3f, 0x85, 0x2007, 0xffef};
 
     static const int32_t sampleDigitValues[] = {0, 2, 3, 5};
 
@@ -471,60 +560,41 @@ static void TestMisc()
 
     memset(icuVersion, 0, U_MAX_VERSION_STRING_LENGTH);
 
-    log_verbose("Testing for isspace and nonspaces\n");
-    for (i = 0; i < 5; i++) {
-        if (!(u_isspace(sampleSpaces[i])) ||
-                (u_isspace(sampleNonSpaces[i])))
-        {
-            log_err("Space char test error : %d or %d \n", (int32_t)sampleSpaces[i], (int32_t)sampleNonSpaces[i]);
-        }
-        if (!(u_isJavaSpaceChar(sampleSpaces[i])) ||
-                (u_isJavaSpaceChar(sampleNonSpaces[i])))
-        {
-            log_err("u_isJavaSpaceChar() test error : %d or %d \n", (int32_t)sampleSpaces[i], (int32_t)sampleNonSpaces[i]);
-        }
-    }
+    testSampleCharProps(u_isspace, "u_isspace", sampleSpaces, UPRV_LENGTHOF(sampleSpaces), TRUE);
+    testSampleCharProps(u_isspace, "u_isspace", sampleNonSpaces, UPRV_LENGTHOF(sampleNonSpaces), FALSE);
 
-    log_verbose("Testing for isspace and nonspaces\n");
-    for (i = 0; i < 5; i++) {
-        if (!(u_isWhitespace(sampleWhiteSpaces[i])) ||
-                (u_isWhitespace(sampleNonWhiteSpaces[i])))
-        {
-            log_err("White Space char test error : %lx or %lx \n", sampleWhiteSpaces[i], sampleNonWhiteSpaces[i]);
-        }
-    }
+    testSampleCharProps(u_isJavaSpaceChar, "u_isJavaSpaceChar",
+                        sampleSpaces, UPRV_LENGTHOF(sampleSpaces), TRUE);
+    testSampleCharProps(u_isJavaSpaceChar, "u_isJavaSpaceChar",
+                        sampleNonSpaces, UPRV_LENGTHOF(sampleNonSpaces), FALSE);
 
-    log_verbose("Testing for isdefined\n");
-    for (i = 0; i < 3; i++) {
-        if ((u_isdefined(sampleUndefined[i])) ||
-                !(u_isdefined(sampleDefined[i])))
-        {
-            log_err("Undefined char test error : U+%04x or U+%04x\n", (int32_t)sampleUndefined[i], (int32_t)sampleDefined[i]);
-        }
-    }
+    testSampleCharProps(u_isWhitespace, "u_isWhitespace",
+                        sampleWhiteSpaces, UPRV_LENGTHOF(sampleWhiteSpaces), TRUE);
+    testSampleCharProps(u_isWhitespace, "u_isWhitespace",
+                        sampleNonWhiteSpaces, UPRV_LENGTHOF(sampleNonWhiteSpaces), FALSE);
 
-    log_verbose("Testing for isbase\n");
-    for (i = 0; i < 3; i++) {
-        if ((u_isbase(sampleNonBase[i])) ||
-                !(u_isbase(sampleBase[i])))
-        {
-            log_err("Non-baseform char test error : U+%04x or U+%04x",(int32_t)sampleNonBase[i], (int32_t)sampleBase[i]);
-        }
-    }
+    testSampleCharProps(u_isdefined, "u_isdefined",
+                        sampleDefined, UPRV_LENGTHOF(sampleDefined), TRUE);
+    testSampleCharProps(u_isdefined, "u_isdefined",
+                        sampleUndefined, UPRV_LENGTHOF(sampleUndefined), FALSE);
 
-    log_verbose("Testing for isdigit \n");
-    for (i = 0; i < 4; i++) {
-        if ((u_isdigit(sampleDigits[i]) && 
-            (u_charDigitValue(sampleDigits[i])!= sampleDigitValues[i])) ||
-            (u_isdigit(sampleNonDigits[i]))) {
-            log_err("Digit char test error : %lx   or   %lx\n", sampleDigits[i], sampleNonDigits[i]);
+    testSampleCharProps(u_isbase, "u_isbase", sampleBase, UPRV_LENGTHOF(sampleBase), TRUE);
+    testSampleCharProps(u_isbase, "u_isbase", sampleNonBase, UPRV_LENGTHOF(sampleNonBase), FALSE);
+
+    testSampleCharProps(u_isdigit, "u_isdigit", sampleDigits, UPRV_LENGTHOF(sampleDigits), TRUE);
+    testSampleCharProps(u_isdigit, "u_isdigit", sampleNonDigits, UPRV_LENGTHOF(sampleNonDigits), FALSE);
+
+    for (i = 0; i < UPRV_LENGTHOF(sampleDigits); i++) {
+        if (u_charDigitValue(sampleDigits[i]) != sampleDigitValues[i]) {
+            log_err("error: u_charDigitValue(U+04x)=%d != %d\n",
+                    sampleDigits[i], u_charDigitValue(sampleDigits[i]), sampleDigitValues[i]);
         }
     }
 
     /* Tests the ICU version #*/
     u_getVersion(realVersion);
     u_versionToString(realVersion, icuVersion);
-    if (strncmp(icuVersion, U_ICU_VERSION, uprv_min(strlen(icuVersion), strlen(U_ICU_VERSION))) != 0)
+    if (strncmp(icuVersion, U_ICU_VERSION, uprv_min((int32_t)strlen(icuVersion), (int32_t)strlen(U_ICU_VERSION))) != 0)
     {
         log_err("ICU version test failed. Header says=%s, got=%s \n", U_ICU_VERSION, icuVersion);
     }
@@ -652,7 +722,7 @@ static void TestMisc()
             { 0xff3a, 37, -1 }
         };
 
-        for(i=0; i<LENGTHOF(data); ++i) {
+        for(i=0; i<UPRV_LENGTHOF(data); ++i) {
             if(u_digit(data[i].c, data[i].radix)!=data[i].value) {
                 log_err("u_digit(U+%04x, %d)=%d expected %d\n",
                         data[i].c,
@@ -685,7 +755,7 @@ static void TestMisc()
 #define ISCN 0x800
 
 /* C/POSIX-style functions, in the same order as the bit flags */
-typedef UBool IsPOSIXClass(UChar32 c);
+typedef UBool U_EXPORT2 IsPOSIXClass(UChar32 c);
 
 static const struct {
     IsPOSIXClass *fn;
@@ -732,7 +802,8 @@ static const struct {
     { 0x2002,                                         ISPR|ISSP|ISBL      },    /* en space */
     { 0x2007,                                         ISPR|ISSP|ISBL      },    /* figure space */
     { 0x2009,                                         ISPR|ISSP|ISBL      },    /* thin space */
-    { 0x200b,                                         ISPR|ISSP           },    /* ZWSP */
+    { 0x200b,                                                        ISCN },    /* ZWSP */
+  /*{ 0x200b,                                         ISPR|ISSP           },*/    /* ZWSP */ /* ZWSP became a control char in 4.0.1*/
     { 0x200e,                                                        ISCN },    /* LRM */
     { 0x2028,                                         ISPR|ISSP|     ISCN },    /* LS */
     { 0x2029,                                         ISPR|ISSP|     ISCN },    /* PS */
@@ -752,7 +823,7 @@ TestPOSIX() {
 
     mask=1;
     for(cl=0; cl<12; ++cl) {
-        for(i=0; i<LENGTHOF(posixData); ++i) {
+        for(i=0; i<UPRV_LENGTHOF(posixData); ++i) {
             expect=(UBool)((posixData[i].posixResults&mask)!=0);
             if(posixClasses[cl].fn(posixData[i].c)!=expect) {
                 log_err("u_%s(U+%04x)=%s is wrong\n",
@@ -766,40 +837,19 @@ TestPOSIX() {
 /* Tests for isControl(u_iscntrl()) and isPrintable(u_isprint()) */
 static void TestControlPrint()
 {
-    const UChar sampleControl[] = {0x1b, 0x97, 0x82, 0x2028, 0x2029, 0x200c, 0x202b};
-    const UChar sampleNonControl[] = {0x61, 0x0031, 0x00e2};
-    const UChar samplePrintable[] = {0x0042, 0x005f, 0x2014};
-    const UChar sampleNonPrintable[] = {0x200c, 0x009f, 0x001b};
+    const UChar32 sampleControl[] = {0x1b, 0x97, 0x82, 0x2028, 0x2029, 0x200c, 0x202b};
+    const UChar32 sampleNonControl[] = {0x61, 0x0031, 0x00e2};
+    const UChar32 samplePrintable[] = {0x0042, 0x005f, 0x2014};
+    const UChar32 sampleNonPrintable[] = {0x200c, 0x009f, 0x001b};
     UChar32 c;
-    int i;
-
-    log_verbose("Testing for iscontrol\n");
-    for (i = 0; i < LENGTHOF(sampleControl); i++) {
-        if (!u_iscntrl(sampleControl[i]))
-        {
-            log_err("Control char test error : U+%04x should be control but is not\n", (int32_t)sampleControl[i]);
-        }
-    }
 
-    log_verbose("Testing for !iscontrol\n");
-    for (i = 0; i < LENGTHOF(sampleNonControl); i++) {
-        if (u_iscntrl(sampleNonControl[i]))
-        {
-            log_err("Control char test error : U+%04x should not be control but is\n", (int32_t)sampleNonControl[i]);
-        }
-    }
+    testSampleCharProps(u_iscntrl, "u_iscntrl", sampleControl, UPRV_LENGTHOF(sampleControl), TRUE);
+    testSampleCharProps(u_iscntrl, "u_iscntrl", sampleNonControl, UPRV_LENGTHOF(sampleNonControl), FALSE);
 
-    log_verbose("testing for isprintable\n");
-    for (i = 0; i < 3; i++) {
-        if (!u_isprint(samplePrintable[i]))
-        {
-            log_err("Printable char test error : U+%04x should be printable but is not\n", (int32_t)samplePrintable[i]);
-        }
-        if (u_isprint(sampleNonPrintable[i]))
-        {
-            log_err("Printable char test error : U+%04x should not be printable but is\n", (int32_t)sampleNonPrintable[i]);
-        }
-    }
+    testSampleCharProps(u_isprint, "u_isprint",
+                        samplePrintable, UPRV_LENGTHOF(samplePrintable), TRUE);
+    testSampleCharProps(u_isprint, "u_isprint",
+                        sampleNonPrintable, UPRV_LENGTHOF(sampleNonPrintable), FALSE);
 
     /* test all ISO 8 controls */
     for(c=0; c<=0x9f; ++c) {
@@ -835,68 +885,61 @@ static void TestControlPrint()
 /* u_isJavaIDStart, u_isJavaIDPart, u_isIDStart(), u_isIDPart(), u_isIDIgnorable()*/
 static void TestIdentifier()
 {
-    const UChar sampleJavaIDStart[] = {0x0071, 0x00e4, 0x005f};
-    const UChar sampleNonJavaIDStart[] = {0x0020, 0x2030, 0x0082};
-    const UChar sampleJavaIDPart[] = {0x005f, 0x0032, 0x0045};
-    const UChar sampleNonJavaIDPart[] = {0x2030, 0x2020, 0x0020};
-    const UChar sampleUnicodeIDStart[] = {0x0250, 0x00e2, 0x0061};
-    const UChar sampleNonUnicodeIDStart[] = {0x2000, 0x000a, 0x2019};
-    const UChar sampleUnicodeIDPart[] = {0x005f, 0x0032, 0x0045};
-    const UChar sampleNonUnicodeIDPart[] = {0x2030, 0x00a3, 0x0020};
-    const UChar sampleIDIgnore[] = {0x0006, 0x0010, 0x206b};
-    const UChar sampleNonIDIgnore[] = {0x0075, 0x00a3, 0x0061};
-
-    int i;
-
-    log_verbose("Testing sampleJavaID start \n");
-    for (i = 0; i < 3; i++) {
-        if (!(u_isJavaIDStart(sampleJavaIDStart[i])) ||
-                (u_isJavaIDStart(sampleNonJavaIDStart[i])))
-            log_err("Java ID Start char test error : %lx or %lx\n",
-            sampleJavaIDStart[i], sampleNonJavaIDStart[i]);
-    }
-
-    log_verbose("Testing sampleJavaID part \n");
-    for (i = 0; i < 3; i++) {
-        if (!(u_isJavaIDPart(sampleJavaIDPart[i])) ||
-                (u_isJavaIDPart(sampleNonJavaIDPart[i])))
-            log_err("Java ID Part char test error : %lx or %lx\n",
-             sampleJavaIDPart[i], sampleNonJavaIDPart[i]);
-    }
-
-    log_verbose("Testing sampleUnicodeID start \n");
-    for (i = 0; i < 3; i++) {
-        /* T_test_logln_ustr((int32_t)i); */
-        if (!(u_isIDStart(sampleUnicodeIDStart[i])) ||
-                (u_isIDStart(sampleNonUnicodeIDStart[i])))
-        {
-            log_err("Unicode ID Start char test error : %lx  or  %lx\n", sampleUnicodeIDStart[i],
-                                    sampleNonUnicodeIDStart[i]);
-        }
-    }
-
-    log_verbose("Testing sample unicode ID part \n");
-    for (i = 2; i < 3; i++) {   /* nos *** starts with 2 instead of 0, until clarified */
-        /* T_test_logln_ustr((int32_t)i); */
-        if (!(u_isIDPart(sampleUnicodeIDPart[i])) ||
-                (u_isIDPart(sampleNonUnicodeIDPart[i])))
-           {
-            log_err("Unicode ID Part char test error : %lx  or  %lx", sampleUnicodeIDPart[i], sampleNonUnicodeIDPart[i]);
-            }
-    }
-
-    log_verbose("Testing  sampleId ignore\n");
-    for (i = 0; i < 3; i++) {
-        /*T_test_logln_ustr((int32_t)i); */
-        if (!(u_isIDIgnorable(sampleIDIgnore[i])) ||
-                (u_isIDIgnorable(sampleNonIDIgnore[i])))
-        {
-            log_err("ID ignorable char test error : U+%04x  or  U+%04x\n", sampleIDIgnore[i], sampleNonIDIgnore[i]);
-        }
-    }
+    const UChar32 sampleJavaIDStart[] = {0x0071, 0x00e4, 0x005f};
+    const UChar32 sampleNonJavaIDStart[] = {0x0020, 0x2030, 0x0082};
+    const UChar32 sampleJavaIDPart[] = {0x005f, 0x0032, 0x0045};
+    const UChar32 sampleNonJavaIDPart[] = {0x2030, 0x2020, 0x0020};
+    const UChar32 sampleUnicodeIDStart[] = {0x0250, 0x00e2, 0x0061};
+    const UChar32 sampleNonUnicodeIDStart[] = {0x2000, 0x000a, 0x2019};
+    const UChar32 sampleUnicodeIDPart[] = {0x005f, 0x0032, 0x0045};
+    const UChar32 sampleNonUnicodeIDPart[] = {0x2030, 0x00a3, 0x0020};
+    const UChar32 sampleIDIgnore[] = {0x0006, 0x0010, 0x206b, 0x85};
+    const UChar32 sampleNonIDIgnore[] = {0x0075, 0x00a3, 0x0061};
+
+    testSampleCharProps(u_isJavaIDStart, "u_isJavaIDStart",
+                        sampleJavaIDStart, UPRV_LENGTHOF(sampleJavaIDStart), TRUE);
+    testSampleCharProps(u_isJavaIDStart, "u_isJavaIDStart",
+                        sampleNonJavaIDStart, UPRV_LENGTHOF(sampleNonJavaIDStart), FALSE);
+
+    testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart",
+                        sampleJavaIDPart, UPRV_LENGTHOF(sampleJavaIDPart), TRUE);
+    testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart",
+                        sampleNonJavaIDPart, UPRV_LENGTHOF(sampleNonJavaIDPart), FALSE);
+
+    /* IDPart should imply IDStart */
+    testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart",
+                        sampleJavaIDStart, UPRV_LENGTHOF(sampleJavaIDStart), TRUE);
+
+    testSampleCharProps(u_isIDStart, "u_isIDStart",
+                        sampleUnicodeIDStart, UPRV_LENGTHOF(sampleUnicodeIDStart), TRUE);
+    testSampleCharProps(u_isIDStart, "u_isIDStart",
+                        sampleNonUnicodeIDStart, UPRV_LENGTHOF(sampleNonUnicodeIDStart), FALSE);
+
+    testSampleCharProps(u_isIDPart, "u_isIDPart",
+                        sampleUnicodeIDPart, UPRV_LENGTHOF(sampleUnicodeIDPart), TRUE);
+    testSampleCharProps(u_isIDPart, "u_isIDPart",
+                        sampleNonUnicodeIDPart, UPRV_LENGTHOF(sampleNonUnicodeIDPart), FALSE);
+
+    /* IDPart should imply IDStart */
+    testSampleCharProps(u_isIDPart, "u_isIDPart",
+                        sampleUnicodeIDStart, UPRV_LENGTHOF(sampleUnicodeIDStart), TRUE);
+
+    testSampleCharProps(u_isIDIgnorable, "u_isIDIgnorable",
+                        sampleIDIgnore, UPRV_LENGTHOF(sampleIDIgnore), TRUE);
+    testSampleCharProps(u_isIDIgnorable, "u_isIDIgnorable",
+                        sampleNonIDIgnore, UPRV_LENGTHOF(sampleNonIDIgnore), FALSE);
 }
 
 /* for each line of UnicodeData.txt, check some of the properties */
+typedef struct UnicodeDataContext {
+#if UCONFIG_NO_NORMALIZATION
+    const void *dummy;
+#else
+    const UNormalizer2 *nfc;
+    const UNormalizer2 *nfkc;
+#endif
+} UnicodeDataContext;
+
 /*
  * ### TODO
  * This test fails incorrectly if the First or Last code point of a repetitive area
@@ -916,11 +959,19 @@ unicodeDataLineFn(void *context,
                   UErrorCode *pErrorCode)
 {
     char buffer[100];
+    const char *d;
     char *end;
     uint32_t value;
     UChar32 c;
     int32_t i;
     int8_t type;
+    int32_t dt;
+    UChar dm[32], s[32];
+    int32_t dmLength, length;
+
+#if !UCONFIG_NO_NORMALIZATION
+    const UNormalizer2 *nfc, *nfkc;
+#endif
 
     /* get the character code, field 0 */
     c=strtoul(fields[0][0], &end, 16);
@@ -957,6 +1008,10 @@ unicodeDataLineFn(void *context,
     if(value!=u_getCombiningClass(c) || value!=(uint32_t)u_getIntPropertyValue(c, UCHAR_CANONICAL_COMBINING_CLASS)) {
         log_err("error: u_getCombiningClass(U+%04lx)==%hu instead of %lu\n", c, u_getCombiningClass(c), value);
     }
+    nfkc=((UnicodeDataContext *)context)->nfkc;
+    if(value!=unorm2_getCombiningClass(nfkc, c)) {
+        log_err("error: unorm2_getCombiningClass(nfkc, U+%04lx)==%hu instead of %lu\n", c, unorm2_getCombiningClass(nfkc, c), value);
+    }
 #endif
 
     /* get BiDi category, field 4 */
@@ -966,11 +1021,100 @@ unicodeDataLineFn(void *context,
         log_err("error: u_charDirection(U+%04lx)==%u instead of %u (%s)\n", c, u_charDirection(c), MakeDir(fields[4][0]), fields[4][0]);
     }
 
+    /* get Decomposition_Type & Decomposition_Mapping, field 5 */
+    d=NULL;
+    if(fields[5][0]==fields[5][1]) {
+        /* no decomposition, except UnicodeData.txt omits Hangul syllable decompositions */
+        if(c==0xac00 || c==0xd7a3) {
+            dt=U_DT_CANONICAL;
+        } else {
+            dt=U_DT_NONE;
+        }
+    } else {
+        d=fields[5][0];
+        *fields[5][1]=0;
+        dt=UCHAR_INVALID_CODE;
+        if(*d=='<') {
+            end=strchr(++d, '>');
+            if(end!=NULL) {
+                *end=0;
+                dt=u_getPropertyValueEnum(UCHAR_DECOMPOSITION_TYPE, d);
+                d=u_skipWhitespace(end+1);
+            }
+        } else {
+            dt=U_DT_CANONICAL;
+        }
+    }
+    if(dt>U_DT_NONE) {
+        if(c==0xac00) {
+            dm[0]=0x1100;
+            dm[1]=0x1161;
+            dm[2]=0;
+            dmLength=2;
+        } else if(c==0xd7a3) {
+            dm[0]=0xd788;
+            dm[1]=0x11c2;
+            dm[2]=0;
+            dmLength=2;
+        } else {
+            dmLength=u_parseString(d, dm, 32, NULL, pErrorCode);
+        }
+    } else {
+        dmLength=-1;
+    }
+    if(dt<0 || U_FAILURE(*pErrorCode)) {
+        log_err("error in UnicodeData.txt: syntax error in U+%04lX decomposition field\n", (long)c);
+        return;
+    }
+#if !UCONFIG_NO_NORMALIZATION
+    i=u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE);
+    if(i!=dt) {
+        log_err("error: u_getIntPropertyValue(U+%04lx, UCHAR_DECOMPOSITION_TYPE)==%d instead of %d\n", c, i, dt);
+    }
+    /* Expect Decomposition_Mapping=nfkc.getRawDecomposition(c). */
+    length=unorm2_getRawDecomposition(nfkc, c, s, 32, pErrorCode);
+    if(U_FAILURE(*pErrorCode) || length!=dmLength || (length>0 && 0!=u_strcmp(s, dm))) {
+        log_err("error: unorm2_getRawDecomposition(nfkc, U+%04lx)==%d instead of %d "
+                "or the Decomposition_Mapping is different (%s)\n",
+                c, length, dmLength, u_errorName(*pErrorCode));
+        return;
+    }
+    /* For canonical decompositions only, expect Decomposition_Mapping=nfc.getRawDecomposition(c). */
+    if(dt!=U_DT_CANONICAL) {
+        dmLength=-1;
+    }
+    nfc=((UnicodeDataContext *)context)->nfc;
+    length=unorm2_getRawDecomposition(nfc, c, s, 32, pErrorCode);
+    if(U_FAILURE(*pErrorCode) || length!=dmLength || (length>0 && 0!=u_strcmp(s, dm))) {
+        log_err("error: unorm2_getRawDecomposition(nfc, U+%04lx)==%d instead of %d "
+                "or the Decomposition_Mapping is different (%s)\n",
+                c, length, dmLength, u_errorName(*pErrorCode));
+        return;
+    }
+    /* recompose */
+    if(dt==U_DT_CANONICAL && !u_hasBinaryProperty(c, UCHAR_FULL_COMPOSITION_EXCLUSION)) {
+        UChar32 a, b, composite;
+        i=0;
+        U16_NEXT(dm, i, dmLength, a);
+        U16_NEXT(dm, i, dmLength, b);
+        /* i==dmLength */
+        composite=unorm2_composePair(nfc, a, b);
+        if(composite!=c) {
+            log_err("error: nfc U+%04lX decomposes to U+%04lX+U+%04lX but does not compose back (instead U+%04lX)\n",
+                    (long)c, (long)a, (long)b, (long)composite);
+        }
+        /*
+         * Note: NFKC has fewer round-trip mappings than NFC,
+         * so we can't just test unorm2_composePair(nfkc, a, b) here without further data.
+         */
+    }
+#endif
+
     /* get ISO Comment, field 11 */
     *fields[11][1]=0;
     i=u_getISOComment(c, buffer, sizeof(buffer), pErrorCode);
     if(U_FAILURE(*pErrorCode) || 0!=strcmp(fields[11][0], buffer)) {
-        log_err("error: u_getISOComment(U+%04lx) wrong (%s): \"%s\" should be \"%s\"\n",
+        log_err_status(*pErrorCode, "error: u_getISOComment(U+%04lx) wrong (%s): \"%s\" should be \"%s\"\n",
             c, u_errorName(*pErrorCode),
             U_FAILURE(*pErrorCode) ? buffer : "[error]",
             fields[11][0]);
@@ -1038,38 +1182,21 @@ enumTypeRange(const void *context, UChar32 start, UChar32 limit, UCharCategory t
         {0xeffff, U_UNASSIGNED}
     };
 
-    /* default Bidi classes for unassigned code points */
-    static const int32_t defaultBidi[][2]={ /* { limit, class } */
-        { 0x0590, U_LEFT_TO_RIGHT },
-        { 0x0600, U_RIGHT_TO_LEFT },
-        { 0x07C0, U_RIGHT_TO_LEFT_ARABIC },
-        { 0x0900, U_RIGHT_TO_LEFT },
-        { 0xFB1D, U_LEFT_TO_RIGHT },
-        { 0xFB50, U_RIGHT_TO_LEFT },
-        { 0xFE00, U_RIGHT_TO_LEFT_ARABIC },
-        { 0xFE70, U_LEFT_TO_RIGHT },
-        { 0xFF00, U_RIGHT_TO_LEFT_ARABIC },
-        { 0x10800, U_LEFT_TO_RIGHT },
-        { 0x11000, U_RIGHT_TO_LEFT },
-        { 0x110000, U_LEFT_TO_RIGHT }
-    };
-
-    UChar32 c;
-    int i, count;
+    int32_t i, count;
 
     if(0!=strcmp((const char *)context, "a1")) {
         log_err("error: u_enumCharTypes() passes on an incorrect context pointer\n");
         return FALSE;
     }
 
-    count=sizeof(test)/sizeof(test[0]);
+    count=UPRV_LENGTHOF(test);
     for(i=0; i<count; ++i) {
         if(start<=test[i][0] && test[i][0]<limit) {
             if(type!=(UCharCategory)test[i][1]) {
                 log_err("error: u_enumCharTypes() has range [U+%04lx, U+%04lx[ with %ld instead of U+%04lx with %ld\n",
                         start, limit, (long)type, test[i][0], test[i][1]);
             }
-            /* stop at the range that includes the last test code point */
+            /* stop at the range that includes the last test code point (increases code coverage for enumeration) */
             return i==(count-1) ? FALSE : TRUE;
         }
     }
@@ -1080,6 +1207,38 @@ enumTypeRange(const void *context, UChar32 start, UChar32 limit, UCharCategory t
         return FALSE;
     }
 
+    return TRUE;
+}
+
+static UBool U_CALLCONV
+enumDefaultsRange(const void *context, UChar32 start, UChar32 limit, UCharCategory type) {
+    /* default Bidi classes for unassigned code points, from the DerivedBidiClass.txt header */
+    static const int32_t defaultBidi[][2]={ /* { limit, class } */
+        { 0x0590, U_LEFT_TO_RIGHT },
+        { 0x0600, U_RIGHT_TO_LEFT },
+        { 0x07C0, U_RIGHT_TO_LEFT_ARABIC },
+        { 0x08A0, U_RIGHT_TO_LEFT },
+        { 0x0900, U_RIGHT_TO_LEFT_ARABIC },  /* Unicode 6.1 changes U+08A0..U+08FF from R to AL */
+        { 0x20A0, U_LEFT_TO_RIGHT },
+        { 0x20D0, U_EUROPEAN_NUMBER_TERMINATOR },  /* Unicode 6.3 changes the currency symbols block U+20A0..U+20CF to default to ET not L */
+        { 0xFB1D, U_LEFT_TO_RIGHT },
+        { 0xFB50, U_RIGHT_TO_LEFT },
+        { 0xFE00, U_RIGHT_TO_LEFT_ARABIC },
+        { 0xFE70, U_LEFT_TO_RIGHT },
+        { 0xFF00, U_RIGHT_TO_LEFT_ARABIC },
+        { 0x10800, U_LEFT_TO_RIGHT },
+        { 0x11000, U_RIGHT_TO_LEFT },
+        { 0x1E800, U_LEFT_TO_RIGHT },  /* new default-R range in Unicode 5.2: U+1E800 - U+1EFFF */
+        { 0x1EE00, U_RIGHT_TO_LEFT },
+        { 0x1EF00, U_RIGHT_TO_LEFT_ARABIC },  /* Unicode 6.1 changes U+1EE00..U+1EEFF from R to AL */
+        { 0x1F000, U_RIGHT_TO_LEFT },
+        { 0x110000, U_LEFT_TO_RIGHT }
+    };
+
+    UChar32 c;
+    int32_t i;
+    UCharDirection shouldBeDir;
+
     /*
      * LineBreak.txt specifies:
      *   #  - Assigned characters that are not listed explicitly are given the value
@@ -1101,22 +1260,38 @@ enumTypeRange(const void *context, UChar32 start, UChar32 limit, UCharCategory t
 
     /*
      * Verify default Bidi classes.
+     * For recent Unicode versions, see UCD.html.
+     *
+     * For older Unicode versions:
      * See table 3-7 "Bidirectional Character Types" in UAX #9.
      * http://www.unicode.org/reports/tr9/
      *
      * See also DerivedBidiClass.txt for Cn code points!
+     *
+     * Unicode 4.0.1/Public Review Issue #28 (http://www.unicode.org/review/resolved-pri.html)
+     * changed some default values.
+     * In particular, non-characters and unassigned Default Ignorable Code Points
+     * change from L to BN.
+     *
+     * UCD.html version 4.0.1 does not yet reflect these changes.
      */
     if(type==U_UNASSIGNED || type==U_PRIVATE_USE_CHAR) {
         /* enumerate the intersections of defaultBidi ranges with [start..limit[ */
         c=start;
-        for(i=0; i<LENGTHOF(defaultBidi) && c<limit; ++i) {
+        for(i=0; i<UPRV_LENGTHOF(defaultBidi) && c<limit; ++i) {
             if((int32_t)c<defaultBidi[i][0]) {
                 while(c<limit && (int32_t)c<defaultBidi[i][0]) {
-                    if( u_charDirection(c)!=(UCharDirection)defaultBidi[i][1] ||
-                        u_getIntPropertyValue(c, UCHAR_BIDI_CLASS)!=defaultBidi[i][1]
+                    if(U_IS_UNICODE_NONCHAR(c) || u_hasBinaryProperty(c, UCHAR_DEFAULT_IGNORABLE_CODE_POINT)) {
+                        shouldBeDir=U_BOUNDARY_NEUTRAL;
+                    } else {
+                        shouldBeDir=(UCharDirection)defaultBidi[i][1];
+                    }
+
+                    if( u_charDirection(c)!=shouldBeDir ||
+                        u_getIntPropertyValue(c, UCHAR_BIDI_CLASS)!=shouldBeDir
                     ) {
                         log_err("error: u_charDirection(unassigned/PUA U+%04lx)=%s should be %s\n",
-                            c, dirStrings[u_charDirection(c)], dirStrings[defaultBidi[i][1]]);
+                            c, dirStrings[u_charDirection(c)], dirStrings[shouldBeDir]);
                     }
                     ++c;
                 }
@@ -1130,8 +1305,6 @@ enumTypeRange(const void *context, UChar32 start, UChar32 limit, UCharCategory t
 /* tests for several properties */
 static void TestUnicodeData()
 {
-    char newPath[256];
-    char backupPath[256];
     UVersionInfo expectVersionArray;
     UVersionInfo versionArray;
     char *fields[15][2];
@@ -1139,16 +1312,7 @@ static void TestUnicodeData()
     UChar32 c;
     int8_t type;
 
-    /* Look inside ICU_DATA first */
-    strcpy(newPath, u_getDataDirectory());
-    strcat(newPath, ".." U_FILE_SEP_STRING "unidata" U_FILE_SEP_STRING "UnicodeData.txt");
-
-    /* As a fallback, try to guess where the source data was located
-     *    at the time ICU was built, and look there.
-     */
-    strcpy(backupPath, ctest_dataSrcDir());
-    strcat(backupPath, U_FILE_SEP_STRING);
-    strcat(backupPath, "unidata" U_FILE_SEP_STRING "UnicodeData.txt");
+    UnicodeDataContext context;
 
     u_versionFromString(expectVersionArray, U_UNICODE_VERSION);
     u_getUnicodeVersion(versionArray);
@@ -1171,13 +1335,16 @@ static void TestUnicodeData()
     }
 
     errorCode=U_ZERO_ERROR;
-    u_parseDelimitedFile(newPath, ';', fields, 15, unicodeDataLineFn, NULL, &errorCode);
-    if(errorCode==U_FILE_ACCESS_ERROR) {
-        errorCode=U_ZERO_ERROR;
-        u_parseDelimitedFile(backupPath, ';', fields, 15, unicodeDataLineFn, NULL, &errorCode);
+#if !UCONFIG_NO_NORMALIZATION
+    context.nfc=unorm2_getNFCInstance(&errorCode);
+    context.nfkc=unorm2_getNFKCInstance(&errorCode);
+    if(U_FAILURE(errorCode)) {
+        log_data_err("error: unable to open an NFC or NFKC UNormalizer2 - %s\n", u_errorName(errorCode));
+        return;
     }
+#endif
+    parseUCDFile("UnicodeData.txt", fields, 15, unicodeDataLineFn, &context, &errorCode);
     if(U_FAILURE(errorCode)) {
-        log_err("error parsing UnicodeData.txt: %s\n", u_errorName(errorCode));
         return; /* if we couldn't parse UnicodeData.txt, we should return */
     }
 
@@ -1219,6 +1386,9 @@ static void TestUnicodeData()
 
     /* test u_enumCharTypes() */
     u_enumCharTypes(enumTypeRange, "a1");
+
+    /* check default properties */
+    u_enumCharTypes(enumDefaultsRange, NULL);
 }
 
 static void TestCodeUnit(){
@@ -1336,6 +1506,23 @@ static void TestCodePoint(){
         }
     }
 
+    if(
+        !U_IS_BMP(0) || !U_IS_BMP(0x61) || !U_IS_BMP(0x20ac) ||
+        !U_IS_BMP(0xd9da) || !U_IS_BMP(0xdfed) || !U_IS_BMP(0xffff) ||
+        U_IS_BMP(U_SENTINEL) || U_IS_BMP(0x10000) || U_IS_BMP(0x50005) ||
+        U_IS_BMP(0x10ffff) || U_IS_BMP(0x110000) || U_IS_BMP(0x7fffffff)
+    ) {
+        log_err("error with U_IS_BMP()\n");
+    }
+
+    if(
+        U_IS_SUPPLEMENTARY(0) || U_IS_SUPPLEMENTARY(0x61) || U_IS_SUPPLEMENTARY(0x20ac) ||
+        U_IS_SUPPLEMENTARY(0xd9da) || U_IS_SUPPLEMENTARY(0xdfed) || U_IS_SUPPLEMENTARY(0xffff) ||
+        U_IS_SUPPLEMENTARY(U_SENTINEL) || !U_IS_SUPPLEMENTARY(0x10000) || !U_IS_SUPPLEMENTARY(0x50005) ||
+        !U_IS_SUPPLEMENTARY(0x10ffff) || U_IS_SUPPLEMENTARY(0x110000) || U_IS_SUPPLEMENTARY(0x7fffffff)
+    ) {
+        log_err("error with U_IS_SUPPLEMENTARY()\n");
+    }
 }
 
 static void TestCharLength()
@@ -1358,7 +1545,7 @@ static void TestCharLength()
     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] || U16_LENGTH(c) != codepoint[i]){
-            log_err("The no: of code units for U+%04x:- Expected: %d Got: %d\n", c, codepoint[i], UTF_CHAR_LENGTH(c));
+            log_err("The no: of code units for U+%04x:- Expected: %d Got: %d\n", c, codepoint[i], U16_LENGTH(c));
         }
         multiple=(UBool)(codepoint[i] == 1 ? FALSE : TRUE);
         if(UTF_NEED_MULTIPLE_UCHAR(c) != multiple){
@@ -1379,14 +1566,15 @@ static int32_t MakeProp(char* str)
         log_err("unrecognized type letter ");
         log_err(str);
     }
-    else result = ((matchPosition - tagStrings) / 2);
+    else
+        result = (int32_t)((matchPosition - tagStrings) / 2);
     return result;
 }
 
 static int32_t MakeDir(char* str) 
 {
     int32_t pos = 0;
-    for (pos = 0; pos < 19; pos++) {
+    for (pos = 0; pos < U_CHAR_DIRECTION_COUNT; pos++) {
         if (strcmp(str, dirStrings[pos]) == 0) {
             return pos;
         }
@@ -1398,19 +1586,29 @@ static int32_t MakeDir(char* str)
 
 static const struct {
     uint32_t code;
-    const char *name, *oldName, *extName;
+    const char *name, *oldName, *extName, *alias;
 } names[]={
     {0x0061, "LATIN SMALL LETTER A", "", "LATIN SMALL LETTER A"},
-    {0x0284, "LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK", "LATIN SMALL LETTER DOTLESS J BAR HOOK", "LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK" },
+    {0x01a2, "LATIN CAPITAL LETTER OI", "",
+             "LATIN CAPITAL LETTER OI",
+             "LATIN CAPITAL LETTER GHA"},
+    {0x0284, "LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK", "",
+             "LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK" },
+    {0x0fd0, "TIBETAN MARK BSKA- SHOG GI MGO RGYAN", "",
+             "TIBETAN MARK BSKA- SHOG GI MGO RGYAN",
+             "TIBETAN MARK BKA- SHOG GI MGO RGYAN"},
     {0x3401, "CJK UNIFIED IDEOGRAPH-3401", "", "CJK UNIFIED IDEOGRAPH-3401" },
     {0x7fed, "CJK UNIFIED IDEOGRAPH-7FED", "", "CJK UNIFIED IDEOGRAPH-7FED" },
     {0xac00, "HANGUL SYLLABLE GA", "", "HANGUL SYLLABLE GA" },
     {0xd7a3, "HANGUL SYLLABLE HIH", "", "HANGUL SYLLABLE HIH" },
     {0xd800, "", "", "<lead surrogate-D800>" },
     {0xdc00, "", "", "<trail surrogate-DC00>" },
-    {0xff08, "FULLWIDTH LEFT PARENTHESIS", "FULLWIDTH OPENING PARENTHESIS", "FULLWIDTH LEFT PARENTHESIS" },
+    {0xff08, "FULLWIDTH LEFT PARENTHESIS", "", "FULLWIDTH LEFT PARENTHESIS" },
     {0xffe5, "FULLWIDTH YEN SIGN", "", "FULLWIDTH YEN SIGN" },
     {0xffff, "", "", "<noncharacter-FFFF>" },
+    {0x1d0c5, "BYZANTINE MUSICAL SYMBOL FHTORA SKLIRON CHROMA VASIS", "",
+              "BYZANTINE MUSICAL SYMBOL FHTORA SKLIRON CHROMA VASIS",
+              "BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON CHROMA VASIS"},
     {0x23456, "CJK UNIFIED IDEOGRAPH-23456", "", "CJK UNIFIED IDEOGRAPH-23456" }
 };
 
@@ -1419,6 +1617,7 @@ enumCharNamesFn(void *context,
                 UChar32 code, UCharNameChoice nameChoice,
                 const char *name, int32_t length) {
     int32_t *pCount=(int32_t *)context;
+    const char *expected;
     int i;
 
     if(length<=0 || length!=(int32_t)strlen(name)) {
@@ -1442,8 +1641,15 @@ enumCharNamesFn(void *context,
                     }
                     break;
                 case U_UNICODE_10_CHAR_NAME:
-                    if(names[i].oldName[0]==0 || 0!=strcmp(name, names[i].oldName)) {
-                        log_err("u_enumCharName(0x%lx - 1.0)=%s instead of %s\n", code, name, names[i].oldName);
+                    expected=names[i].oldName;
+                    if(expected[0]==0 || 0!=strcmp(name, expected)) {
+                        log_err("u_enumCharName(0x%lx - 1.0)=%s instead of %s\n", code, name, expected);
+                    }
+                    break;
+                case U_CHAR_NAME_ALIAS:
+                    expected=names[i].alias;
+                    if(expected==NULL || expected[0]==0 || 0!=strcmp(name, expected)) {
+                        log_err("u_enumCharName(0x%lx - alias)=%s instead of %s\n", code, name, expected);
                     }
                     break;
                 case U_CHAR_NAME_CHOICE_COUNT:
@@ -1499,6 +1705,7 @@ TestCharNames() {
     static char name[80];
     UErrorCode errorCode=U_ZERO_ERROR;
     struct enumExtCharNamesContext extContext;
+    const char *expected;
     int32_t length;
     UChar32 c;
     int32_t i;
@@ -1559,6 +1766,35 @@ TestCharNames() {
                 log_err("u_charFromName(%s - 1.0) gets 0x%lx instead of 0x%lx\n", names[i].oldName, c, names[i].code);
             }
         }
+
+        /* Unicode character name alias */
+        length=u_charName(names[i].code, U_CHAR_NAME_ALIAS, name, sizeof(name), &errorCode);
+        if(U_FAILURE(errorCode)) {
+            log_err("u_charName(0x%lx - alias) error %s\n", names[i].code, u_errorName(errorCode));
+            return;
+        }
+        expected=names[i].alias;
+        if(expected==NULL) {
+            expected="";
+        }
+        if(length<0 || (length>0 && 0!=strcmp(name, expected)) || length!=(uint16_t)strlen(name)) {
+            log_err("u_charName(0x%lx - alias) gets %s length %ld instead of nothing or %s\n",
+                    names[i].code, name, length, expected);
+        }
+
+        /* find the Unicode character name alias if it is stored (length>0 means that we could read it) */
+        if(expected[0]!=0 /* && length>0 */) {
+            c=u_charFromName(U_CHAR_NAME_ALIAS, expected, &errorCode);
+            if(U_FAILURE(errorCode)) {
+                log_err("u_charFromName(%s - alias) error %s\n",
+                        expected, u_errorName(errorCode));
+                return;
+            }
+            if(c!=(UChar32)names[i].code) {
+                log_err("u_charFromName(%s - alias) gets 0x%lx instead of 0x%lx\n",
+                        expected, c, names[i].code);
+            }
+        }
     }
 
     /* test u_enumCharNames() */
@@ -1583,7 +1819,7 @@ TestCharNames() {
     }
 
     /* Test getCharNameCharacters */
-    if(!QUICK) {
+    if(!getTestOption(QUICK_OPTION)) {
         enum { BUFSIZE = 256 };
         UErrorCode ec = U_ZERO_ERROR;
         char buf[BUFSIZE];
@@ -1603,11 +1839,22 @@ TestCharNames() {
          * it includes all the characters in lowercased names of
          * general categories, for the full possible set of extended names.
          */
-        uprv_getCharNameCharacters(set);
+        {
+            USetAdder sa={
+                NULL,
+                uset_add,
+                uset_addRange,
+                uset_addString,
+                NULL /* don't need remove() */
+            };
+            sa.set=set;
+            uprv_getCharNameCharacters(&sa);
+        }
 
         /* build set the dumb (but sure-fire) way */
-        for (i=0; i<256; ++i)
+        for (i=0; i<256; ++i) {
             map[i] = FALSE;
+        }
 
         maxLength=0;
         for (cp=0; cp<0x110000; ++cp) {
@@ -1629,6 +1876,15 @@ TestCharNames() {
                     map[(uint8_t) buf[i]] = TRUE;
                 }
             }
+
+            /* test for leading/trailing whitespace */
+            if(buf[0]==' ' || buf[0]=='\t' || buf[len-1]==' ' || buf[len-1]=='\t') {
+                log_err("u_charName(U+%04x) returns a name with leading or trailing whitespace\n", cp);
+            }
+        }
+
+        if(map[(uint8_t)'\t']) {
+            log_err("u_charName() returned a name with a TAB for some code point\n", cp);
         }
 
         length=uprv_getMaxCharNameLength();
@@ -1670,17 +1926,10 @@ TestCharNames() {
         }
 
         if (!ok) {
-            char c1[256], c2[256];
-            u_UCharsToChars(pat, c1, l1);
-            u_UCharsToChars(dumbPat, c2, l2);
-            c1[l1] = c2[l2] = 0;
             log_err("FAIL: uprv_getCharNameCharacters() returned %s, expected %s (too many lowercase a-z are ok)\n",
-                    c1, c2);
-        } else {
-            char c1[256];
-            u_UCharsToChars(pat, c1, l1);
-            c1[l1] = 0;
-            log_verbose("Ok: uprv_getCharNameCharacters() returned %s\n", c1);
+                    aescstrdup(pat, l1), aescstrdup(dumbPat, l2));
+        } else if(getTestOption(VERBOSITY_OPTION)) {
+            log_verbose("Ok: uprv_getCharNameCharacters() returned %s\n", aescstrdup(pat, l1));
         }
 
         uset_close(set);
@@ -1690,10 +1939,49 @@ TestCharNames() {
     /* ### TODO: test error cases and other interesting things */
 }
 
+static void
+TestUCharFromNameUnderflow() {
+    // Ticket #10889: Underflow crash when there is no dash.
+    UErrorCode errorCode=U_ZERO_ERROR;
+    UChar32 c=u_charFromName(U_EXTENDED_CHAR_NAME, "<NO BREAK SPACE>", &errorCode);
+    if(U_SUCCESS(errorCode)) {
+        log_err("u_charFromName(<NO BREAK SPACE>) = U+%04x but should fail - %s\n", c, u_errorName(errorCode));
+    }
+
+    // Test related edge cases.
+    errorCode=U_ZERO_ERROR;
+    c=u_charFromName(U_EXTENDED_CHAR_NAME, "<-00a0>", &errorCode);
+    if(U_SUCCESS(errorCode)) {
+        log_err("u_charFromName(<-00a0>) = U+%04x but should fail - %s\n", c, u_errorName(errorCode));
+    }
+
+    errorCode=U_ZERO_ERROR;
+    c=u_charFromName(U_EXTENDED_CHAR_NAME, "<control->", &errorCode);
+    if(U_SUCCESS(errorCode)) {
+        log_err("u_charFromName(<control->) = U+%04x but should fail - %s\n", c, u_errorName(errorCode));
+    }
+
+    errorCode=U_ZERO_ERROR;
+    c=u_charFromName(U_EXTENDED_CHAR_NAME, "<control-111111>", &errorCode);
+    if(U_SUCCESS(errorCode)) {
+        log_err("u_charFromName(<control-111111>) = U+%04x but should fail - %s\n", c, u_errorName(errorCode));
+    }
+}
+
 /* test u_isMirrored() and u_charMirror() ----------------------------------- */
 
 static void
 TestMirroring() {
+    USet *set;
+    UErrorCode errorCode;
+
+    UChar32 start, end, c2, c3;
+    int32_t i;
+
+    U_STRING_DECL(mirroredPattern, "[:Bidi_Mirrored:]", 17);
+
+    U_STRING_INIT(mirroredPattern, "[:Bidi_Mirrored:]", 17);
+
     log_verbose("Testing u_isMirrored()\n");
     if(!(u_isMirrored(0x28) && u_isMirrored(0xbb) && u_isMirrored(0x2045) && u_isMirrored(0x232a) &&
          !u_isMirrored(0x27) && !u_isMirrored(0x61) && !u_isMirrored(0x284) && !u_isMirrored(0x3400)
@@ -1704,11 +1992,46 @@ TestMirroring() {
 
     log_verbose("Testing u_charMirror()\n");
     if(!(u_charMirror(0x3c)==0x3e && u_charMirror(0x5d)==0x5b && u_charMirror(0x208d)==0x208e && u_charMirror(0x3017)==0x3016 &&
-         u_charMirror(0x2e)==0x2e && u_charMirror(0x6f3)==0x6f3 && u_charMirror(0x301c)==0x301c && u_charMirror(0xa4ab)==0xa4ab 
+         u_charMirror(0xbb)==0xab && u_charMirror(0x2215)==0x29F5 && u_charMirror(0x29F5)==0x2215 && /* large delta between the code points */
+         u_charMirror(0x2e)==0x2e && u_charMirror(0x6f3)==0x6f3 && u_charMirror(0x301c)==0x301c && u_charMirror(0xa4ab)==0xa4ab &&
+         /* see Unicode Corrigendum #6 at http://www.unicode.org/versions/corrigendum6.html */
+         u_charMirror(0x2018)==0x2018 && u_charMirror(0x201b)==0x201b && u_charMirror(0x301d)==0x301d
          )
     ) {
         log_err("u_charMirror() does not work correctly\n");
     }
+
+    /* verify that Bidi_Mirroring_Glyph roundtrips */
+    errorCode=U_ZERO_ERROR;
+    set=uset_openPattern(mirroredPattern, 17, &errorCode);
+
+    if (U_FAILURE(errorCode)) {
+        log_data_err("uset_openPattern(mirroredPattern, 17, &errorCode) failed!\n");
+    } else {
+        for(i=0; 0==uset_getItem(set, i, &start, &end, NULL, 0, &errorCode); ++i) {
+            do {
+                c2=u_charMirror(start);
+                c3=u_charMirror(c2);
+                if(c3!=start) {
+                    log_err("u_charMirror() does not roundtrip: U+%04lx->U+%04lx->U+%04lx\n", (long)start, (long)c2, (long)c3);
+                }
+                c3=u_getBidiPairedBracket(start);
+                if(u_getIntPropertyValue(start, UCHAR_BIDI_PAIRED_BRACKET_TYPE)==U_BPT_NONE) {
+                    if(c3!=start) {
+                        log_err("u_getBidiPairedBracket(U+%04lx) != self for bpt(c)==None\n",
+                                (long)start);
+                    }
+                } else {
+                    if(c3!=c2) {
+                        log_err("u_getBidiPairedBracket(U+%04lx) != U+%04lx = bmg(c)'\n",
+                                (long)start, (long)c2);
+                    }
+                }
+            } while(++start<=end);
+        }
+    }
+
+    uset_close(set);
 }
 
 
@@ -1762,7 +2085,7 @@ CheckScriptRuns(UScriptRun *scriptRun, int32_t *runStarts, const RunTestData *te
 static void
 TestUScriptRunAPI()
 {
-    static const RunTestData testData[] = {
+    static const RunTestData testData1[] = {
         {"\\u0020\\u0946\\u0939\\u093F\\u0928\\u094D\\u0926\\u0940\\u0020", USCRIPT_DEVANAGARI},
         {"\\u0627\\u0644\\u0639\\u0631\\u0628\\u064A\\u0629\\u0020", USCRIPT_ARABIC},
         {"\\u0420\\u0443\\u0441\\u0441\\u043A\\u0438\\u0439\\u0020", USCRIPT_CYRILLIC},
@@ -1774,135 +2097,152 @@ TestUScriptRunAPI()
         {"\\u30AB\\u30BF\\u30AB\\u30CA", USCRIPT_KATAKANA},
         {"\\U00010400\\U00010401\\U00010402\\U00010403", USCRIPT_DESERET}
     };
-
-    int32_t nTestRuns = sizeof testData / sizeof testData[0];
-
-    UChar testString[1024];
-    int32_t runStarts[256];
-
-    int32_t run, stringLimit;
-    UScriptRun *scriptRun = NULL;
-    UErrorCode err;
-
-    /*
-     * Fill in the test string and the runStarts array.
-     */
-    stringLimit = 0;
-    for (run = 0; run < nTestRuns; run += 1) {
-        runStarts[run] = stringLimit;
-        stringLimit += u_unescape(testData[run].runText, &testString[stringLimit], 1024 - stringLimit);
-        /*stringLimit -= 1;*/
-    }
-
-    /* The limit of the last run */ 
-    runStarts[nTestRuns] = stringLimit;
-
-    /*
-     * Make sure that calling uscript_OpenRun with a NULL text pointer
-     * and a non-zero text length returns the correct error.
-     */
-    err = U_ZERO_ERROR;
-    scriptRun = uscript_openRun(NULL, stringLimit, &err);
-
-    if (err != U_ILLEGAL_ARGUMENT_ERROR) {
-        log_err("uscript_openRun(NULL, stringLimit, &err) returned %s instead of U_ILLEGAL_ARGUMENT_ERROR.\n", u_errorName(err));
-    }
-
-    if (scriptRun != NULL) {
-        log_err("uscript_openRun(NULL, stringLimit, &err) returned a non-NULL result.\n");
+    
+    static const RunTestData testData2[] = {
+       {"((((((((((abc))))))))))", USCRIPT_LATIN}
+    };
+    
+    static const struct {
+      const RunTestData *testData;
+      int32_t nRuns;
+    } testDataEntries[] = {
+        {testData1, UPRV_LENGTHOF(testData1)},
+        {testData2, UPRV_LENGTHOF(testData2)}
+    };
+    
+    static const int32_t nTestEntries = UPRV_LENGTHOF(testDataEntries);
+    int32_t testEntry;
+    
+    for (testEntry = 0; testEntry < nTestEntries; testEntry += 1) {
+        UChar testString[1024];
+        int32_t runStarts[256];
+        int32_t nTestRuns = testDataEntries[testEntry].nRuns;
+        const RunTestData *testData = testDataEntries[testEntry].testData;
+    
+        int32_t run, stringLimit;
+        UScriptRun *scriptRun = NULL;
+        UErrorCode err;
+    
+        /*
+         * Fill in the test string and the runStarts array.
+         */
+        stringLimit = 0;
+        for (run = 0; run < nTestRuns; run += 1) {
+            runStarts[run] = stringLimit;
+            stringLimit += u_unescape(testData[run].runText, &testString[stringLimit], 1024 - stringLimit);
+            /*stringLimit -= 1;*/
+        }
+    
+        /* The limit of the last run */ 
+        runStarts[nTestRuns] = stringLimit;
+    
+        /*
+         * Make sure that calling uscript_OpenRun with a NULL text pointer
+         * and a non-zero text length returns the correct error.
+         */
+        err = U_ZERO_ERROR;
+        scriptRun = uscript_openRun(NULL, stringLimit, &err);
+    
+        if (err != U_ILLEGAL_ARGUMENT_ERROR) {
+            log_err("uscript_openRun(NULL, stringLimit, &err) returned %s instead of U_ILLEGAL_ARGUMENT_ERROR.\n", u_errorName(err));
+        }
+    
+        if (scriptRun != NULL) {
+            log_err("uscript_openRun(NULL, stringLimit, &err) returned a non-NULL result.\n");
+            uscript_closeRun(scriptRun);
+        }
+    
+        /*
+         * Make sure that calling uscript_OpenRun with a non-NULL text pointer
+         * and a zero text length returns the correct error.
+         */
+        err = U_ZERO_ERROR;
+        scriptRun = uscript_openRun(testString, 0, &err);
+    
+        if (err != U_ILLEGAL_ARGUMENT_ERROR) {
+            log_err("uscript_openRun(testString, 0, &err) returned %s instead of U_ILLEGAL_ARGUMENT_ERROR.\n", u_errorName(err));
+        }
+    
+        if (scriptRun != NULL) {
+            log_err("uscript_openRun(testString, 0, &err) returned a non-NULL result.\n");
+            uscript_closeRun(scriptRun);
+        }
+    
+        /*
+         * Make sure that calling uscript_openRun with a NULL text pointer
+         * and a zero text length doesn't return an error.
+         */
+        err = U_ZERO_ERROR;
+        scriptRun = uscript_openRun(NULL, 0, &err);
+    
+        if (U_FAILURE(err)) {
+            log_err("Got error %s from uscript_openRun(NULL, 0, &err)\n", u_errorName(err));
+        }
+    
+        /* Make sure that the empty iterator doesn't find any runs */
+        if (uscript_nextRun(scriptRun, NULL, NULL, NULL)) {
+            log_err("uscript_nextRun(...) returned TRUE for an empty iterator.\n");
+        }
+    
+        /*
+         * Make sure that calling uscript_setRunText with a NULL text pointer
+         * and a non-zero text length returns the correct error.
+         */
+        err = U_ZERO_ERROR;
+        uscript_setRunText(scriptRun, NULL, stringLimit, &err);
+    
+        if (err != U_ILLEGAL_ARGUMENT_ERROR) {
+            log_err("uscript_setRunText(scriptRun, NULL, stringLimit, &err) returned %s instead of U_ILLEGAL_ARGUMENT_ERROR.\n", u_errorName(err));
+        }
+    
+        /*
+         * Make sure that calling uscript_OpenRun with a non-NULL text pointer
+         * and a zero text length returns the correct error.
+         */
+        err = U_ZERO_ERROR;
+        uscript_setRunText(scriptRun, testString, 0, &err);
+    
+        if (err != U_ILLEGAL_ARGUMENT_ERROR) {
+            log_err("uscript_setRunText(scriptRun, testString, 0, &err) returned %s instead of U_ILLEGAL_ARGUMENT_ERROR.\n", u_errorName(err));
+        }
+    
+        /*
+         * Now call uscript_setRunText on the empty iterator
+         * and make sure that it works.
+         */
+        err = U_ZERO_ERROR;
+        uscript_setRunText(scriptRun, testString, stringLimit, &err);
+    
+        if (U_FAILURE(err)) {
+            log_err("Got error %s from uscript_setRunText(...)\n", u_errorName(err));
+        } else {
+            CheckScriptRuns(scriptRun, runStarts, testData, nTestRuns, "uscript_setRunText");
+        }
+    
         uscript_closeRun(scriptRun);
-    }
-
-    /*
-     * Make sure that calling uscript_OpenRun with a non-NULL text pointer
-     * and a zero text length returns the correct error.
-     */
-    err = U_ZERO_ERROR;
-    scriptRun = uscript_openRun(testString, 0, &err);
-
-    if (err != U_ILLEGAL_ARGUMENT_ERROR) {
-        log_err("uscript_openRun(testString, 0, &err) returned %s instead of U_ILLEGAL_ARGUMENT_ERROR.\n", u_errorName(err));
-    }
-
-    if (scriptRun != NULL) {
-        log_err("uscript_openRun(testString, 0, &err) returned a non-NULL result.\n");
+    
+        /* 
+         * Now open an interator over the testString
+         * using uscript_openRun and make sure that it works
+         */
+        scriptRun = uscript_openRun(testString, stringLimit, &err);
+    
+        if (U_FAILURE(err)) {
+            log_err("Got error %s from uscript_openRun(...)\n", u_errorName(err));
+        } else {
+            CheckScriptRuns(scriptRun, runStarts, testData, nTestRuns, "uscript_openRun");
+        }
+    
+        /* Now reset the iterator, and make sure
+         * that it still works.
+         */
+        uscript_resetRun(scriptRun);
+    
+        CheckScriptRuns(scriptRun, runStarts, testData, nTestRuns, "uscript_resetRun");
+    
+        /* Close the iterator */
         uscript_closeRun(scriptRun);
     }
-
-    /*
-     * Make sure that calling uscript_openRun with a NULL text pointer
-     * and a zero text length doesn't return an error.
-     */
-    err = U_ZERO_ERROR;
-    scriptRun = uscript_openRun(NULL, 0, &err);
-
-    if (U_FAILURE(err)) {
-        log_err("Got error %s from uscript_openRun(NULL, 0, &err)\n", u_errorName(err));
-    }
-
-    /* Make sure that the empty iterator doesn't find any runs */
-    if (uscript_nextRun(scriptRun, NULL, NULL, NULL)) {
-        log_err("uscript_nextRun(...) returned TRUE for an empty iterator.\n");
-    }
-
-    /*
-     * Make sure that calling uscript_setRunText with a NULL text pointer
-     * and a non-zero text length returns the correct error.
-     */
-    err = U_ZERO_ERROR;
-    uscript_setRunText(scriptRun, NULL, stringLimit, &err);
-
-    if (err != U_ILLEGAL_ARGUMENT_ERROR) {
-        log_err("uscript_setRunText(scriptRun, NULL, stringLimit, &err) returned %s instead of U_ILLEGAL_ARGUMENT_ERROR.\n", u_errorName(err));
-    }
-
-    /*
-     * Make sure that calling uscript_OpenRun with a non-NULL text pointer
-     * and a zero text length returns the correct error.
-     */
-    err = U_ZERO_ERROR;
-    uscript_setRunText(scriptRun, testString, 0, &err);
-
-    if (err != U_ILLEGAL_ARGUMENT_ERROR) {
-        log_err("uscript_setRunText(scriptRun, testString, 0, &err) returned %s instead of U_ILLEGAL_ARGUMENT_ERROR.\n", u_errorName(err));
-    }
-
-    /*
-     * Now call uscript_setRunText on the empty iterator
-     * and make sure that it works.
-     */
-    err = U_ZERO_ERROR;
-    uscript_setRunText(scriptRun, testString, stringLimit, &err);
-
-    if (U_FAILURE(err)) {
-        log_err("Got error %s from uscript_setRunText(...)\n", u_errorName(err));
-    } else {
-        CheckScriptRuns(scriptRun, runStarts, testData, nTestRuns, "uscript_setRunText");
-    }
-
-    uscript_closeRun(scriptRun);
-
-    /* 
-     * Now open an interator over the testString
-     * using uscript_openRun and make sure that it works
-     */
-    scriptRun = uscript_openRun(testString, stringLimit, &err);
-
-    if (U_FAILURE(err)) {
-        log_err("Got error %s from uscript_openRun(...)\n", u_errorName(err));
-    } else {
-        CheckScriptRuns(scriptRun, runStarts, testData, nTestRuns, "uscript_openRun");
-    }
-
-    /* Now reset the iterator, and make sure
-     * that it still works.
-     */
-    uscript_resetRun(scriptRun);
-
-    CheckScriptRuns(scriptRun, runStarts, testData, nTestRuns, "uscript_resetRun");
-
-    /* Close the iterator */
-    uscript_closeRun(scriptRun);
 }
 
 /* test additional, non-core properties */
@@ -1926,7 +2266,7 @@ TestAdditionalProperties() {
     };
 
     /* test data for u_hasBinaryProperty() */
-    static int32_t
+    static const int32_t
     props[][3]={ /* code point, property, value */
         { 0x0627, UCHAR_ALPHABETIC, TRUE },
         { 0x1034a, UCHAR_ALPHABETIC, TRUE },
@@ -1941,6 +2281,12 @@ TestAdditionalProperties() {
         { 0x003c, UCHAR_BIDI_MIRRORED, TRUE },
         { 0x003d, UCHAR_BIDI_MIRRORED, FALSE },
 
+        /* see Unicode Corrigendum #6 at http://www.unicode.org/versions/corrigendum6.html */
+        { 0x2018, UCHAR_BIDI_MIRRORED, FALSE },
+        { 0x201d, UCHAR_BIDI_MIRRORED, FALSE },
+        { 0x201f, UCHAR_BIDI_MIRRORED, FALSE },
+        { 0x301e, UCHAR_BIDI_MIRRORED, FALSE },
+
         { 0x058a, UCHAR_DASH, TRUE },
         { 0x007e, UCHAR_DASH, FALSE },
 
@@ -1954,6 +2300,29 @@ TestAdditionalProperties() {
         { 0xfb1d, UCHAR_FULL_COMPOSITION_EXCLUSION, TRUE },
         { 0x1d15f, UCHAR_FULL_COMPOSITION_EXCLUSION, TRUE },
         { 0xfb1e, UCHAR_FULL_COMPOSITION_EXCLUSION, FALSE },
+
+        { 0x110a, UCHAR_NFD_INERT, TRUE },      /* Jamo L */
+        { 0x0308, UCHAR_NFD_INERT, FALSE },
+
+        { 0x1164, UCHAR_NFKD_INERT, TRUE },     /* Jamo V */
+        { 0x1d79d, UCHAR_NFKD_INERT, FALSE },   /* math compat version of xi */
+
+        { 0x0021, UCHAR_NFC_INERT, TRUE },      /* ! */
+        { 0x0061, UCHAR_NFC_INERT, FALSE },     /* a */
+        { 0x00e4, UCHAR_NFC_INERT, FALSE },     /* a-umlaut */
+        { 0x0102, UCHAR_NFC_INERT, FALSE },     /* a-breve */
+        { 0xac1c, UCHAR_NFC_INERT, FALSE },     /* Hangul LV */
+        { 0xac1d, UCHAR_NFC_INERT, TRUE },      /* Hangul LVT */
+
+        { 0x1d79d, UCHAR_NFKC_INERT, FALSE },   /* math compat version of xi */
+        { 0x2a6d6, UCHAR_NFKC_INERT, TRUE },    /* Han, last of CJK ext. B */
+
+        { 0x00e4, UCHAR_SEGMENT_STARTER, TRUE },
+        { 0x0308, UCHAR_SEGMENT_STARTER, FALSE },
+        { 0x110a, UCHAR_SEGMENT_STARTER, TRUE }, /* Jamo L */
+        { 0x1164, UCHAR_SEGMENT_STARTER, FALSE },/* Jamo V */
+        { 0xac1c, UCHAR_SEGMENT_STARTER, TRUE }, /* Hangul LV */
+        { 0xac1d, UCHAR_SEGMENT_STARTER, TRUE }, /* Hangul LVT */
 #endif
 
         { 0x0044, UCHAR_HEX_DIGIT, TRUE },
@@ -2018,21 +2387,25 @@ TestAdditionalProperties() {
          * The following properties are only supported starting with the
          * Unicode version indicated in the second field.
          */
-        { -1, 0x32, 0 },
+        { -1, 0x320, 0 },
 
         { 0x180c, UCHAR_DEFAULT_IGNORABLE_CODE_POINT, TRUE },
         { 0xfe02, UCHAR_DEFAULT_IGNORABLE_CODE_POINT, TRUE },
         { 0x1801, UCHAR_DEFAULT_IGNORABLE_CODE_POINT, FALSE },
 
-        { 0x0341, UCHAR_DEPRECATED, TRUE },
-        { 0xe0041, UCHAR_DEPRECATED, FALSE },
+        { 0x0149, UCHAR_DEPRECATED, TRUE },         /* changed in Unicode 5.2 */
+        { 0x0341, UCHAR_DEPRECATED, FALSE },        /* changed in Unicode 5.2 */
+        { 0xe0041, UCHAR_DEPRECATED, TRUE },        /* changed from Unicode 5 to 5.1 */
+        { 0xe0100, UCHAR_DEPRECATED, FALSE },
 
         { 0x00a0, UCHAR_GRAPHEME_BASE, TRUE },
         { 0x0a4d, UCHAR_GRAPHEME_BASE, FALSE },
-        { 0xff9f, UCHAR_GRAPHEME_BASE, TRUE },      /* changed from Unicode 3.2 to 4 */
+        { 0xff9d, UCHAR_GRAPHEME_BASE, TRUE },
+        { 0xff9f, UCHAR_GRAPHEME_BASE, FALSE },     /* changed from Unicode 3.2 to 4 and again from 5 to 5.1 */
 
         { 0x0300, UCHAR_GRAPHEME_EXTEND, TRUE },
-        { 0xff9f, UCHAR_GRAPHEME_EXTEND, FALSE },   /* changed from Unicode 3.2 to 4 */
+        { 0xff9d, UCHAR_GRAPHEME_EXTEND, FALSE },
+        { 0xff9f, UCHAR_GRAPHEME_EXTEND, TRUE },    /* changed from Unicode 3.2 to 4 and again from 5 to 5.1 */
         { 0x0603, UCHAR_GRAPHEME_EXTEND, FALSE },
 
         { 0x0a4d, UCHAR_GRAPHEME_LINK, TRUE },
@@ -2056,23 +2429,33 @@ TestAdditionalProperties() {
         { 0xfa11, UCHAR_UNIFIED_IDEOGRAPH, TRUE },
         { 0xfa12, UCHAR_UNIFIED_IDEOGRAPH, FALSE },
 
+        { -1, 0x401, 0 }, /* version break for Unicode 4.0.1 */
+
+        { 0x002e, UCHAR_S_TERM, TRUE },
+        { 0x0061, UCHAR_S_TERM, FALSE },
+
+        { 0x180c, UCHAR_VARIATION_SELECTOR, TRUE },
+        { 0xfe03, UCHAR_VARIATION_SELECTOR, TRUE },
+        { 0xe01ef, UCHAR_VARIATION_SELECTOR, TRUE },
+        { 0xe0200, UCHAR_VARIATION_SELECTOR, FALSE },
+
         /* enum/integer type properties */
 
         /* UCHAR_BIDI_CLASS tested for assigned characters in TestUnicodeData() */
         /* test default Bidi classes for unassigned code points */
         { 0x0590, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
-        { 0x05a2, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
+        { 0x05cf, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
         { 0x05ed, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
-        { 0x07f2, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
-        { 0x08ba, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
+        { 0x07f2, UCHAR_BIDI_CLASS, U_DIR_NON_SPACING_MARK }, /* Nko, new in Unicode 5.0 */
+        { 0x07fe, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, /* unassigned R */
+        { 0x089f, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
         { 0xfb37, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
         { 0xfb42, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
         { 0x10806, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
         { 0x10909, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
         { 0x10fe4, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
 
-        { 0x0606, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
-        { 0x061c, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
+        { 0x061d, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
         { 0x063f, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
         { 0x070e, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
         { 0x0775, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
@@ -2084,11 +2467,13 @@ TestAdditionalProperties() {
         { 0x0C4E, UCHAR_BLOCK, UBLOCK_TELUGU },
         { 0x155A, UCHAR_BLOCK, UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS },
         { 0x1717, UCHAR_BLOCK, UBLOCK_TAGALOG },
-        { 0x1AFF, UCHAR_BLOCK, UBLOCK_NO_BLOCK },
+        { 0x1900, UCHAR_BLOCK, UBLOCK_LIMBU },
+        { 0x1CBF, UCHAR_BLOCK, UBLOCK_NO_BLOCK },
         { 0x3040, UCHAR_BLOCK, UBLOCK_HIRAGANA },
         { 0x1D0FF, UCHAR_BLOCK, UBLOCK_BYZANTINE_MUSICAL_SYMBOLS },
-        { 0x10D0FF, UCHAR_BLOCK, UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B },
+        { 0x50000, UCHAR_BLOCK, UBLOCK_NO_BLOCK },
         { 0xEFFFF, UCHAR_BLOCK, UBLOCK_NO_BLOCK },
+        { 0x10D0FF, UCHAR_BLOCK, UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B },
 
         /* UCHAR_CANONICAL_COMBINING_CLASS tested for assigned characters in TestUnicodeData() */
         { 0xd7d7, UCHAR_CANONICAL_COMBINING_CLASS, 0 },
@@ -2122,14 +2507,14 @@ TestAdditionalProperties() {
         { 0x10EEEE, UCHAR_EAST_ASIAN_WIDTH, U_EA_AMBIGUOUS },
 
         /* UCHAR_GENERAL_CATEGORY tested for assigned characters in TestUnicodeData() */
-        { 0xd7d7, UCHAR_GENERAL_CATEGORY, 0 },
+        { 0xd7c7, UCHAR_GENERAL_CATEGORY, 0 },
+        { 0xd7d7, UCHAR_GENERAL_CATEGORY, U_OTHER_LETTER },     /* changed in Unicode 5.2 */
 
         { 0x0444, UCHAR_JOINING_GROUP, U_JG_NO_JOINING_GROUP },
         { 0x0639, UCHAR_JOINING_GROUP, U_JG_AIN },
         { 0x072A, UCHAR_JOINING_GROUP, U_JG_DALATH_RISH },
         { 0x0647, UCHAR_JOINING_GROUP, U_JG_HEH },
         { 0x06C1, UCHAR_JOINING_GROUP, U_JG_HEH_GOAL },
-        { 0x06C3, UCHAR_JOINING_GROUP, U_JG_HAMZA_ON_HEH_GOAL },
 
         { 0x200C, UCHAR_JOINING_TYPE, U_JT_NON_JOINING },
         { 0x200D, UCHAR_JOINING_TYPE, U_JT_JOIN_CAUSING },
@@ -2147,7 +2532,6 @@ TestAdditionalProperties() {
         { 0x232A, UCHAR_LINE_BREAK, U_LB_CLOSE_PUNCTUATION },
         { 0x3401, UCHAR_LINE_BREAK, U_LB_IDEOGRAPHIC },
         { 0x4e02, UCHAR_LINE_BREAK, U_LB_IDEOGRAPHIC },
-        { 0xac03, UCHAR_LINE_BREAK, U_LB_IDEOGRAPHIC },
         { 0x20004, UCHAR_LINE_BREAK, U_LB_IDEOGRAPHIC },
         { 0xf905, UCHAR_LINE_BREAK, U_LB_IDEOGRAPHIC },
         { 0xdb7e, UCHAR_LINE_BREAK, U_LB_SURROGATE },
@@ -2162,27 +2546,43 @@ TestAdditionalProperties() {
 
         /* UCHAR_SCRIPT tested in TestUScriptCodeAPI() */
 
+        { 0x10ff, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
         { 0x1100, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },
         { 0x1111, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },
         { 0x1159, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },
+        { 0x115a, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },     /* changed in Unicode 5.2 */
+        { 0x115e, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },     /* changed in Unicode 5.2 */
         { 0x115f, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },
 
+        { 0xa95f, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
+        { 0xa960, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },     /* changed in Unicode 5.2 */
+        { 0xa97c, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },     /* changed in Unicode 5.2 */
+        { 0xa97d, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
+
         { 0x1160, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },
         { 0x1161, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },
         { 0x1172, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },
         { 0x11a2, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },
+        { 0x11a3, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },       /* changed in Unicode 5.2 */
+        { 0x11a7, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },       /* changed in Unicode 5.2 */
+
+        { 0xd7af, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
+        { 0xd7b0, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },       /* changed in Unicode 5.2 */
+        { 0xd7c6, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },       /* changed in Unicode 5.2 */
+        { 0xd7c7, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
 
         { 0x11a8, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },
         { 0x11b8, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },
         { 0x11c8, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },
         { 0x11f9, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },
+        { 0x11fa, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },    /* changed in Unicode 5.2 */
+        { 0x11ff, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },    /* changed in Unicode 5.2 */
+        { 0x1200, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
 
-        { 0x115a, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
-        { 0x115e, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
-        { 0x11a3, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
-        { 0x11a7, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
-        { 0x11fa, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
-        { 0x11ff, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
+        { 0xd7ca, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
+        { 0xd7cb, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },    /* changed in Unicode 5.2 */
+        { 0xd7fb, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },    /* changed in Unicode 5.2 */
+        { 0xd7fc, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
 
         { 0xac00, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LV_SYLLABLE },
         { 0xac1c, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LV_SYLLABLE },
@@ -2197,6 +2597,94 @@ TestAdditionalProperties() {
 
         { 0xd7a4, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
 
+        { -1, 0x410, 0 }, /* version break for Unicode 4.1 */
+
+        { 0x00d7, UCHAR_PATTERN_SYNTAX, TRUE },
+        { 0xfe45, UCHAR_PATTERN_SYNTAX, TRUE },
+        { 0x0061, UCHAR_PATTERN_SYNTAX, FALSE },
+
+        { 0x0020, UCHAR_PATTERN_WHITE_SPACE, TRUE },
+        { 0x0085, UCHAR_PATTERN_WHITE_SPACE, TRUE },
+        { 0x200f, UCHAR_PATTERN_WHITE_SPACE, TRUE },
+        { 0x00a0, UCHAR_PATTERN_WHITE_SPACE, FALSE },
+        { 0x3000, UCHAR_PATTERN_WHITE_SPACE, FALSE },
+
+        { 0x1d200, UCHAR_BLOCK, UBLOCK_ANCIENT_GREEK_MUSICAL_NOTATION },
+        { 0x2c8e,  UCHAR_BLOCK, UBLOCK_COPTIC },
+        { 0xfe17,  UCHAR_BLOCK, UBLOCK_VERTICAL_FORMS },
+
+        { 0x1a00,  UCHAR_SCRIPT, USCRIPT_BUGINESE },
+        { 0x2cea,  UCHAR_SCRIPT, USCRIPT_COPTIC },
+        { 0xa82b,  UCHAR_SCRIPT, USCRIPT_SYLOTI_NAGRI },
+        { 0x103d0, UCHAR_SCRIPT, USCRIPT_OLD_PERSIAN },
+
+        { 0xcc28, UCHAR_LINE_BREAK, U_LB_H2 },
+        { 0xcc29, UCHAR_LINE_BREAK, U_LB_H3 },
+        { 0xac03, UCHAR_LINE_BREAK, U_LB_H3 },
+        { 0x115f, UCHAR_LINE_BREAK, U_LB_JL },
+        { 0x11aa, UCHAR_LINE_BREAK, U_LB_JT },
+        { 0x11a1, UCHAR_LINE_BREAK, U_LB_JV },
+
+        { 0xb2c9, UCHAR_GRAPHEME_CLUSTER_BREAK, U_GCB_LVT },
+        { 0x036f, UCHAR_GRAPHEME_CLUSTER_BREAK, U_GCB_EXTEND },
+        { 0x0000, UCHAR_GRAPHEME_CLUSTER_BREAK, U_GCB_CONTROL },
+        { 0x1160, UCHAR_GRAPHEME_CLUSTER_BREAK, U_GCB_V },
+
+        { 0x05f4, UCHAR_WORD_BREAK, U_WB_MIDLETTER },
+        { 0x4ef0, UCHAR_WORD_BREAK, U_WB_OTHER },
+        { 0x19d9, UCHAR_WORD_BREAK, U_WB_NUMERIC },
+        { 0x2044, UCHAR_WORD_BREAK, U_WB_MIDNUM },
+
+        { 0xfffd, UCHAR_SENTENCE_BREAK, U_SB_OTHER },
+        { 0x1ffc, UCHAR_SENTENCE_BREAK, U_SB_UPPER },
+        { 0xff63, UCHAR_SENTENCE_BREAK, U_SB_CLOSE },
+        { 0x2028, UCHAR_SENTENCE_BREAK, U_SB_SEP },
+
+        { -1, 0x520, 0 }, /* version break for Unicode 5.2 */
+
+        /* unassigned code points in new default Bidi R blocks */
+        { 0x1ede4, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
+        { 0x1efe4, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
+
+        /* test some script codes >127 */
+        { 0xa6e6,  UCHAR_SCRIPT, USCRIPT_BAMUM },
+        { 0xa4d0,  UCHAR_SCRIPT, USCRIPT_LISU },
+        { 0x10a7f,  UCHAR_SCRIPT, USCRIPT_OLD_SOUTH_ARABIAN },
+
+        { -1, 0x600, 0 }, /* version break for Unicode 6.0 */
+
+        /* value changed in Unicode 6.0 */
+        { 0x06C3, UCHAR_JOINING_GROUP, U_JG_TEH_MARBUTA_GOAL },
+
+        { -1, 0x610, 0 }, /* version break for Unicode 6.1 */
+
+        /* unassigned code points in new/changed default Bidi AL blocks */
+        { 0x08ba, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
+        { 0x1eee4, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
+
+        { -1, 0x630, 0 }, /* version break for Unicode 6.3 */
+
+        /* unassigned code points in the currency symbols block now default to ET */
+        { 0x20C0, UCHAR_BIDI_CLASS, U_EUROPEAN_NUMBER_TERMINATOR },
+        { 0x20CF, UCHAR_BIDI_CLASS, U_EUROPEAN_NUMBER_TERMINATOR },
+
+        /* new property in Unicode 6.3 */
+        { 0x0027, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_NONE },
+        { 0x0028, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_OPEN },
+        { 0x0029, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_CLOSE },
+        { 0xFF5C, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_NONE },
+        { 0xFF5B, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_OPEN },
+        { 0xFF5D, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_CLOSE },
+
+        { -1, 0x700, 0 }, /* version break for Unicode 7.0 */
+
+        /* new character range with Joining_Group values */
+        { 0x10ABF, UCHAR_JOINING_GROUP, U_JG_NO_JOINING_GROUP },
+        { 0x10AC0, UCHAR_JOINING_GROUP, U_JG_MANICHAEAN_ALEPH },
+        { 0x10AC1, UCHAR_JOINING_GROUP, U_JG_MANICHAEAN_BETH },
+        { 0x10AEF, UCHAR_JOINING_GROUP, U_JG_MANICHAEAN_HUNDRED },
+        { 0x10AF0, UCHAR_JOINING_GROUP, U_JG_NO_JOINING_GROUP },
+
         /* undefined UProperty values */
         { 0x61, 0x4a7, 0 },
         { 0x234bc, 0x15ed, 0 }
@@ -2209,7 +2697,7 @@ TestAdditionalProperties() {
 
     /* what is our Unicode version? */
     u_getUnicodeVersion(version);
-    uVersion=(version[0]<<4)|version[1]; /* major/minor version numbers */
+    uVersion=((int32_t)version[0]<<8)|(version[1]<<4)|version[2]; /* major/minor/update version numbers */
 
     u_charAge(0x20, version);
     if(version[0]==0) {
@@ -2237,25 +2725,69 @@ TestAdditionalProperties() {
     ) {
         log_err("error: u_getIntPropertyMinValue() wrong\n");
     }
-
-    if( u_getIntPropertyMaxValue(UCHAR_DASH)!=1 ||
-        u_getIntPropertyMaxValue(UCHAR_ID_CONTINUE)!=1 ||
-        u_getIntPropertyMaxValue(UCHAR_BINARY_LIMIT-1)!=1 ||
-        u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)!=(int32_t)U_CHAR_DIRECTION_COUNT-1 ||
-        u_getIntPropertyMaxValue(UCHAR_BLOCK)!=(int32_t)UBLOCK_COUNT-1 ||
-        u_getIntPropertyMaxValue(UCHAR_LINE_BREAK)!=(int32_t)U_LB_COUNT-1 ||
-        u_getIntPropertyMaxValue(UCHAR_SCRIPT)!=(int32_t)USCRIPT_CODE_LIMIT-1 ||
-        u_getIntPropertyMaxValue(0x2345)!=-1 /*JB#2410*/ ||
-        u_getIntPropertyMaxValue(UCHAR_DECOMPOSITION_TYPE) != (int32_t) (U_DT_COUNT - 1) ||
-        u_getIntPropertyMaxValue(UCHAR_JOINING_GROUP) !=  (int32_t) (U_JG_COUNT -1) ||
-        u_getIntPropertyMaxValue(UCHAR_JOINING_TYPE) != (int32_t) (U_JT_COUNT -1) ||
-        u_getIntPropertyMaxValue(UCHAR_EAST_ASIAN_WIDTH) != (int32_t) (U_EA_COUNT -1)
-    ) {
-        log_err("error: u_getIntPropertyMaxValue() wrong\n");
+    if( u_getIntPropertyMaxValue(UCHAR_DASH)!=1) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_DASH) wrong\n");
+    }
+    if( u_getIntPropertyMaxValue(UCHAR_ID_CONTINUE)!=1) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_ID_CONTINUE) wrong\n");
+    }
+    if( u_getIntPropertyMaxValue((UProperty)(UCHAR_BINARY_LIMIT-1))!=1) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_BINARY_LIMIT-1) wrong\n");
+    }
+    if( u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)!=(int32_t)U_CHAR_DIRECTION_COUNT-1 ) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS) wrong\n");
+    }
+    if( u_getIntPropertyMaxValue(UCHAR_BLOCK)!=(int32_t)UBLOCK_COUNT-1 ) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_BLOCK) wrong\n");
+    }
+    if(u_getIntPropertyMaxValue(UCHAR_LINE_BREAK)!=(int32_t)U_LB_COUNT-1) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_LINE_BREAK) wrong\n");
+    }
+    if(u_getIntPropertyMaxValue(UCHAR_SCRIPT)!=(int32_t)USCRIPT_CODE_LIMIT-1) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_SCRIPT) wrong\n");
+    }
+    if(u_getIntPropertyMaxValue(UCHAR_NUMERIC_TYPE)!=(int32_t)U_NT_COUNT-1) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_NUMERIC_TYPE) wrong\n");
+    }
+    if(u_getIntPropertyMaxValue(UCHAR_GENERAL_CATEGORY)!=(int32_t)U_CHAR_CATEGORY_COUNT-1) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_GENERAL_CATEGORY) wrong\n");
+    }
+    if(u_getIntPropertyMaxValue(UCHAR_HANGUL_SYLLABLE_TYPE)!=(int32_t)U_HST_COUNT-1) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_HANGUL_SYLLABLE_TYPE) wrong\n");
+    }
+    if(u_getIntPropertyMaxValue(UCHAR_GRAPHEME_CLUSTER_BREAK)!=(int32_t)U_GCB_COUNT-1) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_GRAPHEME_CLUSTER_BREAK) wrong\n");
+    }
+    if(u_getIntPropertyMaxValue(UCHAR_SENTENCE_BREAK)!=(int32_t)U_SB_COUNT-1) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_SENTENCE_BREAK) wrong\n");
+    }
+    if(u_getIntPropertyMaxValue(UCHAR_WORD_BREAK)!=(int32_t)U_WB_COUNT-1) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_WORD_BREAK) wrong\n");
+    }
+    if(u_getIntPropertyMaxValue(UCHAR_BIDI_PAIRED_BRACKET_TYPE)!=(int32_t)U_BPT_COUNT-1) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_BIDI_PAIRED_BRACKET_TYPE) wrong\n");
+    }
+    /*JB#2410*/
+    if( u_getIntPropertyMaxValue(0x2345)!=-1) {
+        log_err("error: u_getIntPropertyMaxValue(0x2345) wrong\n");
+    }
+    if( u_getIntPropertyMaxValue(UCHAR_DECOMPOSITION_TYPE) != (int32_t) (U_DT_COUNT - 1)) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_DECOMPOSITION_TYPE) wrong\n");
+    }
+    if( u_getIntPropertyMaxValue(UCHAR_JOINING_GROUP) !=  (int32_t) (U_JG_COUNT -1)) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_JOINING_GROUP) wrong\n");
+    }
+    if( u_getIntPropertyMaxValue(UCHAR_JOINING_TYPE) != (int32_t) (U_JT_COUNT -1)) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_JOINING_TYPE) wrong\n");
+    }
+    if( u_getIntPropertyMaxValue(UCHAR_EAST_ASIAN_WIDTH) != (int32_t) (U_EA_COUNT -1)) {
+        log_err("error: u_getIntPropertyMaxValue(UCHAR_EAST_ASIAN_WIDTH) wrong\n");
     }
 
     /* test u_hasBinaryProperty() and u_getIntPropertyValue() */
     for(i=0; i<sizeof(props)/sizeof(props[0]); ++i) {
+        const char *whichName;
+
         if(props[i][0]<0) {
             /* Unicode version break */
             if(uVersion<props[i][1]) {
@@ -2267,19 +2799,20 @@ TestAdditionalProperties() {
 
         c=(UChar32)props[i][0];
         which=(UProperty)props[i][1];
+        whichName=u_getPropertyName(which, U_LONG_PROPERTY_NAME);
 
         if(which<UCHAR_INT_START) {
             result=u_hasBinaryProperty(c, which);
             if(result!=props[i][2]) {
-                log_err("error: u_hasBinaryProperty(U+%04lx, %d)=%d is wrong (props[%d])\n",
-                        c, which, result, i);
+                log_data_err("error: u_hasBinaryProperty(U+%04lx, %s)=%d is wrong (props[%d]) - (Are you missing data?)\n",
+                        c, whichName, result, i);
             }
         }
 
         result=u_getIntPropertyValue(c, which);
         if(result!=props[i][2]) {
-            log_err("error: u_getIntPropertyValue(U+%04lx, 0x1000+%d)=%d is wrong, should be %d (props[%d])\n",
-                    c, (int32_t)which-0x1000, result, props[i][2], i);
+            log_data_err("error: u_getIntPropertyValue(U+%04lx, %s)=%d is wrong, should be %d (props[%d]) - (Are you missing data?)\n",
+                    c, whichName, result, props[i][2], i);
         }
 
         /* test separate functions, too */
@@ -2325,7 +2858,14 @@ TestNumericProperties(void) {
         { 0x0F33, U_NT_NUMERIC, -1./2. },
         { 0x0C66, U_NT_DECIMAL, 0 },
         { 0x96f6, U_NT_NUMERIC, 0 },
+        { 0xa833, U_NT_NUMERIC, 1./16. },
+        { 0x2152, U_NT_NUMERIC, 1./10. },
+        { 0x2151, U_NT_NUMERIC, 1./9. },
+        { 0x1245f, U_NT_NUMERIC, 1./8. },
+        { 0x2150, U_NT_NUMERIC, 1./7. },
         { 0x2159, U_NT_NUMERIC, 1./6. },
+        { 0x09f6, U_NT_NUMERIC, 3./16. },
+        { 0x2155, U_NT_NUMERIC, 1./5. },
         { 0x00BD, U_NT_NUMERIC, 1./2. },
         { 0x0031, U_NT_DECIMAL, 1. },
         { 0x4e00, U_NT_NUMERIC, 1. },
@@ -2359,21 +2899,25 @@ TestNumericProperties(void) {
         { 0x2181, U_NT_NUMERIC, 5000. },
         { 0x137C, U_NT_NUMERIC, 10000. },
         { 0x4e07, U_NT_NUMERIC, 10000. },
+        { 0x12432, U_NT_NUMERIC, 216000. },
+        { 0x12433, U_NT_NUMERIC, 432000. },
         { 0x4ebf, U_NT_NUMERIC, 100000000. },
         { 0x5146, U_NT_NUMERIC, 1000000000000. },
+        { -1, U_NT_NONE, U_NO_NUMERIC_VALUE },
         { 0x61, U_NT_NONE, U_NO_NUMERIC_VALUE },
         { 0x3000, U_NT_NONE, U_NO_NUMERIC_VALUE },
         { 0xfffe, U_NT_NONE, U_NO_NUMERIC_VALUE },
         { 0x10301, U_NT_NONE, U_NO_NUMERIC_VALUE },
         { 0xe0033, U_NT_NONE, U_NO_NUMERIC_VALUE },
-        { 0x10ffff, U_NT_NONE, U_NO_NUMERIC_VALUE }
+        { 0x10ffff, U_NT_NONE, U_NO_NUMERIC_VALUE },
+        { 0x110000, U_NT_NONE, U_NO_NUMERIC_VALUE }
     };
 
     double nv;
     UChar32 c;
     int32_t i, type;
 
-    for(i=0; i<LENGTHOF(values); ++i) {
+    for(i=0; i<UPRV_LENGTHOF(values); ++i) {
         c=values[i].c;
         type=u_getIntPropertyValue(c, UCHAR_NUMERIC_TYPE);
         nv=u_getNumericValue(c);
@@ -2396,6 +2940,7 @@ TestPropertyNames(void) {
     UBool atLeastSomething = FALSE;
 
     for (p=0; ; ++p) {
+        UProperty propEnum = (UProperty)p;
         UBool sawProp = FALSE;
         if(p > 10 && !atLeastSomething) {
           log_data_err("Never got anything after 10 tries.\nYour data is probably fried. Quitting this test\n", p, choice);
@@ -2403,9 +2948,10 @@ TestPropertyNames(void) {
         }
 
         for (choice=0; ; ++choice) {
-            const char* name = u_getPropertyName(pchoice);
+            const char* name = u_getPropertyName(propEnum, (UPropertyNameChoice)choice);
             if (name) {
-                if (!sawProp) log_verbose("prop 0x%04x+%2d:", p&~0xfff, p&0xfff);
+                if (!sawProp)
+                    log_verbose("prop 0x%04x+%2d:", p&~0xfff, p&0xfff);
                 log_verbose("%d=\"%s\"", choice, name);
                 sawProp = TRUE;
                 atLeastSomething = TRUE;
@@ -2421,7 +2967,7 @@ TestPropertyNames(void) {
         }
         if (sawProp) {
             /* looks like a valid property; check the values */
-            const char* pname = u_getPropertyName(p, U_LONG_PROPERTY_NAME);
+            const char* pname = u_getPropertyName(propEnum, U_LONG_PROPERTY_NAME);
             int32_t max = 0;
             if (p == UCHAR_CANONICAL_COMBINING_CLASS) {
                 max = 255;
@@ -2437,14 +2983,14 @@ TestPropertyNames(void) {
             for (v=-1; ; ++v) {
                 UBool sawValue = FALSE;
                 for (choice=0; ; ++choice) {
-                    const char* vname = u_getPropertyValueName(p, v, choice);
+                    const char* vname = u_getPropertyValueName(propEnum, v, (UPropertyNameChoice)choice);
                     if (vname) {
                         if (!sawValue) log_verbose(" %s, value %d:", pname, v);
                         log_verbose("%d=\"%s\"", choice, vname);
                         sawValue = TRUE;
 
                         /* test reverse mapping */
-                        rev = u_getPropertyValueEnum(p, vname);
+                        rev = u_getPropertyValueEnum(propEnum, vname);
                         if (rev != v) {
                             log_err("Value round-trip failure (%s): %d -> %s -> %d\n",
                                     pname, v, vname, rev);
@@ -2485,15 +3031,17 @@ TestPropertyValues(void) {
     /* Min should be 0 for everything. */
     /* Until JB#2478 is fixed, the one exception is UCHAR_BLOCK. */
     for (p=UCHAR_INT_START; p<UCHAR_INT_LIMIT; ++p) {
-        min = u_getIntPropertyMinValue(p);
+        UProperty propEnum = (UProperty)p;
+        min = u_getIntPropertyMinValue(propEnum);
         if (min != 0) {
             if (p == UCHAR_BLOCK) {
                 /* This is okay...for now.  See JB#2487.
                    TODO Update this for JB#2487. */
             } else {
                 const char* name;
-                name = u_getPropertyName(p, U_LONG_PROPERTY_NAME);
-                if (name == NULL) name = "<ERROR>";
+                name = u_getPropertyName(propEnum, U_LONG_PROPERTY_NAME);
+                if (name == NULL)
+                    name = "<ERROR>";
                 log_err("FAIL: u_getIntPropertyMinValue(%s) = %d, exp. 0\n",
                         name, min);
             }
@@ -2506,13 +3054,13 @@ TestPropertyValues(void) {
     }
 
     /* Max should be -1 for invalid properties. */
-    max = u_getIntPropertyMaxValue(-1);
+    max = u_getIntPropertyMaxValue(UCHAR_INVALID_CODE);
     if (max != -1) {
         log_err("FAIL: u_getIntPropertyMaxValue(-1) = %d, exp. -1\n",
                 max);
     }
 
-    /* Script should return 0 for an invalid code point. */
+    /* Script should return USCRIPT_INVALID_CODE for an invalid code point. */
     for (i=0; i<2; ++i) {
         int32_t script;
         const char* desc;
@@ -2532,39 +3080,20 @@ TestPropertyValues(void) {
         }
         /* We don't explicitly test ec.  It should be U_FAILURE but it
            isn't documented as such. */
-        if (script != 0) {
+        if (script != (int32_t)USCRIPT_INVALID_CODE) {
             log_err("FAIL: %s = %d, exp. 0\n",
                     desc, script);
         }
     }
 }
 
-/* add characters from a serialized set to a normal one */
-static void
-_setAddSerialized(USet *set, const USerializedSet *sset) {
-    UChar32 start, end;
-    int32_t i, count;
-
-    count=uset_getSerializedRangeCount(sset);
-    for(i=0; i<count; ++i) {
-        uset_getSerializedRange(sset, i, &start, &end);
-        uset_addRange(set, start, end);
-    }
-}
-
 /* various tests for consistency of UCD data and API behavior */
 static void
 TestConsistency() {
-#if !UCONFIG_NO_NORMALIZATION
-    UChar buffer16[300];
-#endif
     char buffer[300];
     USet *set1, *set2, *set3, *set4;
     UErrorCode errorCode;
 
-#if !UCONFIG_NO_NORMALIZATION
-    USerializedSet sset;
-#endif
     UChar32 start, end;
     int32_t i, length;
 
@@ -2574,12 +3103,28 @@ TestConsistency() {
     U_STRING_DECL(formatPattern, "[:Cf:]", 6);
     U_STRING_DECL(alphaPattern, "[:Alphabetic:]", 14);
 
+    U_STRING_DECL(mathBlocksPattern,
+        "[[:block=Mathematical Operators:][:block=Miscellaneous Mathematical Symbols-A:][:block=Miscellaneous Mathematical Symbols-B:][:block=Supplemental Mathematical Operators:][:block=Mathematical Alphanumeric Symbols:]]",
+        214);
+    U_STRING_DECL(mathPattern, "[:Math:]", 8);
+    U_STRING_DECL(unassignedPattern, "[:Cn:]", 6);
+    U_STRING_DECL(unknownPattern, "[:sc=Unknown:]", 14);
+    U_STRING_DECL(reservedPattern, "[[:Cn:][:Co:][:Cs:]]", 20);
+
     U_STRING_INIT(hyphenPattern, "[:Hyphen:]", 10);
     U_STRING_INIT(dashPattern, "[:Dash:]", 8);
     U_STRING_INIT(lowerPattern, "[:Lowercase:]", 13);
     U_STRING_INIT(formatPattern, "[:Cf:]", 6);
     U_STRING_INIT(alphaPattern, "[:Alphabetic:]", 14);
 
+    U_STRING_INIT(mathBlocksPattern,
+        "[[:block=Mathematical Operators:][:block=Miscellaneous Mathematical Symbols-A:][:block=Miscellaneous Mathematical Symbols-B:][:block=Supplemental Mathematical Operators:][:block=Mathematical Alphanumeric Symbols:]]",
+        214);
+    U_STRING_INIT(mathPattern, "[:Math:]", 8);
+    U_STRING_INIT(unassignedPattern, "[:Cn:]", 6);
+    U_STRING_INIT(unknownPattern, "[:sc=Unknown:]", 14);
+    U_STRING_INIT(reservedPattern, "[[:Cn:][:Co:][:Cs:]]", 20);
+
     /*
      * It used to be that UCD.html and its precursors said
      * "Those dashes used to mark connections between pieces of words,
@@ -2587,7 +3132,7 @@ TestConsistency() {
      *
      * Unicode 4 changed 00AD Soft Hyphen to Cf and removed it from Dash
      * but not from Hyphen.
-     * UTC 94 (2003mar) decided to leave it that way and to changed UCD.html.
+     * UTC 94 (2003mar) decided to leave it that way and to change UCD.html.
      * Therefore, do not show errors when testing the Hyphen property.
      */
     log_verbose("Starting with Unicode 4, inconsistencies with [:Hyphen:] are\n"
@@ -2602,7 +3147,7 @@ TestConsistency() {
         uset_remove(set1, 0xff65); /* halfwidth variant */
         showAMinusB(set1, set2, "[:Hyphen:]", "[:Dash:]", FALSE);
     } else {
-        log_err("error opening [:Hyphen:] or [:Dash:] - %s\n", u_errorName(errorCode));
+        log_data_err("error opening [:Hyphen:] or [:Dash:] - %s (Are you missing data?)\n", u_errorName(errorCode));
     }
 
     /* check that Cf is neither Hyphen nor Dash nor Alphabetic */
@@ -2613,7 +3158,7 @@ TestConsistency() {
         showAIntersectB(set3, set2, "[:Cf:]", "[:Dash:]", TRUE);
         showAIntersectB(set3, set4, "[:Cf:]", "[:Alphabetic:]", TRUE);
     } else {
-        log_err("error opening [:Cf:] or [:Alpbabetic:] - %s\n", u_errorName(errorCode));
+        log_data_err("error opening [:Cf:] or [:Alpbabetic:] - %s (Are you missing data?)\n", u_errorName(errorCode));
     }
 
     uset_close(set1);
@@ -2647,9 +3192,8 @@ TestConsistency() {
             while(start<=end) {
                 length=u_charName(start, U_UNICODE_CHAR_NAME, buffer, sizeof(buffer), &errorCode);
                 if(U_FAILURE(errorCode)) {
-                    log_err("error getting the name of U+%04x - %s\n", start, u_errorName(errorCode));
+                    log_data_err("error getting the name of U+%04x - %s\n", start, u_errorName(errorCode));
                     errorCode=U_ZERO_ERROR;
-                    continue;
                 }
                 if( (strstr(buffer, "SMALL")==NULL || strstr(buffer, "CAPITAL")!=NULL) &&
                     strstr(buffer, "SMALL CAPITAL")==NULL
@@ -2660,39 +3204,349 @@ TestConsistency() {
             }
         }
     } else {
-        log_err("error opening [:Lowercase:] - %s\n", u_errorName(errorCode));
+        log_data_err("error opening [:Lowercase:] - %s (Are you missing data?)\n", u_errorName(errorCode));
     }
     uset_close(set1);
 
-#if !UCONFIG_NO_NORMALIZATION
+    /* verify that all assigned characters in Math blocks are exactly Math characters */
+    errorCode=U_ZERO_ERROR;
+    set1=uset_openPattern(mathBlocksPattern, -1, &errorCode);
+    set2=uset_openPattern(mathPattern, 8, &errorCode);
+    set3=uset_openPattern(unassignedPattern, 6, &errorCode);
+    if(U_SUCCESS(errorCode)) {
+        uset_retainAll(set2, set1); /* [math blocks]&[:Math:] */
+        uset_complement(set3);      /* assigned characters */
+        uset_retainAll(set1, set3); /* [math blocks]&[assigned] */
+        compareUSets(set1, set2,
+                     "[assigned Math block chars]", "[math blocks]&[:Math:]",
+                     TRUE);
+    } else {
+        log_data_err("error opening [math blocks] or [:Math:] or [:Cn:] - %s (Are you missing data?)\n", u_errorName(errorCode));
+    }
+    uset_close(set1);
+    uset_close(set2);
+    uset_close(set3);
 
-    /*
-     * Test for an example that unorm_getCanonStartSet() delivers
-     * all characters that compose from the input one,
-     * even in multiple steps.
-     * For example, the set for "I" (0049) should contain both
-     * I-diaeresis (00CF) and I-diaeresis-acute (1E2E).
-     * In general, the set for the middle such character should be a subset
-     * of the set for the first.
-     */
-    set1=uset_open(1, 0);
-    set2=uset_open(1, 0);
+    /* new in Unicode 5.0: exactly all unassigned+PUA+surrogate code points have script=Unknown */
+    errorCode=U_ZERO_ERROR;
+    set1=uset_openPattern(unknownPattern, 14, &errorCode);
+    set2=uset_openPattern(reservedPattern, 20, &errorCode);
+    if(U_SUCCESS(errorCode)) {
+        compareUSets(set1, set2,
+                     "[:sc=Unknown:]", "[[:Cn:][:Co:][:Cs:]]",
+                     TRUE);
+    } else {
+        log_data_err("error opening [:sc=Unknown:] or [[:Cn:][:Co:][:Cs:]] - %s (Are you missing data?)\n", u_errorName(errorCode));
+    }
+    uset_close(set1);
+    uset_close(set2);
+}
 
-    unorm_getCanonStartSet(0x49, &sset);
-    _setAddSerialized(set1, &sset);
+/*
+ * Starting with ICU4C 3.4, the core Unicode properties files
+ * (uprops.icu, ucase.icu, ubidi.icu, unorm.icu)
+ * are hardcoded in the common DLL and therefore not included
+ * in the data package any more.
+ * Test requiring these files are disabled so that
+ * we need not jump through hoops (like adding snapshots of these files
+ * to testdata).
+ * See Jitterbug 4497.
+ */
+#define HARDCODED_DATA_4497 1
+
+/* API coverage for ucase.c */
+static void TestUCase() {
+#if !HARDCODED_DATA_4497
+    UDataMemory *pData;
+    UCaseProps *csp;
+    const UCaseProps *ccsp;
+    UErrorCode errorCode;
 
-    /* enumerate all characters that are plausible to be latin letters */
-    for(start=0xa0; start<0x2000; ++start) {
-        if(unorm_getDecomposition(start, FALSE, buffer16, LENGTHOF(buffer16))>1 && buffer16[0]==0x49) {
-            uset_add(set2, start);
-        }
+    /* coverage for ucase_openBinary() */
+    errorCode=U_ZERO_ERROR;
+    pData=udata_open(NULL, UCASE_DATA_TYPE, UCASE_DATA_NAME, &errorCode);
+    if(U_FAILURE(errorCode)) {
+        log_data_err("unable to open " UCASE_DATA_NAME "." UCASE_DATA_TYPE ": %s\n",
+                    u_errorName(errorCode));
+        return;
     }
 
-    compareUSets(set1, set2,
-                 "[canon start set of 0049]", "[all c with canon decomp with 0049]",
-                 TRUE);
-    uset_close(set1);
-    uset_close(set2);
+    csp=ucase_openBinary((const uint8_t *)pData->pHeader, -1, &errorCode);
+    if(U_FAILURE(errorCode)) {
+        log_err("ucase_openBinary() fails for the contents of " UCASE_DATA_NAME "." UCASE_DATA_TYPE ": %s\n",
+                u_errorName(errorCode));
+        udata_close(pData);
+        return;
+    }
 
+    if(UCASE_LOWER!=ucase_getType(csp, 0xdf)) { /* verify islower(sharp s) */
+        log_err("ucase_openBinary() does not seem to return working UCaseProps\n");
+    }
+
+    ucase_close(csp);
+    udata_close(pData);
+
+    /* coverage for ucase_getDummy() */
+    errorCode=U_ZERO_ERROR;
+    ccsp=ucase_getDummy(&errorCode);
+    if(ucase_tolower(ccsp, 0x41)!=0x41) {
+        log_err("ucase_tolower(dummy, A)!=A\n");
+    }
 #endif
 }
+
+/* API coverage for ubidi_props.c */
+static void TestUBiDiProps() {
+#if !HARDCODED_DATA_4497
+    UDataMemory *pData;
+    UBiDiProps *bdp;
+    const UBiDiProps *cbdp;
+    UErrorCode errorCode;
+
+    /* coverage for ubidi_openBinary() */
+    errorCode=U_ZERO_ERROR;
+    pData=udata_open(NULL, UBIDI_DATA_TYPE, UBIDI_DATA_NAME, &errorCode);
+    if(U_FAILURE(errorCode)) {
+        log_data_err("unable to open " UBIDI_DATA_NAME "." UBIDI_DATA_TYPE ": %s\n",
+                    u_errorName(errorCode));
+        return;
+    }
+
+    bdp=ubidi_openBinary((const uint8_t *)pData->pHeader, -1, &errorCode);
+    if(U_FAILURE(errorCode)) {
+        log_err("ubidi_openBinary() fails for the contents of " UBIDI_DATA_NAME "." UBIDI_DATA_TYPE ": %s\n",
+                u_errorName(errorCode));
+        udata_close(pData);
+        return;
+    }
+
+    if(0x2215!=ubidi_getMirror(bdp, 0x29F5)) { /* verify some data */
+        log_err("ubidi_openBinary() does not seem to return working UBiDiProps\n");
+    }
+
+    ubidi_closeProps(bdp);
+    udata_close(pData);
+
+    /* coverage for ubidi_getDummy() */
+    errorCode=U_ZERO_ERROR;
+    cbdp=ubidi_getDummy(&errorCode);
+    if(ubidi_getClass(cbdp, 0x20)!=0) {
+        log_err("ubidi_getClass(dummy, space)!=0\n");
+    }
+#endif
+}
+
+/* test case folding, compare return values with CaseFolding.txt ------------ */
+
+/* bit set for which case foldings for a character have been tested already */
+enum {
+    CF_SIMPLE=1,
+    CF_FULL=2,
+    CF_TURKIC=4,
+    CF_ALL=7
+};
+
+static void
+testFold(UChar32 c, int which,
+         UChar32 simple, UChar32 turkic,
+         const UChar *full, int32_t fullLength,
+         const UChar *turkicFull, int32_t turkicFullLength) {
+    UChar s[2], t[32];
+    UChar32 c2;
+    int32_t length, length2;
+
+    UErrorCode errorCode=U_ZERO_ERROR;
+
+    length=0;
+    U16_APPEND_UNSAFE(s, length, c);
+
+    if((which&CF_SIMPLE)!=0 && (c2=u_foldCase(c, 0))!=simple) {
+        log_err("u_foldCase(U+%04lx, default)=U+%04lx != U+%04lx\n", (long)c, (long)c2, (long)simple);
+    }
+    if((which&CF_FULL)!=0) {
+        length2=u_strFoldCase(t, UPRV_LENGTHOF(t), s, length, 0, &errorCode);
+        if(length2!=fullLength || 0!=u_memcmp(t, full, fullLength)) {
+            log_err("u_strFoldCase(U+%04lx, default) does not fold properly\n", (long)c);
+        }
+    }
+    if((which&CF_TURKIC)!=0) {
+        if((c2=u_foldCase(c, U_FOLD_CASE_EXCLUDE_SPECIAL_I))!=turkic) {
+            log_err("u_foldCase(U+%04lx, turkic)=U+%04lx != U+%04lx\n", (long)c, (long)c2, (long)simple);
+        }
+
+        length2=u_strFoldCase(t, UPRV_LENGTHOF(t), s, length, U_FOLD_CASE_EXCLUDE_SPECIAL_I, &errorCode);
+        if(length2!=turkicFullLength || 0!=u_memcmp(t, turkicFull, length2)) {
+            log_err("u_strFoldCase(U+%04lx, turkic) does not fold properly\n", (long)c);
+        }
+    }
+}
+
+/* test that c case-folds to itself */
+static void
+testFoldToSelf(UChar32 c, int which) {
+    UChar s[2];
+    int32_t length;
+
+    length=0;
+    U16_APPEND_UNSAFE(s, length, c);
+    testFold(c, which, c, c, s, length, s, length);
+}
+
+struct CaseFoldingData {
+    USet *notSeen;
+    UChar32 prev, prevSimple;
+    UChar prevFull[32];
+    int32_t prevFullLength;
+    int which;
+};
+typedef struct CaseFoldingData CaseFoldingData;
+
+static void U_CALLCONV
+caseFoldingLineFn(void *context,
+                  char *fields[][2], int32_t fieldCount,
+                  UErrorCode *pErrorCode) {
+    CaseFoldingData *pData=(CaseFoldingData *)context;
+    char *end;
+    UChar full[32];
+    UChar32 c, prev, simple;
+    int32_t count;
+    int which;
+    char status;
+
+    /* get code point */
+    const char *s=u_skipWhitespace(fields[0][0]);
+    if(0==strncmp(s, "0000..10FFFF", 12)) {
+        /*
+         * Ignore the line
+         * # @missing: 0000..10FFFF; C; <code point>
+         * because maps-to-self is already our default, and this line breaks this parser.
+         */
+        return;
+    }
+    c=(UChar32)strtoul(s, &end, 16);
+    end=(char *)u_skipWhitespace(end);
+    if(end<=fields[0][0] || end!=fields[0][1]) {
+        log_err("syntax error in CaseFolding.txt field 0 at %s\n", fields[0][0]);
+        *pErrorCode=U_PARSE_ERROR;
+        return;
+    }
+
+    /* get the status of this mapping */
+    status=*u_skipWhitespace(fields[1][0]);
+    if(status!='C' && status!='S' && status!='F' && status!='T') {
+        log_err("unrecognized status field in CaseFolding.txt at %s\n", fields[0][0]);
+        *pErrorCode=U_PARSE_ERROR;
+        return;
+    }
+
+    /* get the mapping */
+    count=u_parseString(fields[2][0], full, 32, (uint32_t *)&simple, pErrorCode);
+    if(U_FAILURE(*pErrorCode)) {
+        log_err("error parsing CaseFolding.txt mapping at %s\n", fields[0][0]);
+        return;
+    }
+
+    /* there is a simple mapping only if there is exactly one code point (count is in UChars) */
+    if(count==0 || count>2 || (count==2 && U16_IS_SINGLE(full[1]))) {
+        simple=c;
+    }
+
+    if(c!=(prev=pData->prev)) {
+        /*
+         * Test remaining mappings for the previous code point.
+         * If a turkic folding was not mentioned, then it should fold the same
+         * as the regular simple case folding.
+         */
+        UChar prevString[2];
+        int32_t length;
+
+        length=0;
+        U16_APPEND_UNSAFE(prevString, length, prev);
+        testFold(prev, (~pData->which)&CF_ALL,
+                 prev, pData->prevSimple,
+                 prevString, length,
+                 pData->prevFull, pData->prevFullLength);
+        pData->prev=pData->prevSimple=c;
+        length=0;
+        U16_APPEND_UNSAFE(pData->prevFull, length, c);
+        pData->prevFullLength=length;
+        pData->which=0;
+    }
+
+    /*
+     * Turn the status into a bit set of case foldings to test.
+     * Remember non-Turkic case foldings as defaults for Turkic mode.
+     */
+    switch(status) {
+    case 'C':
+        which=CF_SIMPLE|CF_FULL;
+        pData->prevSimple=simple;
+        u_memcpy(pData->prevFull, full, count);
+        pData->prevFullLength=count;
+        break;
+    case 'S':
+        which=CF_SIMPLE;
+        pData->prevSimple=simple;
+        break;
+    case 'F':
+        which=CF_FULL;
+        u_memcpy(pData->prevFull, full, count);
+        pData->prevFullLength=count;
+        break;
+    case 'T':
+        which=CF_TURKIC;
+        break;
+    default:
+        which=0;
+        break; /* won't happen because of test above */
+    }
+
+    testFold(c, which, simple, simple, full, count, full, count);
+
+    /* remember which case foldings of c have been tested */
+    pData->which|=which;
+
+    /* remove c from the set of ones not mentioned in CaseFolding.txt */
+    uset_remove(pData->notSeen, c);
+}
+
+static void
+TestCaseFolding() {
+    CaseFoldingData data={ NULL };
+    char *fields[3][2];
+    UErrorCode errorCode;
+
+    static char *lastLine= (char *)"10FFFF; C; 10FFFF;";
+
+    errorCode=U_ZERO_ERROR;
+    /* test BMP & plane 1 - nothing interesting above */
+    data.notSeen=uset_open(0, 0x1ffff);
+    data.prevFullLength=1; /* length of full case folding of U+0000 */
+
+    parseUCDFile("CaseFolding.txt", fields, 3, caseFoldingLineFn, &data, &errorCode);
+    if(U_SUCCESS(errorCode)) {
+        int32_t i, start, end;
+
+        /* add a pseudo-last line to finish testing of the actual last one */
+        fields[0][0]=lastLine;
+        fields[0][1]=lastLine+6;
+        fields[1][0]=lastLine+7;
+        fields[1][1]=lastLine+9;
+        fields[2][0]=lastLine+10;
+        fields[2][1]=lastLine+17;
+        caseFoldingLineFn(&data, fields, 3, &errorCode);
+
+        /* verify that all code points that are not mentioned in CaseFolding.txt fold to themselves */
+        for(i=0;
+            0==uset_getItem(data.notSeen, i, &start, &end, NULL, 0, &errorCode) &&
+                U_SUCCESS(errorCode);
+            ++i
+        ) {
+            do {
+                testFoldToSelf(start, CF_ALL);
+            } while(++start<=end);
+        }
+    }
+
+    uset_close(data.notSeen);
+}