12e5b6d6dSopenharmony_ci// © 2016 and later: Unicode, Inc. and others.
22e5b6d6dSopenharmony_ci// License & terms of use: http://www.unicode.org/copyright.html
32e5b6d6dSopenharmony_ci/********************************************************************
42e5b6d6dSopenharmony_ci * COPYRIGHT:
52e5b6d6dSopenharmony_ci * Copyright (c) 1997-2016, International Business Machines Corporation and
62e5b6d6dSopenharmony_ci * others. All Rights Reserved.
72e5b6d6dSopenharmony_ci ********************************************************************/
82e5b6d6dSopenharmony_ci/*******************************************************************************
92e5b6d6dSopenharmony_ci*
102e5b6d6dSopenharmony_ci* File CUCDTST.C
112e5b6d6dSopenharmony_ci*
122e5b6d6dSopenharmony_ci* Modification History:
132e5b6d6dSopenharmony_ci*        Name                     Description
142e5b6d6dSopenharmony_ci*     Madhu Katragadda            Ported for C API, added tests for string functions
152e5b6d6dSopenharmony_ci********************************************************************************
162e5b6d6dSopenharmony_ci*/
172e5b6d6dSopenharmony_ci
182e5b6d6dSopenharmony_ci#include <math.h>
192e5b6d6dSopenharmony_ci#include <stdbool.h>
202e5b6d6dSopenharmony_ci#include <stdlib.h>
212e5b6d6dSopenharmony_ci#include <string.h>
222e5b6d6dSopenharmony_ci
232e5b6d6dSopenharmony_ci#include "unicode/utypes.h"
242e5b6d6dSopenharmony_ci#include "unicode/uchar.h"
252e5b6d6dSopenharmony_ci#include "unicode/putil.h"
262e5b6d6dSopenharmony_ci#include "unicode/ustring.h"
272e5b6d6dSopenharmony_ci#include "unicode/uloc.h"
282e5b6d6dSopenharmony_ci#include "unicode/unorm2.h"
292e5b6d6dSopenharmony_ci#include "unicode/utf16.h"
302e5b6d6dSopenharmony_ci#include "unicode/utf_old.h"
312e5b6d6dSopenharmony_ci#include "cintltst.h"
322e5b6d6dSopenharmony_ci#include "putilimp.h"
332e5b6d6dSopenharmony_ci#include "uparse.h"
342e5b6d6dSopenharmony_ci#include "ucase.h"
352e5b6d6dSopenharmony_ci#include "ubidi_props.h"
362e5b6d6dSopenharmony_ci#include "uprops.h"
372e5b6d6dSopenharmony_ci#include "uset_imp.h"
382e5b6d6dSopenharmony_ci#include "usc_impl.h"
392e5b6d6dSopenharmony_ci#include "udatamem.h"
402e5b6d6dSopenharmony_ci#include "cucdapi.h"
412e5b6d6dSopenharmony_ci#include "cmemory.h"
422e5b6d6dSopenharmony_ci
432e5b6d6dSopenharmony_ci/* prototypes --------------------------------------------------------------- */
442e5b6d6dSopenharmony_ci
452e5b6d6dSopenharmony_cistatic void TestUpperLower(void);
462e5b6d6dSopenharmony_cistatic void TestLetterNumber(void);
472e5b6d6dSopenharmony_cistatic void TestMisc(void);
482e5b6d6dSopenharmony_cistatic void TestPOSIX(void);
492e5b6d6dSopenharmony_cistatic void TestControlPrint(void);
502e5b6d6dSopenharmony_cistatic void TestIdentifier(void);
512e5b6d6dSopenharmony_cistatic void TestUnicodeData(void);
522e5b6d6dSopenharmony_cistatic void TestCodeUnit(void);
532e5b6d6dSopenharmony_cistatic void TestCodePoint(void);
542e5b6d6dSopenharmony_cistatic void TestCharLength(void);
552e5b6d6dSopenharmony_cistatic void TestCharNames(void);
562e5b6d6dSopenharmony_cistatic void TestUCharFromNameUnderflow(void);
572e5b6d6dSopenharmony_cistatic void TestMirroring(void);
582e5b6d6dSopenharmony_cistatic void TestUScriptRunAPI(void);
592e5b6d6dSopenharmony_cistatic void TestAdditionalProperties(void);
602e5b6d6dSopenharmony_cistatic void TestNumericProperties(void);
612e5b6d6dSopenharmony_cistatic void TestPropertyNames(void);
622e5b6d6dSopenharmony_cistatic void TestPropertyValues(void);
632e5b6d6dSopenharmony_cistatic void TestConsistency(void);
642e5b6d6dSopenharmony_cistatic void TestCaseFolding(void);
652e5b6d6dSopenharmony_cistatic void TestBinaryCharacterPropertiesAPI(void);
662e5b6d6dSopenharmony_cistatic void TestIntCharacterPropertiesAPI(void);
672e5b6d6dSopenharmony_ci
682e5b6d6dSopenharmony_ci/* internal methods used */
692e5b6d6dSopenharmony_cistatic int32_t MakeProp(char* str);
702e5b6d6dSopenharmony_cistatic int32_t MakeDir(char* str);
712e5b6d6dSopenharmony_ci
722e5b6d6dSopenharmony_ci/* helpers ------------------------------------------------------------------ */
732e5b6d6dSopenharmony_ci
742e5b6d6dSopenharmony_cistatic void
752e5b6d6dSopenharmony_ciparseUCDFile(const char *filename,
762e5b6d6dSopenharmony_ci             char *fields[][2], int32_t fieldCount,
772e5b6d6dSopenharmony_ci             UParseLineFn *lineFn, void *context,
782e5b6d6dSopenharmony_ci             UErrorCode *pErrorCode) {
792e5b6d6dSopenharmony_ci    char path[512];
802e5b6d6dSopenharmony_ci    char backupPath[512];
812e5b6d6dSopenharmony_ci
822e5b6d6dSopenharmony_ci    if(U_FAILURE(*pErrorCode)) {
832e5b6d6dSopenharmony_ci        return;
842e5b6d6dSopenharmony_ci    }
852e5b6d6dSopenharmony_ci
862e5b6d6dSopenharmony_ci    /* Look inside ICU_DATA first */
872e5b6d6dSopenharmony_ci    strcpy(path, u_getDataDirectory());
882e5b6d6dSopenharmony_ci    strcat(path, ".." U_FILE_SEP_STRING "unidata" U_FILE_SEP_STRING);
892e5b6d6dSopenharmony_ci    strcat(path, filename);
902e5b6d6dSopenharmony_ci
912e5b6d6dSopenharmony_ci    /* As a fallback, try to guess where the source data was located
922e5b6d6dSopenharmony_ci     *    at the time ICU was built, and look there.
932e5b6d6dSopenharmony_ci     */
942e5b6d6dSopenharmony_ci    strcpy(backupPath, ctest_dataSrcDir());
952e5b6d6dSopenharmony_ci    strcat(backupPath, U_FILE_SEP_STRING);
962e5b6d6dSopenharmony_ci    strcat(backupPath, "unidata" U_FILE_SEP_STRING);
972e5b6d6dSopenharmony_ci    strcat(backupPath, filename);
982e5b6d6dSopenharmony_ci
992e5b6d6dSopenharmony_ci    u_parseDelimitedFile(path, ';', fields, fieldCount, lineFn, context, pErrorCode);
1002e5b6d6dSopenharmony_ci    if(*pErrorCode==U_FILE_ACCESS_ERROR) {
1012e5b6d6dSopenharmony_ci        *pErrorCode=U_ZERO_ERROR;
1022e5b6d6dSopenharmony_ci        u_parseDelimitedFile(backupPath, ';', fields, fieldCount, lineFn, context, pErrorCode);
1032e5b6d6dSopenharmony_ci    }
1042e5b6d6dSopenharmony_ci    if(U_FAILURE(*pErrorCode)) {
1052e5b6d6dSopenharmony_ci        log_err_status(*pErrorCode, "error parsing %s: %s\n", filename, u_errorName(*pErrorCode));
1062e5b6d6dSopenharmony_ci    }
1072e5b6d6dSopenharmony_ci}
1082e5b6d6dSopenharmony_ci
1092e5b6d6dSopenharmony_ci/* test data ---------------------------------------------------------------- */
1102e5b6d6dSopenharmony_ci
1112e5b6d6dSopenharmony_cistatic const char tagStrings[] = "MnMcMeNdNlNoZsZlZpCcCfCsCoCnLuLlLtLmLoPcPdPsPePoSmScSkSoPiPf";
1122e5b6d6dSopenharmony_cistatic const int32_t tagValues[] =
1132e5b6d6dSopenharmony_ci    {
1142e5b6d6dSopenharmony_ci    /* Mn */ U_NON_SPACING_MARK,
1152e5b6d6dSopenharmony_ci    /* Mc */ U_COMBINING_SPACING_MARK,
1162e5b6d6dSopenharmony_ci    /* Me */ U_ENCLOSING_MARK,
1172e5b6d6dSopenharmony_ci    /* Nd */ U_DECIMAL_DIGIT_NUMBER,
1182e5b6d6dSopenharmony_ci    /* Nl */ U_LETTER_NUMBER,
1192e5b6d6dSopenharmony_ci    /* No */ U_OTHER_NUMBER,
1202e5b6d6dSopenharmony_ci    /* Zs */ U_SPACE_SEPARATOR,
1212e5b6d6dSopenharmony_ci    /* Zl */ U_LINE_SEPARATOR,
1222e5b6d6dSopenharmony_ci    /* Zp */ U_PARAGRAPH_SEPARATOR,
1232e5b6d6dSopenharmony_ci    /* Cc */ U_CONTROL_CHAR,
1242e5b6d6dSopenharmony_ci    /* Cf */ U_FORMAT_CHAR,
1252e5b6d6dSopenharmony_ci    /* Cs */ U_SURROGATE,
1262e5b6d6dSopenharmony_ci    /* Co */ U_PRIVATE_USE_CHAR,
1272e5b6d6dSopenharmony_ci    /* Cn */ U_UNASSIGNED,
1282e5b6d6dSopenharmony_ci    /* Lu */ U_UPPERCASE_LETTER,
1292e5b6d6dSopenharmony_ci    /* Ll */ U_LOWERCASE_LETTER,
1302e5b6d6dSopenharmony_ci    /* Lt */ U_TITLECASE_LETTER,
1312e5b6d6dSopenharmony_ci    /* Lm */ U_MODIFIER_LETTER,
1322e5b6d6dSopenharmony_ci    /* Lo */ U_OTHER_LETTER,
1332e5b6d6dSopenharmony_ci    /* Pc */ U_CONNECTOR_PUNCTUATION,
1342e5b6d6dSopenharmony_ci    /* Pd */ U_DASH_PUNCTUATION,
1352e5b6d6dSopenharmony_ci    /* Ps */ U_START_PUNCTUATION,
1362e5b6d6dSopenharmony_ci    /* Pe */ U_END_PUNCTUATION,
1372e5b6d6dSopenharmony_ci    /* Po */ U_OTHER_PUNCTUATION,
1382e5b6d6dSopenharmony_ci    /* Sm */ U_MATH_SYMBOL,
1392e5b6d6dSopenharmony_ci    /* Sc */ U_CURRENCY_SYMBOL,
1402e5b6d6dSopenharmony_ci    /* Sk */ U_MODIFIER_SYMBOL,
1412e5b6d6dSopenharmony_ci    /* So */ U_OTHER_SYMBOL,
1422e5b6d6dSopenharmony_ci    /* Pi */ U_INITIAL_PUNCTUATION,
1432e5b6d6dSopenharmony_ci    /* Pf */ U_FINAL_PUNCTUATION
1442e5b6d6dSopenharmony_ci    };
1452e5b6d6dSopenharmony_ci
1462e5b6d6dSopenharmony_cistatic const char dirStrings[][5] = {
1472e5b6d6dSopenharmony_ci    "L",
1482e5b6d6dSopenharmony_ci    "R",
1492e5b6d6dSopenharmony_ci    "EN",
1502e5b6d6dSopenharmony_ci    "ES",
1512e5b6d6dSopenharmony_ci    "ET",
1522e5b6d6dSopenharmony_ci    "AN",
1532e5b6d6dSopenharmony_ci    "CS",
1542e5b6d6dSopenharmony_ci    "B",
1552e5b6d6dSopenharmony_ci    "S",
1562e5b6d6dSopenharmony_ci    "WS",
1572e5b6d6dSopenharmony_ci    "ON",
1582e5b6d6dSopenharmony_ci    "LRE",
1592e5b6d6dSopenharmony_ci    "LRO",
1602e5b6d6dSopenharmony_ci    "AL",
1612e5b6d6dSopenharmony_ci    "RLE",
1622e5b6d6dSopenharmony_ci    "RLO",
1632e5b6d6dSopenharmony_ci    "PDF",
1642e5b6d6dSopenharmony_ci    "NSM",
1652e5b6d6dSopenharmony_ci    "BN",
1662e5b6d6dSopenharmony_ci    /* new in Unicode 6.3/ICU 52 */
1672e5b6d6dSopenharmony_ci    "FSI",
1682e5b6d6dSopenharmony_ci    "LRI",
1692e5b6d6dSopenharmony_ci    "RLI",
1702e5b6d6dSopenharmony_ci    "PDI"
1712e5b6d6dSopenharmony_ci};
1722e5b6d6dSopenharmony_ci
1732e5b6d6dSopenharmony_civoid addUnicodeTest(TestNode** root);
1742e5b6d6dSopenharmony_ci
1752e5b6d6dSopenharmony_civoid addUnicodeTest(TestNode** root)
1762e5b6d6dSopenharmony_ci{
1772e5b6d6dSopenharmony_ci    addTest(root, &TestCodeUnit, "tsutil/cucdtst/TestCodeUnit");
1782e5b6d6dSopenharmony_ci    addTest(root, &TestCodePoint, "tsutil/cucdtst/TestCodePoint");
1792e5b6d6dSopenharmony_ci    addTest(root, &TestCharLength, "tsutil/cucdtst/TestCharLength");
1802e5b6d6dSopenharmony_ci    addTest(root, &TestBinaryValues, "tsutil/cucdtst/TestBinaryValues");
1812e5b6d6dSopenharmony_ci    addTest(root, &TestUnicodeData, "tsutil/cucdtst/TestUnicodeData");
1822e5b6d6dSopenharmony_ci    addTest(root, &TestAdditionalProperties, "tsutil/cucdtst/TestAdditionalProperties");
1832e5b6d6dSopenharmony_ci    addTest(root, &TestNumericProperties, "tsutil/cucdtst/TestNumericProperties");
1842e5b6d6dSopenharmony_ci    addTest(root, &TestUpperLower, "tsutil/cucdtst/TestUpperLower");
1852e5b6d6dSopenharmony_ci    addTest(root, &TestLetterNumber, "tsutil/cucdtst/TestLetterNumber");
1862e5b6d6dSopenharmony_ci    addTest(root, &TestMisc, "tsutil/cucdtst/TestMisc");
1872e5b6d6dSopenharmony_ci    addTest(root, &TestPOSIX, "tsutil/cucdtst/TestPOSIX");
1882e5b6d6dSopenharmony_ci    addTest(root, &TestControlPrint, "tsutil/cucdtst/TestControlPrint");
1892e5b6d6dSopenharmony_ci    addTest(root, &TestIdentifier, "tsutil/cucdtst/TestIdentifier");
1902e5b6d6dSopenharmony_ci    addTest(root, &TestCharNames, "tsutil/cucdtst/TestCharNames");
1912e5b6d6dSopenharmony_ci    addTest(root, &TestUCharFromNameUnderflow, "tsutil/cucdtst/TestUCharFromNameUnderflow");
1922e5b6d6dSopenharmony_ci    addTest(root, &TestMirroring, "tsutil/cucdtst/TestMirroring");
1932e5b6d6dSopenharmony_ci    addTest(root, &TestUScriptCodeAPI, "tsutil/cucdtst/TestUScriptCodeAPI");
1942e5b6d6dSopenharmony_ci    addTest(root, &TestHasScript, "tsutil/cucdtst/TestHasScript");
1952e5b6d6dSopenharmony_ci    addTest(root, &TestGetScriptExtensions, "tsutil/cucdtst/TestGetScriptExtensions");
1962e5b6d6dSopenharmony_ci    addTest(root, &TestScriptMetadataAPI, "tsutil/cucdtst/TestScriptMetadataAPI");
1972e5b6d6dSopenharmony_ci    addTest(root, &TestUScriptRunAPI, "tsutil/cucdtst/TestUScriptRunAPI");
1982e5b6d6dSopenharmony_ci    addTest(root, &TestPropertyNames, "tsutil/cucdtst/TestPropertyNames");
1992e5b6d6dSopenharmony_ci    addTest(root, &TestPropertyValues, "tsutil/cucdtst/TestPropertyValues");
2002e5b6d6dSopenharmony_ci    addTest(root, &TestConsistency, "tsutil/cucdtst/TestConsistency");
2012e5b6d6dSopenharmony_ci    addTest(root, &TestCaseFolding, "tsutil/cucdtst/TestCaseFolding");
2022e5b6d6dSopenharmony_ci    addTest(root, &TestBinaryCharacterPropertiesAPI,
2032e5b6d6dSopenharmony_ci            "tsutil/cucdtst/TestBinaryCharacterPropertiesAPI");
2042e5b6d6dSopenharmony_ci    addTest(root, &TestIntCharacterPropertiesAPI,
2052e5b6d6dSopenharmony_ci            "tsutil/cucdtst/TestIntCharacterPropertiesAPI");
2062e5b6d6dSopenharmony_ci}
2072e5b6d6dSopenharmony_ci
2082e5b6d6dSopenharmony_ci/*==================================================== */
2092e5b6d6dSopenharmony_ci/* test u_toupper() and u_tolower()                    */
2102e5b6d6dSopenharmony_ci/*==================================================== */
2112e5b6d6dSopenharmony_cistatic void TestUpperLower()
2122e5b6d6dSopenharmony_ci{
2132e5b6d6dSopenharmony_ci    const UChar upper[] = {0x41, 0x42, 0x00b2, 0x01c4, 0x01c6, 0x01c9, 0x01c8, 0x01c9, 0x000c, 0x0000};
2142e5b6d6dSopenharmony_ci    const UChar lower[] = {0x61, 0x62, 0x00b2, 0x01c6, 0x01c6, 0x01c9, 0x01c9, 0x01c9, 0x000c, 0x0000};
2152e5b6d6dSopenharmony_ci    U_STRING_DECL(upperTest, "abcdefg123hij.?:klmno", 21);
2162e5b6d6dSopenharmony_ci    U_STRING_DECL(lowerTest, "ABCDEFG123HIJ.?:KLMNO", 21);
2172e5b6d6dSopenharmony_ci    int32_t i;
2182e5b6d6dSopenharmony_ci
2192e5b6d6dSopenharmony_ci    U_STRING_INIT(upperTest, "abcdefg123hij.?:klmno", 21);
2202e5b6d6dSopenharmony_ci    U_STRING_INIT(lowerTest, "ABCDEFG123HIJ.?:KLMNO", 21);
2212e5b6d6dSopenharmony_ci
2222e5b6d6dSopenharmony_ci/*
2232e5b6d6dSopenharmony_ciChecks LetterLike Symbols which were previously a source of confusion
2242e5b6d6dSopenharmony_ci[Bertrand A. D. 02/04/98]
2252e5b6d6dSopenharmony_ci*/
2262e5b6d6dSopenharmony_ci    for (i=0x2100;i<0x2138;i++)
2272e5b6d6dSopenharmony_ci    {
2282e5b6d6dSopenharmony_ci        /* Unicode 5.0 adds lowercase U+214E (TURNED SMALL F) to U+2132 (TURNED CAPITAL F) */
2292e5b6d6dSopenharmony_ci        if(i!=0x2126 && i!=0x212a && i!=0x212b && i!=0x2132)
2302e5b6d6dSopenharmony_ci        {
2312e5b6d6dSopenharmony_ci            if (i != (int)u_tolower(i)) /* itself */
2322e5b6d6dSopenharmony_ci                log_err("Failed case conversion with itself: U+%04x\n", i);
2332e5b6d6dSopenharmony_ci            if (i != (int)u_toupper(i))
2342e5b6d6dSopenharmony_ci                log_err("Failed case conversion with itself: U+%04x\n", i);
2352e5b6d6dSopenharmony_ci        }
2362e5b6d6dSopenharmony_ci    }
2372e5b6d6dSopenharmony_ci
2382e5b6d6dSopenharmony_ci    for(i=0; i < u_strlen(upper); i++){
2392e5b6d6dSopenharmony_ci        if(u_tolower(upper[i]) != lower[i]){
2402e5b6d6dSopenharmony_ci            log_err("FAILED u_tolower() for %lx Expected %lx Got %lx\n", upper[i], lower[i], u_tolower(upper[i]));
2412e5b6d6dSopenharmony_ci        }
2422e5b6d6dSopenharmony_ci    }
2432e5b6d6dSopenharmony_ci
2442e5b6d6dSopenharmony_ci    log_verbose("testing upper lower\n");
2452e5b6d6dSopenharmony_ci    for (i = 0; i < 21; i++) {
2462e5b6d6dSopenharmony_ci
2472e5b6d6dSopenharmony_ci        if (u_isalpha(upperTest[i]) && !u_islower(upperTest[i]))
2482e5b6d6dSopenharmony_ci        {
2492e5b6d6dSopenharmony_ci            log_err("Failed isLowerCase test at  %c\n", upperTest[i]);
2502e5b6d6dSopenharmony_ci        }
2512e5b6d6dSopenharmony_ci        else if (u_isalpha(lowerTest[i]) && !u_isupper(lowerTest[i]))
2522e5b6d6dSopenharmony_ci         {
2532e5b6d6dSopenharmony_ci            log_err("Failed isUpperCase test at %c\n", lowerTest[i]);
2542e5b6d6dSopenharmony_ci        }
2552e5b6d6dSopenharmony_ci        else if (upperTest[i] != u_tolower(lowerTest[i]))
2562e5b6d6dSopenharmony_ci        {
2572e5b6d6dSopenharmony_ci            log_err("Failed case conversion from %c  To %c :\n", lowerTest[i], upperTest[i]);
2582e5b6d6dSopenharmony_ci        }
2592e5b6d6dSopenharmony_ci        else if (lowerTest[i] != u_toupper(upperTest[i]))
2602e5b6d6dSopenharmony_ci         {
2612e5b6d6dSopenharmony_ci            log_err("Failed case conversion : %c To %c \n", upperTest[i], lowerTest[i]);
2622e5b6d6dSopenharmony_ci        }
2632e5b6d6dSopenharmony_ci        else if (upperTest[i] != u_tolower(upperTest[i]))
2642e5b6d6dSopenharmony_ci        {
2652e5b6d6dSopenharmony_ci            log_err("Failed case conversion with itself: %c\n", upperTest[i]);
2662e5b6d6dSopenharmony_ci        }
2672e5b6d6dSopenharmony_ci        else if (lowerTest[i] != u_toupper(lowerTest[i]))
2682e5b6d6dSopenharmony_ci        {
2692e5b6d6dSopenharmony_ci            log_err("Failed case conversion with itself: %c\n", lowerTest[i]);
2702e5b6d6dSopenharmony_ci        }
2712e5b6d6dSopenharmony_ci    }
2722e5b6d6dSopenharmony_ci    log_verbose("done testing upper lower\n");
2732e5b6d6dSopenharmony_ci
2742e5b6d6dSopenharmony_ci    log_verbose("testing u_istitle\n");
2752e5b6d6dSopenharmony_ci    {
2762e5b6d6dSopenharmony_ci        static const UChar expected[] = {
2772e5b6d6dSopenharmony_ci            0x1F88,
2782e5b6d6dSopenharmony_ci            0x1F89,
2792e5b6d6dSopenharmony_ci            0x1F8A,
2802e5b6d6dSopenharmony_ci            0x1F8B,
2812e5b6d6dSopenharmony_ci            0x1F8C,
2822e5b6d6dSopenharmony_ci            0x1F8D,
2832e5b6d6dSopenharmony_ci            0x1F8E,
2842e5b6d6dSopenharmony_ci            0x1F8F,
2852e5b6d6dSopenharmony_ci            0x1F88,
2862e5b6d6dSopenharmony_ci            0x1F89,
2872e5b6d6dSopenharmony_ci            0x1F8A,
2882e5b6d6dSopenharmony_ci            0x1F8B,
2892e5b6d6dSopenharmony_ci            0x1F8C,
2902e5b6d6dSopenharmony_ci            0x1F8D,
2912e5b6d6dSopenharmony_ci            0x1F8E,
2922e5b6d6dSopenharmony_ci            0x1F8F,
2932e5b6d6dSopenharmony_ci            0x1F98,
2942e5b6d6dSopenharmony_ci            0x1F99,
2952e5b6d6dSopenharmony_ci            0x1F9A,
2962e5b6d6dSopenharmony_ci            0x1F9B,
2972e5b6d6dSopenharmony_ci            0x1F9C,
2982e5b6d6dSopenharmony_ci            0x1F9D,
2992e5b6d6dSopenharmony_ci            0x1F9E,
3002e5b6d6dSopenharmony_ci            0x1F9F,
3012e5b6d6dSopenharmony_ci            0x1F98,
3022e5b6d6dSopenharmony_ci            0x1F99,
3032e5b6d6dSopenharmony_ci            0x1F9A,
3042e5b6d6dSopenharmony_ci            0x1F9B,
3052e5b6d6dSopenharmony_ci            0x1F9C,
3062e5b6d6dSopenharmony_ci            0x1F9D,
3072e5b6d6dSopenharmony_ci            0x1F9E,
3082e5b6d6dSopenharmony_ci            0x1F9F,
3092e5b6d6dSopenharmony_ci            0x1FA8,
3102e5b6d6dSopenharmony_ci            0x1FA9,
3112e5b6d6dSopenharmony_ci            0x1FAA,
3122e5b6d6dSopenharmony_ci            0x1FAB,
3132e5b6d6dSopenharmony_ci            0x1FAC,
3142e5b6d6dSopenharmony_ci            0x1FAD,
3152e5b6d6dSopenharmony_ci            0x1FAE,
3162e5b6d6dSopenharmony_ci            0x1FAF,
3172e5b6d6dSopenharmony_ci            0x1FA8,
3182e5b6d6dSopenharmony_ci            0x1FA9,
3192e5b6d6dSopenharmony_ci            0x1FAA,
3202e5b6d6dSopenharmony_ci            0x1FAB,
3212e5b6d6dSopenharmony_ci            0x1FAC,
3222e5b6d6dSopenharmony_ci            0x1FAD,
3232e5b6d6dSopenharmony_ci            0x1FAE,
3242e5b6d6dSopenharmony_ci            0x1FAF,
3252e5b6d6dSopenharmony_ci            0x1FBC,
3262e5b6d6dSopenharmony_ci            0x1FBC,
3272e5b6d6dSopenharmony_ci            0x1FCC,
3282e5b6d6dSopenharmony_ci            0x1FCC,
3292e5b6d6dSopenharmony_ci            0x1FFC,
3302e5b6d6dSopenharmony_ci            0x1FFC,
3312e5b6d6dSopenharmony_ci        };
3322e5b6d6dSopenharmony_ci        int32_t num = UPRV_LENGTHOF(expected);
3332e5b6d6dSopenharmony_ci        for(i=0; i<num; i++){
3342e5b6d6dSopenharmony_ci            if(!u_istitle(expected[i])){
3352e5b6d6dSopenharmony_ci                log_err("u_istitle failed for 0x%4X. Expected true, got false\n",expected[i]);
3362e5b6d6dSopenharmony_ci            }
3372e5b6d6dSopenharmony_ci        }
3382e5b6d6dSopenharmony_ci
3392e5b6d6dSopenharmony_ci    }
3402e5b6d6dSopenharmony_ci}
3412e5b6d6dSopenharmony_ci
3422e5b6d6dSopenharmony_ci/* compare two sets and verify that their difference or intersection is empty */
3432e5b6d6dSopenharmony_cistatic UBool
3442e5b6d6dSopenharmony_cishowADiffB(const USet *a, const USet *b,
3452e5b6d6dSopenharmony_ci           const char *a_name, const char *b_name,
3462e5b6d6dSopenharmony_ci           UBool expect, UBool diffIsError) {
3472e5b6d6dSopenharmony_ci    USet *aa;
3482e5b6d6dSopenharmony_ci    int32_t i, start, end, length;
3492e5b6d6dSopenharmony_ci    UErrorCode errorCode;
3502e5b6d6dSopenharmony_ci
3512e5b6d6dSopenharmony_ci    /*
3522e5b6d6dSopenharmony_ci     * expect:
3532e5b6d6dSopenharmony_ci     * true  -> a-b should be empty, that is, b should contain all of a
3542e5b6d6dSopenharmony_ci     * false -> a&b should be empty, that is, a should contain none of b (and vice versa)
3552e5b6d6dSopenharmony_ci     */
3562e5b6d6dSopenharmony_ci    if(expect ? uset_containsAll(b, a) : uset_containsNone(a, b)) {
3572e5b6d6dSopenharmony_ci        return true;
3582e5b6d6dSopenharmony_ci    }
3592e5b6d6dSopenharmony_ci
3602e5b6d6dSopenharmony_ci    /* clone a to aa because a is const */
3612e5b6d6dSopenharmony_ci    aa=uset_open(1, 0);
3622e5b6d6dSopenharmony_ci    if(aa==NULL) {
3632e5b6d6dSopenharmony_ci        /* unusual problem - out of memory? */
3642e5b6d6dSopenharmony_ci        return false;
3652e5b6d6dSopenharmony_ci    }
3662e5b6d6dSopenharmony_ci    uset_addAll(aa, a);
3672e5b6d6dSopenharmony_ci
3682e5b6d6dSopenharmony_ci    /* compute the set in question */
3692e5b6d6dSopenharmony_ci    if(expect) {
3702e5b6d6dSopenharmony_ci        /* a-b */
3712e5b6d6dSopenharmony_ci        uset_removeAll(aa, b);
3722e5b6d6dSopenharmony_ci    } else {
3732e5b6d6dSopenharmony_ci        /* a&b */
3742e5b6d6dSopenharmony_ci        uset_retainAll(aa, b);
3752e5b6d6dSopenharmony_ci    }
3762e5b6d6dSopenharmony_ci
3772e5b6d6dSopenharmony_ci    /* aa is not empty because of the initial tests above; show its contents */
3782e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
3792e5b6d6dSopenharmony_ci    i=0;
3802e5b6d6dSopenharmony_ci    for(;;) {
3812e5b6d6dSopenharmony_ci        length=uset_getItem(aa, i, &start, &end, NULL, 0, &errorCode);
3822e5b6d6dSopenharmony_ci        if(errorCode==U_INDEX_OUTOFBOUNDS_ERROR) {
3832e5b6d6dSopenharmony_ci            break; /* done */
3842e5b6d6dSopenharmony_ci        }
3852e5b6d6dSopenharmony_ci        if(U_FAILURE(errorCode)) {
3862e5b6d6dSopenharmony_ci            log_err("error comparing %s with %s at difference item %d: %s\n",
3872e5b6d6dSopenharmony_ci                a_name, b_name, i, u_errorName(errorCode));
3882e5b6d6dSopenharmony_ci            break;
3892e5b6d6dSopenharmony_ci        }
3902e5b6d6dSopenharmony_ci        if(length!=0) {
3912e5b6d6dSopenharmony_ci            break; /* done with code points, got a string or -1 */
3922e5b6d6dSopenharmony_ci        }
3932e5b6d6dSopenharmony_ci
3942e5b6d6dSopenharmony_ci        if(diffIsError) {
3952e5b6d6dSopenharmony_ci            if(expect) {
3962e5b6d6dSopenharmony_ci                log_err("error: %s contains U+%04x..U+%04x but %s does not\n", a_name, start, end, b_name);
3972e5b6d6dSopenharmony_ci            } else {
3982e5b6d6dSopenharmony_ci                log_err("error: %s and %s both contain U+%04x..U+%04x but should not intersect\n", a_name, b_name, start, end);
3992e5b6d6dSopenharmony_ci            }
4002e5b6d6dSopenharmony_ci        } else {
4012e5b6d6dSopenharmony_ci            if(expect) {
4022e5b6d6dSopenharmony_ci                log_verbose("info: %s contains U+%04x..U+%04x but %s does not\n", a_name, start, end, b_name);
4032e5b6d6dSopenharmony_ci            } else {
4042e5b6d6dSopenharmony_ci                log_verbose("info: %s and %s both contain U+%04x..U+%04x but should not intersect\n", a_name, b_name, start, end);
4052e5b6d6dSopenharmony_ci            }
4062e5b6d6dSopenharmony_ci        }
4072e5b6d6dSopenharmony_ci
4082e5b6d6dSopenharmony_ci        ++i;
4092e5b6d6dSopenharmony_ci    }
4102e5b6d6dSopenharmony_ci
4112e5b6d6dSopenharmony_ci    uset_close(aa);
4122e5b6d6dSopenharmony_ci    return false;
4132e5b6d6dSopenharmony_ci}
4142e5b6d6dSopenharmony_ci
4152e5b6d6dSopenharmony_cistatic UBool
4162e5b6d6dSopenharmony_cishowAMinusB(const USet *a, const USet *b,
4172e5b6d6dSopenharmony_ci            const char *a_name, const char *b_name,
4182e5b6d6dSopenharmony_ci            UBool diffIsError) {
4192e5b6d6dSopenharmony_ci    return showADiffB(a, b, a_name, b_name, true, diffIsError);
4202e5b6d6dSopenharmony_ci}
4212e5b6d6dSopenharmony_ci
4222e5b6d6dSopenharmony_cistatic UBool
4232e5b6d6dSopenharmony_cishowAIntersectB(const USet *a, const USet *b,
4242e5b6d6dSopenharmony_ci                const char *a_name, const char *b_name,
4252e5b6d6dSopenharmony_ci                UBool diffIsError) {
4262e5b6d6dSopenharmony_ci    return showADiffB(a, b, a_name, b_name, false, diffIsError);
4272e5b6d6dSopenharmony_ci}
4282e5b6d6dSopenharmony_ci
4292e5b6d6dSopenharmony_cistatic UBool
4302e5b6d6dSopenharmony_cicompareUSets(const USet *a, const USet *b,
4312e5b6d6dSopenharmony_ci             const char *a_name, const char *b_name,
4322e5b6d6dSopenharmony_ci             UBool diffIsError) {
4332e5b6d6dSopenharmony_ci    /*
4342e5b6d6dSopenharmony_ci     * Use an arithmetic & not a logical && so that both branches
4352e5b6d6dSopenharmony_ci     * are always taken and all differences are shown.
4362e5b6d6dSopenharmony_ci     */
4372e5b6d6dSopenharmony_ci    return
4382e5b6d6dSopenharmony_ci        showAMinusB(a, b, a_name, b_name, diffIsError) &
4392e5b6d6dSopenharmony_ci        showAMinusB(b, a, b_name, a_name, diffIsError);
4402e5b6d6dSopenharmony_ci}
4412e5b6d6dSopenharmony_ci
4422e5b6d6dSopenharmony_ci/* test isLetter(u_isapha()) and isDigit(u_isdigit()) */
4432e5b6d6dSopenharmony_cistatic void TestLetterNumber()
4442e5b6d6dSopenharmony_ci{
4452e5b6d6dSopenharmony_ci    UChar i = 0x0000;
4462e5b6d6dSopenharmony_ci
4472e5b6d6dSopenharmony_ci    log_verbose("Testing for isalpha\n");
4482e5b6d6dSopenharmony_ci    for (i = 0x0041; i < 0x005B; i++) {
4492e5b6d6dSopenharmony_ci        if (!u_isalpha(i))
4502e5b6d6dSopenharmony_ci        {
4512e5b6d6dSopenharmony_ci            log_err("Failed isLetter test at  %.4X\n", i);
4522e5b6d6dSopenharmony_ci        }
4532e5b6d6dSopenharmony_ci    }
4542e5b6d6dSopenharmony_ci    for (i = 0x0660; i < 0x066A; i++) {
4552e5b6d6dSopenharmony_ci        if (u_isalpha(i))
4562e5b6d6dSopenharmony_ci        {
4572e5b6d6dSopenharmony_ci            log_err("Failed isLetter test with numbers at %.4X\n", i);
4582e5b6d6dSopenharmony_ci        }
4592e5b6d6dSopenharmony_ci    }
4602e5b6d6dSopenharmony_ci
4612e5b6d6dSopenharmony_ci    log_verbose("Testing for isdigit\n");
4622e5b6d6dSopenharmony_ci    for (i = 0x0660; i < 0x066A; i++) {
4632e5b6d6dSopenharmony_ci        if (!u_isdigit(i))
4642e5b6d6dSopenharmony_ci        {
4652e5b6d6dSopenharmony_ci            log_verbose("Failed isNumber test at %.4X\n", i);
4662e5b6d6dSopenharmony_ci        }
4672e5b6d6dSopenharmony_ci    }
4682e5b6d6dSopenharmony_ci
4692e5b6d6dSopenharmony_ci    log_verbose("Testing for isalnum\n");
4702e5b6d6dSopenharmony_ci    for (i = 0x0041; i < 0x005B; i++) {
4712e5b6d6dSopenharmony_ci        if (!u_isalnum(i))
4722e5b6d6dSopenharmony_ci        {
4732e5b6d6dSopenharmony_ci            log_err("Failed isAlNum test at  %.4X\n", i);
4742e5b6d6dSopenharmony_ci        }
4752e5b6d6dSopenharmony_ci    }
4762e5b6d6dSopenharmony_ci    for (i = 0x0660; i < 0x066A; i++) {
4772e5b6d6dSopenharmony_ci        if (!u_isalnum(i))
4782e5b6d6dSopenharmony_ci        {
4792e5b6d6dSopenharmony_ci            log_err("Failed isAlNum test at  %.4X\n", i);
4802e5b6d6dSopenharmony_ci        }
4812e5b6d6dSopenharmony_ci    }
4822e5b6d6dSopenharmony_ci
4832e5b6d6dSopenharmony_ci    {
4842e5b6d6dSopenharmony_ci        /*
4852e5b6d6dSopenharmony_ci         * The following checks work only starting from Unicode 4.0.
4862e5b6d6dSopenharmony_ci         * Check the version number here.
4872e5b6d6dSopenharmony_ci         */
4882e5b6d6dSopenharmony_ci        static UVersionInfo u401={ 4, 0, 1, 0 };
4892e5b6d6dSopenharmony_ci        UVersionInfo version;
4902e5b6d6dSopenharmony_ci        u_getUnicodeVersion(version);
4912e5b6d6dSopenharmony_ci        if(version[0]<4 || 0==memcmp(version, u401, 4)) {
4922e5b6d6dSopenharmony_ci            return;
4932e5b6d6dSopenharmony_ci        }
4942e5b6d6dSopenharmony_ci    }
4952e5b6d6dSopenharmony_ci
4962e5b6d6dSopenharmony_ci    {
4972e5b6d6dSopenharmony_ci        /*
4982e5b6d6dSopenharmony_ci         * Sanity check:
4992e5b6d6dSopenharmony_ci         * Verify that exactly the digit characters have decimal digit values.
5002e5b6d6dSopenharmony_ci         * This assumption is used in the implementation of u_digit()
5012e5b6d6dSopenharmony_ci         * (which checks nt=de)
5022e5b6d6dSopenharmony_ci         * compared with the parallel java.lang.Character.digit()
5032e5b6d6dSopenharmony_ci         * (which checks Nd).
5042e5b6d6dSopenharmony_ci         *
5052e5b6d6dSopenharmony_ci         * This was not true in Unicode 3.2 and earlier.
5062e5b6d6dSopenharmony_ci         * Unicode 4.0 fixed discrepancies.
5072e5b6d6dSopenharmony_ci         * Unicode 4.0.1 re-introduced problems in this area due to an
5082e5b6d6dSopenharmony_ci         * unintentionally incomplete last-minute change.
5092e5b6d6dSopenharmony_ci         */
5102e5b6d6dSopenharmony_ci        U_STRING_DECL(digitsPattern, "[:Nd:]", 6);
5112e5b6d6dSopenharmony_ci        U_STRING_DECL(decimalValuesPattern, "[:Numeric_Type=Decimal:]", 24);
5122e5b6d6dSopenharmony_ci
5132e5b6d6dSopenharmony_ci        USet *digits, *decimalValues;
5142e5b6d6dSopenharmony_ci        UErrorCode errorCode;
5152e5b6d6dSopenharmony_ci
5162e5b6d6dSopenharmony_ci        U_STRING_INIT(digitsPattern, "[:Nd:]", 6);
5172e5b6d6dSopenharmony_ci        U_STRING_INIT(decimalValuesPattern, "[:Numeric_Type=Decimal:]", 24);
5182e5b6d6dSopenharmony_ci        errorCode=U_ZERO_ERROR;
5192e5b6d6dSopenharmony_ci        digits=uset_openPattern(digitsPattern, 6, &errorCode);
5202e5b6d6dSopenharmony_ci        decimalValues=uset_openPattern(decimalValuesPattern, 24, &errorCode);
5212e5b6d6dSopenharmony_ci
5222e5b6d6dSopenharmony_ci        if(U_SUCCESS(errorCode)) {
5232e5b6d6dSopenharmony_ci            compareUSets(digits, decimalValues, "[:Nd:]", "[:Numeric_Type=Decimal:]", true);
5242e5b6d6dSopenharmony_ci        }
5252e5b6d6dSopenharmony_ci
5262e5b6d6dSopenharmony_ci        uset_close(digits);
5272e5b6d6dSopenharmony_ci        uset_close(decimalValues);
5282e5b6d6dSopenharmony_ci    }
5292e5b6d6dSopenharmony_ci}
5302e5b6d6dSopenharmony_ci
5312e5b6d6dSopenharmony_cistatic void testSampleCharProps(UBool propFn(UChar32), const char *propName,
5322e5b6d6dSopenharmony_ci                                const UChar32 *sampleChars, int32_t sampleCharsLength,
5332e5b6d6dSopenharmony_ci                                UBool expected) {
5342e5b6d6dSopenharmony_ci    int32_t i;
5352e5b6d6dSopenharmony_ci    for (i = 0; i < sampleCharsLength; ++i) {
5362e5b6d6dSopenharmony_ci        UBool result = propFn(sampleChars[i]);
5372e5b6d6dSopenharmony_ci        if (result != expected) {
5382e5b6d6dSopenharmony_ci            log_err("error: character property function %s(U+%04x)=%d is wrong\n",
5392e5b6d6dSopenharmony_ci                    propName, sampleChars[i], result);
5402e5b6d6dSopenharmony_ci        }
5412e5b6d6dSopenharmony_ci    }
5422e5b6d6dSopenharmony_ci}
5432e5b6d6dSopenharmony_ci
5442e5b6d6dSopenharmony_ci/* Tests for isDefined(u_isdefined)(, isBaseForm(u_isbase()), isSpaceChar(u_isspace()), isWhiteSpace(), u_CharDigitValue() */
5452e5b6d6dSopenharmony_cistatic void TestMisc()
5462e5b6d6dSopenharmony_ci{
5472e5b6d6dSopenharmony_ci    static const UChar32 sampleSpaces[] = {0x0020, 0x00a0, 0x2000, 0x2001, 0x2005};
5482e5b6d6dSopenharmony_ci    static const UChar32 sampleNonSpaces[] = {0x61, 0x62, 0x63, 0x64, 0x74};
5492e5b6d6dSopenharmony_ci    static const UChar32 sampleUndefined[] = {0xfff1, 0xfff7, 0xfa6e};
5502e5b6d6dSopenharmony_ci    static const UChar32 sampleDefined[] = {0x523E, 0x4f88, 0xfffd};
5512e5b6d6dSopenharmony_ci    static const UChar32 sampleBase[] = {0x0061, 0x0031, 0x03d2};
5522e5b6d6dSopenharmony_ci    static const UChar32 sampleNonBase[] = {0x002B, 0x0020, 0x203B};
5532e5b6d6dSopenharmony_ci/*    static const UChar sampleChars[] = {0x000a, 0x0045, 0x4e00, 0xDC00, 0xFFE8, 0xFFF0};*/
5542e5b6d6dSopenharmony_ci    static const UChar32 sampleDigits[]= {0x0030, 0x0662, 0x0F23, 0x0ED5};
5552e5b6d6dSopenharmony_ci    static const UChar32 sampleNonDigits[] = {0x0010, 0x0041, 0x0122, 0x68FE};
5562e5b6d6dSopenharmony_ci    static const UChar32 sampleWhiteSpaces[] = {0x2008, 0x2009, 0x200a, 0x001c, 0x000c};
5572e5b6d6dSopenharmony_ci    static const UChar32 sampleNonWhiteSpaces[] = {0x61, 0x62, 0x3c, 0x28, 0x3f, 0x85, 0x2007, 0xffef};
5582e5b6d6dSopenharmony_ci
5592e5b6d6dSopenharmony_ci    static const int32_t sampleDigitValues[] = {0, 2, 3, 5};
5602e5b6d6dSopenharmony_ci
5612e5b6d6dSopenharmony_ci    uint32_t mask;
5622e5b6d6dSopenharmony_ci
5632e5b6d6dSopenharmony_ci    int32_t i;
5642e5b6d6dSopenharmony_ci    char icuVersion[U_MAX_VERSION_STRING_LENGTH];
5652e5b6d6dSopenharmony_ci    UVersionInfo realVersion;
5662e5b6d6dSopenharmony_ci
5672e5b6d6dSopenharmony_ci    memset(icuVersion, 0, U_MAX_VERSION_STRING_LENGTH);
5682e5b6d6dSopenharmony_ci
5692e5b6d6dSopenharmony_ci    testSampleCharProps(u_isspace, "u_isspace", sampleSpaces, UPRV_LENGTHOF(sampleSpaces), true);
5702e5b6d6dSopenharmony_ci    testSampleCharProps(u_isspace, "u_isspace", sampleNonSpaces, UPRV_LENGTHOF(sampleNonSpaces), false);
5712e5b6d6dSopenharmony_ci
5722e5b6d6dSopenharmony_ci    testSampleCharProps(u_isJavaSpaceChar, "u_isJavaSpaceChar",
5732e5b6d6dSopenharmony_ci                        sampleSpaces, UPRV_LENGTHOF(sampleSpaces), true);
5742e5b6d6dSopenharmony_ci    testSampleCharProps(u_isJavaSpaceChar, "u_isJavaSpaceChar",
5752e5b6d6dSopenharmony_ci                        sampleNonSpaces, UPRV_LENGTHOF(sampleNonSpaces), false);
5762e5b6d6dSopenharmony_ci
5772e5b6d6dSopenharmony_ci    testSampleCharProps(u_isWhitespace, "u_isWhitespace",
5782e5b6d6dSopenharmony_ci                        sampleWhiteSpaces, UPRV_LENGTHOF(sampleWhiteSpaces), true);
5792e5b6d6dSopenharmony_ci    testSampleCharProps(u_isWhitespace, "u_isWhitespace",
5802e5b6d6dSopenharmony_ci                        sampleNonWhiteSpaces, UPRV_LENGTHOF(sampleNonWhiteSpaces), false);
5812e5b6d6dSopenharmony_ci
5822e5b6d6dSopenharmony_ci    testSampleCharProps(u_isdefined, "u_isdefined",
5832e5b6d6dSopenharmony_ci                        sampleDefined, UPRV_LENGTHOF(sampleDefined), true);
5842e5b6d6dSopenharmony_ci    testSampleCharProps(u_isdefined, "u_isdefined",
5852e5b6d6dSopenharmony_ci                        sampleUndefined, UPRV_LENGTHOF(sampleUndefined), false);
5862e5b6d6dSopenharmony_ci
5872e5b6d6dSopenharmony_ci    testSampleCharProps(u_isbase, "u_isbase", sampleBase, UPRV_LENGTHOF(sampleBase), true);
5882e5b6d6dSopenharmony_ci    testSampleCharProps(u_isbase, "u_isbase", sampleNonBase, UPRV_LENGTHOF(sampleNonBase), false);
5892e5b6d6dSopenharmony_ci
5902e5b6d6dSopenharmony_ci    testSampleCharProps(u_isdigit, "u_isdigit", sampleDigits, UPRV_LENGTHOF(sampleDigits), true);
5912e5b6d6dSopenharmony_ci    testSampleCharProps(u_isdigit, "u_isdigit", sampleNonDigits, UPRV_LENGTHOF(sampleNonDigits), false);
5922e5b6d6dSopenharmony_ci
5932e5b6d6dSopenharmony_ci    for (i = 0; i < UPRV_LENGTHOF(sampleDigits); i++) {
5942e5b6d6dSopenharmony_ci        if (u_charDigitValue(sampleDigits[i]) != sampleDigitValues[i]) {
5952e5b6d6dSopenharmony_ci            log_err("error: u_charDigitValue(U+04x)=%d != %d\n",
5962e5b6d6dSopenharmony_ci                    sampleDigits[i], u_charDigitValue(sampleDigits[i]), sampleDigitValues[i]);
5972e5b6d6dSopenharmony_ci        }
5982e5b6d6dSopenharmony_ci    }
5992e5b6d6dSopenharmony_ci
6002e5b6d6dSopenharmony_ci    /* Tests the ICU version #*/
6012e5b6d6dSopenharmony_ci    u_getVersion(realVersion);
6022e5b6d6dSopenharmony_ci    u_versionToString(realVersion, icuVersion);
6032e5b6d6dSopenharmony_ci    if (strncmp(icuVersion, U_ICU_VERSION, uprv_min((int32_t)strlen(icuVersion), (int32_t)strlen(U_ICU_VERSION))) != 0)
6042e5b6d6dSopenharmony_ci    {
6052e5b6d6dSopenharmony_ci        log_err("ICU version test failed. Header says=%s, got=%s \n", U_ICU_VERSION, icuVersion);
6062e5b6d6dSopenharmony_ci    }
6072e5b6d6dSopenharmony_ci#if defined(ICU_VERSION)
6082e5b6d6dSopenharmony_ci    /* test only happens where we have configure.in with VERSION - sanity check. */
6092e5b6d6dSopenharmony_ci    if(strcmp(U_ICU_VERSION, ICU_VERSION))
6102e5b6d6dSopenharmony_ci    {
6112e5b6d6dSopenharmony_ci        log_err("ICU version mismatch: Header says %s, build environment says %s.\n",  U_ICU_VERSION, ICU_VERSION);
6122e5b6d6dSopenharmony_ci    }
6132e5b6d6dSopenharmony_ci#endif
6142e5b6d6dSopenharmony_ci
6152e5b6d6dSopenharmony_ci    /* test U_GC_... */
6162e5b6d6dSopenharmony_ci    if(
6172e5b6d6dSopenharmony_ci        U_GET_GC_MASK(0x41)!=U_GC_LU_MASK ||
6182e5b6d6dSopenharmony_ci        U_GET_GC_MASK(0x662)!=U_GC_ND_MASK ||
6192e5b6d6dSopenharmony_ci        U_GET_GC_MASK(0xa0)!=U_GC_ZS_MASK ||
6202e5b6d6dSopenharmony_ci        U_GET_GC_MASK(0x28)!=U_GC_PS_MASK ||
6212e5b6d6dSopenharmony_ci        U_GET_GC_MASK(0x2044)!=U_GC_SM_MASK ||
6222e5b6d6dSopenharmony_ci        U_GET_GC_MASK(0xe0063)!=U_GC_CF_MASK
6232e5b6d6dSopenharmony_ci    ) {
6242e5b6d6dSopenharmony_ci        log_err("error: U_GET_GC_MASK does not work properly\n");
6252e5b6d6dSopenharmony_ci    }
6262e5b6d6dSopenharmony_ci
6272e5b6d6dSopenharmony_ci    mask=0;
6282e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_CN_MASK)|U_GC_CN_MASK;
6292e5b6d6dSopenharmony_ci
6302e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_LU_MASK)|U_GC_LU_MASK;
6312e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_LL_MASK)|U_GC_LL_MASK;
6322e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_LT_MASK)|U_GC_LT_MASK;
6332e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_LM_MASK)|U_GC_LM_MASK;
6342e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_LO_MASK)|U_GC_LO_MASK;
6352e5b6d6dSopenharmony_ci
6362e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_MN_MASK)|U_GC_MN_MASK;
6372e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_ME_MASK)|U_GC_ME_MASK;
6382e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_MC_MASK)|U_GC_MC_MASK;
6392e5b6d6dSopenharmony_ci
6402e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_ND_MASK)|U_GC_ND_MASK;
6412e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_NL_MASK)|U_GC_NL_MASK;
6422e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_NO_MASK)|U_GC_NO_MASK;
6432e5b6d6dSopenharmony_ci
6442e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_ZS_MASK)|U_GC_ZS_MASK;
6452e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_ZL_MASK)|U_GC_ZL_MASK;
6462e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_ZP_MASK)|U_GC_ZP_MASK;
6472e5b6d6dSopenharmony_ci
6482e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_CC_MASK)|U_GC_CC_MASK;
6492e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_CF_MASK)|U_GC_CF_MASK;
6502e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_CO_MASK)|U_GC_CO_MASK;
6512e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_CS_MASK)|U_GC_CS_MASK;
6522e5b6d6dSopenharmony_ci
6532e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_PD_MASK)|U_GC_PD_MASK;
6542e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_PS_MASK)|U_GC_PS_MASK;
6552e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_PE_MASK)|U_GC_PE_MASK;
6562e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_PC_MASK)|U_GC_PC_MASK;
6572e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_PO_MASK)|U_GC_PO_MASK;
6582e5b6d6dSopenharmony_ci
6592e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_SM_MASK)|U_GC_SM_MASK;
6602e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_SC_MASK)|U_GC_SC_MASK;
6612e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_SK_MASK)|U_GC_SK_MASK;
6622e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_SO_MASK)|U_GC_SO_MASK;
6632e5b6d6dSopenharmony_ci
6642e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_PI_MASK)|U_GC_PI_MASK;
6652e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_PF_MASK)|U_GC_PF_MASK;
6662e5b6d6dSopenharmony_ci
6672e5b6d6dSopenharmony_ci    if(mask!=(U_CHAR_CATEGORY_COUNT<32 ? U_MASK(U_CHAR_CATEGORY_COUNT)-1: 0xffffffff)) {
6682e5b6d6dSopenharmony_ci        log_err("error: problems with U_GC_XX_MASK constants\n");
6692e5b6d6dSopenharmony_ci    }
6702e5b6d6dSopenharmony_ci
6712e5b6d6dSopenharmony_ci    mask=0;
6722e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_C_MASK)|U_GC_C_MASK;
6732e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_L_MASK)|U_GC_L_MASK;
6742e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_M_MASK)|U_GC_M_MASK;
6752e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_N_MASK)|U_GC_N_MASK;
6762e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_Z_MASK)|U_GC_Z_MASK;
6772e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_P_MASK)|U_GC_P_MASK;
6782e5b6d6dSopenharmony_ci    mask=(mask&~U_GC_S_MASK)|U_GC_S_MASK;
6792e5b6d6dSopenharmony_ci
6802e5b6d6dSopenharmony_ci    if(mask!=(U_CHAR_CATEGORY_COUNT<32 ? U_MASK(U_CHAR_CATEGORY_COUNT)-1: 0xffffffff)) {
6812e5b6d6dSopenharmony_ci        log_err("error: problems with U_GC_Y_MASK constants\n");
6822e5b6d6dSopenharmony_ci    }
6832e5b6d6dSopenharmony_ci    {
6842e5b6d6dSopenharmony_ci        static const UChar32 digit[10]={ 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039 };
6852e5b6d6dSopenharmony_ci        for(i=0; i<10; i++){
6862e5b6d6dSopenharmony_ci            if(digit[i]!=u_forDigit(i,10)){
6872e5b6d6dSopenharmony_ci                log_err("u_forDigit failed for %i. Expected: 0x%4X Got: 0x%4X\n",i,digit[i],u_forDigit(i,10));
6882e5b6d6dSopenharmony_ci            }
6892e5b6d6dSopenharmony_ci        }
6902e5b6d6dSopenharmony_ci    }
6912e5b6d6dSopenharmony_ci
6922e5b6d6dSopenharmony_ci    /* test u_digit() */
6932e5b6d6dSopenharmony_ci    {
6942e5b6d6dSopenharmony_ci        static const struct {
6952e5b6d6dSopenharmony_ci            UChar32 c;
6962e5b6d6dSopenharmony_ci            int8_t radix, value;
6972e5b6d6dSopenharmony_ci        } data[]={
6982e5b6d6dSopenharmony_ci            /* base 16 */
6992e5b6d6dSopenharmony_ci            { 0x0031, 16, 1 },
7002e5b6d6dSopenharmony_ci            { 0x0038, 16, 8 },
7012e5b6d6dSopenharmony_ci            { 0x0043, 16, 12 },
7022e5b6d6dSopenharmony_ci            { 0x0066, 16, 15 },
7032e5b6d6dSopenharmony_ci            { 0x00e4, 16, -1 },
7042e5b6d6dSopenharmony_ci            { 0x0662, 16, 2 },
7052e5b6d6dSopenharmony_ci            { 0x06f5, 16, 5 },
7062e5b6d6dSopenharmony_ci            { 0xff13, 16, 3 },
7072e5b6d6dSopenharmony_ci            { 0xff41, 16, 10 },
7082e5b6d6dSopenharmony_ci
7092e5b6d6dSopenharmony_ci            /* base 8 */
7102e5b6d6dSopenharmony_ci            { 0x0031, 8, 1 },
7112e5b6d6dSopenharmony_ci            { 0x0038, 8, -1 },
7122e5b6d6dSopenharmony_ci            { 0x0043, 8, -1 },
7132e5b6d6dSopenharmony_ci            { 0x0066, 8, -1 },
7142e5b6d6dSopenharmony_ci            { 0x00e4, 8, -1 },
7152e5b6d6dSopenharmony_ci            { 0x0662, 8, 2 },
7162e5b6d6dSopenharmony_ci            { 0x06f5, 8, 5 },
7172e5b6d6dSopenharmony_ci            { 0xff13, 8, 3 },
7182e5b6d6dSopenharmony_ci            { 0xff41, 8, -1 },
7192e5b6d6dSopenharmony_ci
7202e5b6d6dSopenharmony_ci            /* base 36 */
7212e5b6d6dSopenharmony_ci            { 0x5a, 36, 35 },
7222e5b6d6dSopenharmony_ci            { 0x7a, 36, 35 },
7232e5b6d6dSopenharmony_ci            { 0xff3a, 36, 35 },
7242e5b6d6dSopenharmony_ci            { 0xff5a, 36, 35 },
7252e5b6d6dSopenharmony_ci
7262e5b6d6dSopenharmony_ci            /* wrong radix values */
7272e5b6d6dSopenharmony_ci            { 0x0031, 1, -1 },
7282e5b6d6dSopenharmony_ci            { 0xff3a, 37, -1 }
7292e5b6d6dSopenharmony_ci        };
7302e5b6d6dSopenharmony_ci
7312e5b6d6dSopenharmony_ci        for(i=0; i<UPRV_LENGTHOF(data); ++i) {
7322e5b6d6dSopenharmony_ci            if(u_digit(data[i].c, data[i].radix)!=data[i].value) {
7332e5b6d6dSopenharmony_ci                log_err("u_digit(U+%04x, %d)=%d expected %d\n",
7342e5b6d6dSopenharmony_ci                        data[i].c,
7352e5b6d6dSopenharmony_ci                        data[i].radix,
7362e5b6d6dSopenharmony_ci                        u_digit(data[i].c, data[i].radix),
7372e5b6d6dSopenharmony_ci                        data[i].value);
7382e5b6d6dSopenharmony_ci            }
7392e5b6d6dSopenharmony_ci        }
7402e5b6d6dSopenharmony_ci    }
7412e5b6d6dSopenharmony_ci}
7422e5b6d6dSopenharmony_ci
7432e5b6d6dSopenharmony_ci/* test C/POSIX-style functions --------------------------------------------- */
7442e5b6d6dSopenharmony_ci
7452e5b6d6dSopenharmony_ci/* bit flags */
7462e5b6d6dSopenharmony_ci#define ISAL     1
7472e5b6d6dSopenharmony_ci#define ISLO     2
7482e5b6d6dSopenharmony_ci#define ISUP     4
7492e5b6d6dSopenharmony_ci
7502e5b6d6dSopenharmony_ci#define ISDI     8
7512e5b6d6dSopenharmony_ci#define ISXD  0x10
7522e5b6d6dSopenharmony_ci
7532e5b6d6dSopenharmony_ci#define ISAN  0x20
7542e5b6d6dSopenharmony_ci
7552e5b6d6dSopenharmony_ci#define ISPU  0x40
7562e5b6d6dSopenharmony_ci#define ISGR  0x80
7572e5b6d6dSopenharmony_ci#define ISPR 0x100
7582e5b6d6dSopenharmony_ci
7592e5b6d6dSopenharmony_ci#define ISSP 0x200
7602e5b6d6dSopenharmony_ci#define ISBL 0x400
7612e5b6d6dSopenharmony_ci#define ISCN 0x800
7622e5b6d6dSopenharmony_ci
7632e5b6d6dSopenharmony_ci/* C/POSIX-style functions, in the same order as the bit flags */
7642e5b6d6dSopenharmony_citypedef UBool U_EXPORT2 IsPOSIXClass(UChar32 c);
7652e5b6d6dSopenharmony_ci
7662e5b6d6dSopenharmony_cistatic const struct {
7672e5b6d6dSopenharmony_ci    IsPOSIXClass *fn;
7682e5b6d6dSopenharmony_ci    const char *name;
7692e5b6d6dSopenharmony_ci} posixClasses[]={
7702e5b6d6dSopenharmony_ci    { u_isalpha, "isalpha" },
7712e5b6d6dSopenharmony_ci    { u_islower, "islower" },
7722e5b6d6dSopenharmony_ci    { u_isupper, "isupper" },
7732e5b6d6dSopenharmony_ci    { u_isdigit, "isdigit" },
7742e5b6d6dSopenharmony_ci    { u_isxdigit, "isxdigit" },
7752e5b6d6dSopenharmony_ci    { u_isalnum, "isalnum" },
7762e5b6d6dSopenharmony_ci    { u_ispunct, "ispunct" },
7772e5b6d6dSopenharmony_ci    { u_isgraph, "isgraph" },
7782e5b6d6dSopenharmony_ci    { u_isprint, "isprint" },
7792e5b6d6dSopenharmony_ci    { u_isspace, "isspace" },
7802e5b6d6dSopenharmony_ci    { u_isblank, "isblank" },
7812e5b6d6dSopenharmony_ci    { u_iscntrl, "iscntrl" }
7822e5b6d6dSopenharmony_ci};
7832e5b6d6dSopenharmony_ci
7842e5b6d6dSopenharmony_cistatic const struct {
7852e5b6d6dSopenharmony_ci    UChar32 c;
7862e5b6d6dSopenharmony_ci    uint32_t posixResults;
7872e5b6d6dSopenharmony_ci} posixData[]={
7882e5b6d6dSopenharmony_ci    { 0x0008,                                                        ISCN },    /* backspace */
7892e5b6d6dSopenharmony_ci    { 0x0009,                                              ISSP|ISBL|ISCN },    /* TAB */
7902e5b6d6dSopenharmony_ci    { 0x000a,                                              ISSP|     ISCN },    /* LF */
7912e5b6d6dSopenharmony_ci    { 0x000c,                                              ISSP|     ISCN },    /* FF */
7922e5b6d6dSopenharmony_ci    { 0x000d,                                              ISSP|     ISCN },    /* CR */
7932e5b6d6dSopenharmony_ci    { 0x0020,                                         ISPR|ISSP|ISBL      },    /* space */
7942e5b6d6dSopenharmony_ci    { 0x0021,                               ISPU|ISGR|ISPR                },    /* ! */
7952e5b6d6dSopenharmony_ci    { 0x0033,                ISDI|ISXD|ISAN|     ISGR|ISPR                },    /* 3 */
7962e5b6d6dSopenharmony_ci    { 0x0040,                               ISPU|ISGR|ISPR                },    /* @ */
7972e5b6d6dSopenharmony_ci    { 0x0041, ISAL|     ISUP|     ISXD|ISAN|     ISGR|ISPR                },    /* A */
7982e5b6d6dSopenharmony_ci    { 0x007a, ISAL|ISLO|               ISAN|     ISGR|ISPR                },    /* z */
7992e5b6d6dSopenharmony_ci    { 0x007b,                               ISPU|ISGR|ISPR                },    /* { */
8002e5b6d6dSopenharmony_ci    { 0x0085,                                              ISSP|     ISCN },    /* NEL */
8012e5b6d6dSopenharmony_ci    { 0x00a0,                                         ISPR|ISSP|ISBL      },    /* NBSP */
8022e5b6d6dSopenharmony_ci    { 0x00a4,                                    ISGR|ISPR                },    /* currency sign */
8032e5b6d6dSopenharmony_ci    { 0x00e4, ISAL|ISLO|               ISAN|     ISGR|ISPR                },    /* a-umlaut */
8042e5b6d6dSopenharmony_ci    { 0x0300,                                    ISGR|ISPR                },    /* combining grave */
8052e5b6d6dSopenharmony_ci    { 0x0600,                                                        ISCN },    /* arabic number sign */
8062e5b6d6dSopenharmony_ci    { 0x0627, ISAL|                    ISAN|     ISGR|ISPR                },    /* alef */
8072e5b6d6dSopenharmony_ci    { 0x0663,                ISDI|ISXD|ISAN|     ISGR|ISPR                },    /* arabic 3 */
8082e5b6d6dSopenharmony_ci    { 0x2002,                                         ISPR|ISSP|ISBL      },    /* en space */
8092e5b6d6dSopenharmony_ci    { 0x2007,                                         ISPR|ISSP|ISBL      },    /* figure space */
8102e5b6d6dSopenharmony_ci    { 0x2009,                                         ISPR|ISSP|ISBL      },    /* thin space */
8112e5b6d6dSopenharmony_ci    { 0x200b,                                                        ISCN },    /* ZWSP */
8122e5b6d6dSopenharmony_ci  /*{ 0x200b,                                         ISPR|ISSP           },*/    /* ZWSP */ /* ZWSP became a control char in 4.0.1*/
8132e5b6d6dSopenharmony_ci    { 0x200e,                                                        ISCN },    /* LRM */
8142e5b6d6dSopenharmony_ci    { 0x2028,                                         ISPR|ISSP|     ISCN },    /* LS */
8152e5b6d6dSopenharmony_ci    { 0x2029,                                         ISPR|ISSP|     ISCN },    /* PS */
8162e5b6d6dSopenharmony_ci    { 0x20ac,                                    ISGR|ISPR                },    /* Euro */
8172e5b6d6dSopenharmony_ci    { 0xff15,                ISDI|ISXD|ISAN|     ISGR|ISPR                },    /* fullwidth 5 */
8182e5b6d6dSopenharmony_ci    { 0xff25, ISAL|     ISUP|     ISXD|ISAN|     ISGR|ISPR                },    /* fullwidth E */
8192e5b6d6dSopenharmony_ci    { 0xff35, ISAL|     ISUP|          ISAN|     ISGR|ISPR                },    /* fullwidth U */
8202e5b6d6dSopenharmony_ci    { 0xff45, ISAL|ISLO|          ISXD|ISAN|     ISGR|ISPR                },    /* fullwidth e */
8212e5b6d6dSopenharmony_ci    { 0xff55, ISAL|ISLO|               ISAN|     ISGR|ISPR                }     /* fullwidth u */
8222e5b6d6dSopenharmony_ci};
8232e5b6d6dSopenharmony_ci
8242e5b6d6dSopenharmony_cistatic void
8252e5b6d6dSopenharmony_ciTestPOSIX() {
8262e5b6d6dSopenharmony_ci    uint32_t mask;
8272e5b6d6dSopenharmony_ci    int32_t cl, i;
8282e5b6d6dSopenharmony_ci    UBool expect;
8292e5b6d6dSopenharmony_ci
8302e5b6d6dSopenharmony_ci    mask=1;
8312e5b6d6dSopenharmony_ci    for(cl=0; cl<12; ++cl) {
8322e5b6d6dSopenharmony_ci        for(i=0; i<UPRV_LENGTHOF(posixData); ++i) {
8332e5b6d6dSopenharmony_ci            expect=(UBool)((posixData[i].posixResults&mask)!=0);
8342e5b6d6dSopenharmony_ci            if(posixClasses[cl].fn(posixData[i].c)!=expect) {
8352e5b6d6dSopenharmony_ci                log_err("u_%s(U+%04x)=%s is wrong\n",
8362e5b6d6dSopenharmony_ci                    posixClasses[cl].name, posixData[i].c, expect ? "false" : "true");
8372e5b6d6dSopenharmony_ci            }
8382e5b6d6dSopenharmony_ci        }
8392e5b6d6dSopenharmony_ci        mask<<=1;
8402e5b6d6dSopenharmony_ci    }
8412e5b6d6dSopenharmony_ci}
8422e5b6d6dSopenharmony_ci
8432e5b6d6dSopenharmony_ci/* Tests for isControl(u_iscntrl()) and isPrintable(u_isprint()) */
8442e5b6d6dSopenharmony_cistatic void TestControlPrint()
8452e5b6d6dSopenharmony_ci{
8462e5b6d6dSopenharmony_ci    const UChar32 sampleControl[] = {0x1b, 0x97, 0x82, 0x2028, 0x2029, 0x200c, 0x202b};
8472e5b6d6dSopenharmony_ci    const UChar32 sampleNonControl[] = {0x61, 0x0031, 0x00e2};
8482e5b6d6dSopenharmony_ci    const UChar32 samplePrintable[] = {0x0042, 0x005f, 0x2014};
8492e5b6d6dSopenharmony_ci    const UChar32 sampleNonPrintable[] = {0x200c, 0x009f, 0x001b};
8502e5b6d6dSopenharmony_ci    UChar32 c;
8512e5b6d6dSopenharmony_ci
8522e5b6d6dSopenharmony_ci    testSampleCharProps(u_iscntrl, "u_iscntrl", sampleControl, UPRV_LENGTHOF(sampleControl), true);
8532e5b6d6dSopenharmony_ci    testSampleCharProps(u_iscntrl, "u_iscntrl", sampleNonControl, UPRV_LENGTHOF(sampleNonControl), false);
8542e5b6d6dSopenharmony_ci
8552e5b6d6dSopenharmony_ci    testSampleCharProps(u_isprint, "u_isprint",
8562e5b6d6dSopenharmony_ci                        samplePrintable, UPRV_LENGTHOF(samplePrintable), true);
8572e5b6d6dSopenharmony_ci    testSampleCharProps(u_isprint, "u_isprint",
8582e5b6d6dSopenharmony_ci                        sampleNonPrintable, UPRV_LENGTHOF(sampleNonPrintable), false);
8592e5b6d6dSopenharmony_ci
8602e5b6d6dSopenharmony_ci    /* test all ISO 8 controls */
8612e5b6d6dSopenharmony_ci    for(c=0; c<=0x9f; ++c) {
8622e5b6d6dSopenharmony_ci        if(c==0x20) {
8632e5b6d6dSopenharmony_ci            /* skip ASCII graphic characters and continue with DEL */
8642e5b6d6dSopenharmony_ci            c=0x7f;
8652e5b6d6dSopenharmony_ci        }
8662e5b6d6dSopenharmony_ci        if(!u_iscntrl(c)) {
8672e5b6d6dSopenharmony_ci            log_err("error: u_iscntrl(ISO 8 control U+%04x)=false\n", c);
8682e5b6d6dSopenharmony_ci        }
8692e5b6d6dSopenharmony_ci        if(!u_isISOControl(c)) {
8702e5b6d6dSopenharmony_ci            log_err("error: u_isISOControl(ISO 8 control U+%04x)=false\n", c);
8712e5b6d6dSopenharmony_ci        }
8722e5b6d6dSopenharmony_ci        if(u_isprint(c)) {
8732e5b6d6dSopenharmony_ci            log_err("error: u_isprint(ISO 8 control U+%04x)=true\n", c);
8742e5b6d6dSopenharmony_ci        }
8752e5b6d6dSopenharmony_ci    }
8762e5b6d6dSopenharmony_ci
8772e5b6d6dSopenharmony_ci    /* test all Latin-1 graphic characters */
8782e5b6d6dSopenharmony_ci    for(c=0x20; c<=0xff; ++c) {
8792e5b6d6dSopenharmony_ci        if(c==0x7f) {
8802e5b6d6dSopenharmony_ci            c=0xa0;
8812e5b6d6dSopenharmony_ci        } else if(c==0xad) {
8822e5b6d6dSopenharmony_ci            /* Unicode 4 changes 00AD Soft Hyphen to Cf (and it is in fact not printable) */
8832e5b6d6dSopenharmony_ci            ++c;
8842e5b6d6dSopenharmony_ci        }
8852e5b6d6dSopenharmony_ci        if(!u_isprint(c)) {
8862e5b6d6dSopenharmony_ci            log_err("error: u_isprint(Latin-1 graphic character U+%04x)=false\n", c);
8872e5b6d6dSopenharmony_ci        }
8882e5b6d6dSopenharmony_ci    }
8892e5b6d6dSopenharmony_ci}
8902e5b6d6dSopenharmony_ci
8912e5b6d6dSopenharmony_ci/* u_isJavaIDStart, u_isJavaIDPart, u_isIDStart(), u_isIDPart(), u_isIDIgnorable()*/
8922e5b6d6dSopenharmony_cistatic void TestIdentifier()
8932e5b6d6dSopenharmony_ci{
8942e5b6d6dSopenharmony_ci    const UChar32 sampleJavaIDStart[] = {0x0071, 0x00e4, 0x005f};
8952e5b6d6dSopenharmony_ci    const UChar32 sampleNonJavaIDStart[] = {0x0020, 0x2030, 0x0082};
8962e5b6d6dSopenharmony_ci    const UChar32 sampleJavaIDPart[] = {0x005f, 0x0032, 0x0045};
8972e5b6d6dSopenharmony_ci    const UChar32 sampleNonJavaIDPart[] = {0x2030, 0x2020, 0x0020};
8982e5b6d6dSopenharmony_ci    const UChar32 sampleUnicodeIDStart[] = {0x0250, 0x00e2, 0x0061};
8992e5b6d6dSopenharmony_ci    const UChar32 sampleNonUnicodeIDStart[] = {0x2000, 0x000a, 0x2019};
9002e5b6d6dSopenharmony_ci    const UChar32 sampleUnicodeIDPart[] = {0x005f, 0x0032, 0x0045};
9012e5b6d6dSopenharmony_ci    const UChar32 sampleNonUnicodeIDPart[] = {0x2030, 0x00a3, 0x0020};
9022e5b6d6dSopenharmony_ci    const UChar32 sampleIDIgnore[] = {0x0006, 0x0010, 0x206b, 0x85};
9032e5b6d6dSopenharmony_ci    const UChar32 sampleNonIDIgnore[] = {0x0075, 0x00a3, 0x0061};
9042e5b6d6dSopenharmony_ci
9052e5b6d6dSopenharmony_ci    testSampleCharProps(u_isJavaIDStart, "u_isJavaIDStart",
9062e5b6d6dSopenharmony_ci                        sampleJavaIDStart, UPRV_LENGTHOF(sampleJavaIDStart), true);
9072e5b6d6dSopenharmony_ci    testSampleCharProps(u_isJavaIDStart, "u_isJavaIDStart",
9082e5b6d6dSopenharmony_ci                        sampleNonJavaIDStart, UPRV_LENGTHOF(sampleNonJavaIDStart), false);
9092e5b6d6dSopenharmony_ci
9102e5b6d6dSopenharmony_ci    testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart",
9112e5b6d6dSopenharmony_ci                        sampleJavaIDPart, UPRV_LENGTHOF(sampleJavaIDPart), true);
9122e5b6d6dSopenharmony_ci    testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart",
9132e5b6d6dSopenharmony_ci                        sampleNonJavaIDPart, UPRV_LENGTHOF(sampleNonJavaIDPart), false);
9142e5b6d6dSopenharmony_ci
9152e5b6d6dSopenharmony_ci    /* IDPart should imply IDStart */
9162e5b6d6dSopenharmony_ci    testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart",
9172e5b6d6dSopenharmony_ci                        sampleJavaIDStart, UPRV_LENGTHOF(sampleJavaIDStart), true);
9182e5b6d6dSopenharmony_ci
9192e5b6d6dSopenharmony_ci    testSampleCharProps(u_isIDStart, "u_isIDStart",
9202e5b6d6dSopenharmony_ci                        sampleUnicodeIDStart, UPRV_LENGTHOF(sampleUnicodeIDStart), true);
9212e5b6d6dSopenharmony_ci    testSampleCharProps(u_isIDStart, "u_isIDStart",
9222e5b6d6dSopenharmony_ci                        sampleNonUnicodeIDStart, UPRV_LENGTHOF(sampleNonUnicodeIDStart), false);
9232e5b6d6dSopenharmony_ci
9242e5b6d6dSopenharmony_ci    testSampleCharProps(u_isIDPart, "u_isIDPart",
9252e5b6d6dSopenharmony_ci                        sampleUnicodeIDPart, UPRV_LENGTHOF(sampleUnicodeIDPart), true);
9262e5b6d6dSopenharmony_ci    testSampleCharProps(u_isIDPart, "u_isIDPart",
9272e5b6d6dSopenharmony_ci                        sampleNonUnicodeIDPart, UPRV_LENGTHOF(sampleNonUnicodeIDPart), false);
9282e5b6d6dSopenharmony_ci
9292e5b6d6dSopenharmony_ci    /* IDPart should imply IDStart */
9302e5b6d6dSopenharmony_ci    testSampleCharProps(u_isIDPart, "u_isIDPart",
9312e5b6d6dSopenharmony_ci                        sampleUnicodeIDStart, UPRV_LENGTHOF(sampleUnicodeIDStart), true);
9322e5b6d6dSopenharmony_ci
9332e5b6d6dSopenharmony_ci    testSampleCharProps(u_isIDIgnorable, "u_isIDIgnorable",
9342e5b6d6dSopenharmony_ci                        sampleIDIgnore, UPRV_LENGTHOF(sampleIDIgnore), true);
9352e5b6d6dSopenharmony_ci    testSampleCharProps(u_isIDIgnorable, "u_isIDIgnorable",
9362e5b6d6dSopenharmony_ci                        sampleNonIDIgnore, UPRV_LENGTHOF(sampleNonIDIgnore), false);
9372e5b6d6dSopenharmony_ci}
9382e5b6d6dSopenharmony_ci
9392e5b6d6dSopenharmony_ci/* for each line of UnicodeData.txt, check some of the properties */
9402e5b6d6dSopenharmony_citypedef struct UnicodeDataContext {
9412e5b6d6dSopenharmony_ci#if UCONFIG_NO_NORMALIZATION
9422e5b6d6dSopenharmony_ci    const void *dummy;
9432e5b6d6dSopenharmony_ci#else
9442e5b6d6dSopenharmony_ci    const UNormalizer2 *nfc;
9452e5b6d6dSopenharmony_ci    const UNormalizer2 *nfkc;
9462e5b6d6dSopenharmony_ci#endif
9472e5b6d6dSopenharmony_ci} UnicodeDataContext;
9482e5b6d6dSopenharmony_ci
9492e5b6d6dSopenharmony_ci/*
9502e5b6d6dSopenharmony_ci * ### TODO
9512e5b6d6dSopenharmony_ci * This test fails incorrectly if the First or Last code point of a repetitive area
9522e5b6d6dSopenharmony_ci * is overridden, which is allowed and is encouraged for the PUAs.
9532e5b6d6dSopenharmony_ci * Currently, this means that both area First/Last and override lines are
9542e5b6d6dSopenharmony_ci * tested against the properties from the API,
9552e5b6d6dSopenharmony_ci * and the area boundary will not match and cause an error.
9562e5b6d6dSopenharmony_ci *
9572e5b6d6dSopenharmony_ci * This function should detect area boundaries and skip them for the test of individual
9582e5b6d6dSopenharmony_ci * code points' properties.
9592e5b6d6dSopenharmony_ci * Then it should check that the areas contain all the same properties except where overridden.
9602e5b6d6dSopenharmony_ci * For this, it would have had to set a flag for which code points were listed explicitly.
9612e5b6d6dSopenharmony_ci */
9622e5b6d6dSopenharmony_cistatic void U_CALLCONV
9632e5b6d6dSopenharmony_ciunicodeDataLineFn(void *context,
9642e5b6d6dSopenharmony_ci                  char *fields[][2], int32_t fieldCount,
9652e5b6d6dSopenharmony_ci                  UErrorCode *pErrorCode)
9662e5b6d6dSopenharmony_ci{
9672e5b6d6dSopenharmony_ci    (void)fieldCount; // suppress compiler warnings about unused variable
9682e5b6d6dSopenharmony_ci    char buffer[100];
9692e5b6d6dSopenharmony_ci    const char *d;
9702e5b6d6dSopenharmony_ci    char *end;
9712e5b6d6dSopenharmony_ci    uint32_t value;
9722e5b6d6dSopenharmony_ci    UChar32 c;
9732e5b6d6dSopenharmony_ci    int32_t i;
9742e5b6d6dSopenharmony_ci    int8_t type;
9752e5b6d6dSopenharmony_ci    int32_t dt;
9762e5b6d6dSopenharmony_ci    UChar dm[32], s[32];
9772e5b6d6dSopenharmony_ci    int32_t dmLength, length;
9782e5b6d6dSopenharmony_ci
9792e5b6d6dSopenharmony_ci#if !UCONFIG_NO_NORMALIZATION
9802e5b6d6dSopenharmony_ci    const UNormalizer2 *nfc, *nfkc;
9812e5b6d6dSopenharmony_ci#endif
9822e5b6d6dSopenharmony_ci
9832e5b6d6dSopenharmony_ci    /* get the character code, field 0 */
9842e5b6d6dSopenharmony_ci    c=strtoul(fields[0][0], &end, 16);
9852e5b6d6dSopenharmony_ci    if(end<=fields[0][0] || end!=fields[0][1]) {
9862e5b6d6dSopenharmony_ci        log_err("error: syntax error in field 0 at %s\n", fields[0][0]);
9872e5b6d6dSopenharmony_ci        return;
9882e5b6d6dSopenharmony_ci    }
9892e5b6d6dSopenharmony_ci    if((uint32_t)c>=UCHAR_MAX_VALUE + 1) {
9902e5b6d6dSopenharmony_ci        log_err("error in UnicodeData.txt: code point %lu out of range\n", c);
9912e5b6d6dSopenharmony_ci        return;
9922e5b6d6dSopenharmony_ci    }
9932e5b6d6dSopenharmony_ci
9942e5b6d6dSopenharmony_ci    /* get general category, field 2 */
9952e5b6d6dSopenharmony_ci    *fields[2][1]=0;
9962e5b6d6dSopenharmony_ci    type = (int8_t)tagValues[MakeProp(fields[2][0])];
9972e5b6d6dSopenharmony_ci    if(u_charType(c)!=type) {
9982e5b6d6dSopenharmony_ci        log_err("error: u_charType(U+%04lx)==%u instead of %u\n", c, u_charType(c), type);
9992e5b6d6dSopenharmony_ci    }
10002e5b6d6dSopenharmony_ci    if((uint32_t)u_getIntPropertyValue(c, UCHAR_GENERAL_CATEGORY_MASK)!=U_MASK(type)) {
10012e5b6d6dSopenharmony_ci        log_err("error: (uint32_t)u_getIntPropertyValue(U+%04lx, UCHAR_GENERAL_CATEGORY_MASK)!=U_MASK(u_charType())\n", c);
10022e5b6d6dSopenharmony_ci    }
10032e5b6d6dSopenharmony_ci
10042e5b6d6dSopenharmony_ci    /* get canonical combining class, field 3 */
10052e5b6d6dSopenharmony_ci    value=strtoul(fields[3][0], &end, 10);
10062e5b6d6dSopenharmony_ci    if(end<=fields[3][0] || end!=fields[3][1]) {
10072e5b6d6dSopenharmony_ci        log_err("error: syntax error in field 3 at code 0x%lx\n", c);
10082e5b6d6dSopenharmony_ci        return;
10092e5b6d6dSopenharmony_ci    }
10102e5b6d6dSopenharmony_ci    if(value>255) {
10112e5b6d6dSopenharmony_ci        log_err("error in UnicodeData.txt: combining class %lu out of range\n", value);
10122e5b6d6dSopenharmony_ci        return;
10132e5b6d6dSopenharmony_ci    }
10142e5b6d6dSopenharmony_ci#if !UCONFIG_NO_NORMALIZATION
10152e5b6d6dSopenharmony_ci    if(value!=u_getCombiningClass(c) || value!=(uint32_t)u_getIntPropertyValue(c, UCHAR_CANONICAL_COMBINING_CLASS)) {
10162e5b6d6dSopenharmony_ci        log_err("error: u_getCombiningClass(U+%04lx)==%hu instead of %lu\n", c, u_getCombiningClass(c), value);
10172e5b6d6dSopenharmony_ci    }
10182e5b6d6dSopenharmony_ci    nfkc=((UnicodeDataContext *)context)->nfkc;
10192e5b6d6dSopenharmony_ci    if(value!=unorm2_getCombiningClass(nfkc, c)) {
10202e5b6d6dSopenharmony_ci        log_err("error: unorm2_getCombiningClass(nfkc, U+%04lx)==%hu instead of %lu\n", c, unorm2_getCombiningClass(nfkc, c), value);
10212e5b6d6dSopenharmony_ci    }
10222e5b6d6dSopenharmony_ci#endif
10232e5b6d6dSopenharmony_ci
10242e5b6d6dSopenharmony_ci    /* get BiDi category, field 4 */
10252e5b6d6dSopenharmony_ci    *fields[4][1]=0;
10262e5b6d6dSopenharmony_ci    i=MakeDir(fields[4][0]);
10272e5b6d6dSopenharmony_ci    if(i!=(int32_t)u_charDirection(c) || i!=u_getIntPropertyValue(c, UCHAR_BIDI_CLASS)) {
10282e5b6d6dSopenharmony_ci        log_err("error: u_charDirection(U+%04lx)==%u instead of %u (%s)\n", c, u_charDirection(c), MakeDir(fields[4][0]), fields[4][0]);
10292e5b6d6dSopenharmony_ci    }
10302e5b6d6dSopenharmony_ci
10312e5b6d6dSopenharmony_ci    /* get Decomposition_Type & Decomposition_Mapping, field 5 */
10322e5b6d6dSopenharmony_ci    d=NULL;
10332e5b6d6dSopenharmony_ci    if(fields[5][0]==fields[5][1]) {
10342e5b6d6dSopenharmony_ci        /* no decomposition, except UnicodeData.txt omits Hangul syllable decompositions */
10352e5b6d6dSopenharmony_ci        if(c==0xac00 || c==0xd7a3) {
10362e5b6d6dSopenharmony_ci            dt=U_DT_CANONICAL;
10372e5b6d6dSopenharmony_ci        } else {
10382e5b6d6dSopenharmony_ci            dt=U_DT_NONE;
10392e5b6d6dSopenharmony_ci        }
10402e5b6d6dSopenharmony_ci    } else {
10412e5b6d6dSopenharmony_ci        d=fields[5][0];
10422e5b6d6dSopenharmony_ci        *fields[5][1]=0;
10432e5b6d6dSopenharmony_ci        dt=UCHAR_INVALID_CODE;
10442e5b6d6dSopenharmony_ci        if(*d=='<') {
10452e5b6d6dSopenharmony_ci            end=strchr(++d, '>');
10462e5b6d6dSopenharmony_ci            if(end!=NULL) {
10472e5b6d6dSopenharmony_ci                *end=0;
10482e5b6d6dSopenharmony_ci                dt=u_getPropertyValueEnum(UCHAR_DECOMPOSITION_TYPE, d);
10492e5b6d6dSopenharmony_ci                d=u_skipWhitespace(end+1);
10502e5b6d6dSopenharmony_ci            }
10512e5b6d6dSopenharmony_ci        } else {
10522e5b6d6dSopenharmony_ci            dt=U_DT_CANONICAL;
10532e5b6d6dSopenharmony_ci        }
10542e5b6d6dSopenharmony_ci    }
10552e5b6d6dSopenharmony_ci    if(dt>U_DT_NONE) {
10562e5b6d6dSopenharmony_ci        if(c==0xac00) {
10572e5b6d6dSopenharmony_ci            dm[0]=0x1100;
10582e5b6d6dSopenharmony_ci            dm[1]=0x1161;
10592e5b6d6dSopenharmony_ci            dm[2]=0;
10602e5b6d6dSopenharmony_ci            dmLength=2;
10612e5b6d6dSopenharmony_ci        } else if(c==0xd7a3) {
10622e5b6d6dSopenharmony_ci            dm[0]=0xd788;
10632e5b6d6dSopenharmony_ci            dm[1]=0x11c2;
10642e5b6d6dSopenharmony_ci            dm[2]=0;
10652e5b6d6dSopenharmony_ci            dmLength=2;
10662e5b6d6dSopenharmony_ci        } else {
10672e5b6d6dSopenharmony_ci            dmLength=u_parseString(d, dm, 32, NULL, pErrorCode);
10682e5b6d6dSopenharmony_ci        }
10692e5b6d6dSopenharmony_ci    } else {
10702e5b6d6dSopenharmony_ci        dmLength=-1;
10712e5b6d6dSopenharmony_ci    }
10722e5b6d6dSopenharmony_ci    if(dt<0 || U_FAILURE(*pErrorCode)) {
10732e5b6d6dSopenharmony_ci        log_err("error in UnicodeData.txt: syntax error in U+%04lX decomposition field\n", (long)c);
10742e5b6d6dSopenharmony_ci        return;
10752e5b6d6dSopenharmony_ci    }
10762e5b6d6dSopenharmony_ci#if !UCONFIG_NO_NORMALIZATION
10772e5b6d6dSopenharmony_ci    i=u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE);
10782e5b6d6dSopenharmony_ci    if(i!=dt) {
10792e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyValue(U+%04lx, UCHAR_DECOMPOSITION_TYPE)==%d instead of %d\n", c, i, dt);
10802e5b6d6dSopenharmony_ci    }
10812e5b6d6dSopenharmony_ci    /* Expect Decomposition_Mapping=nfkc.getRawDecomposition(c). */
10822e5b6d6dSopenharmony_ci    length=unorm2_getRawDecomposition(nfkc, c, s, 32, pErrorCode);
10832e5b6d6dSopenharmony_ci    if(U_FAILURE(*pErrorCode) || length!=dmLength || (length>0 && 0!=u_strcmp(s, dm))) {
10842e5b6d6dSopenharmony_ci        log_err("error: unorm2_getRawDecomposition(nfkc, U+%04lx)==%d instead of %d "
10852e5b6d6dSopenharmony_ci                "or the Decomposition_Mapping is different (%s)\n",
10862e5b6d6dSopenharmony_ci                c, length, dmLength, u_errorName(*pErrorCode));
10872e5b6d6dSopenharmony_ci        return;
10882e5b6d6dSopenharmony_ci    }
10892e5b6d6dSopenharmony_ci    /* For canonical decompositions only, expect Decomposition_Mapping=nfc.getRawDecomposition(c). */
10902e5b6d6dSopenharmony_ci    if(dt!=U_DT_CANONICAL) {
10912e5b6d6dSopenharmony_ci        dmLength=-1;
10922e5b6d6dSopenharmony_ci    }
10932e5b6d6dSopenharmony_ci    nfc=((UnicodeDataContext *)context)->nfc;
10942e5b6d6dSopenharmony_ci    length=unorm2_getRawDecomposition(nfc, c, s, 32, pErrorCode);
10952e5b6d6dSopenharmony_ci    if(U_FAILURE(*pErrorCode) || length!=dmLength || (length>0 && 0!=u_strcmp(s, dm))) {
10962e5b6d6dSopenharmony_ci        log_err("error: unorm2_getRawDecomposition(nfc, U+%04lx)==%d instead of %d "
10972e5b6d6dSopenharmony_ci                "or the Decomposition_Mapping is different (%s)\n",
10982e5b6d6dSopenharmony_ci                c, length, dmLength, u_errorName(*pErrorCode));
10992e5b6d6dSopenharmony_ci        return;
11002e5b6d6dSopenharmony_ci    }
11012e5b6d6dSopenharmony_ci    /* recompose */
11022e5b6d6dSopenharmony_ci    if(dt==U_DT_CANONICAL && !u_hasBinaryProperty(c, UCHAR_FULL_COMPOSITION_EXCLUSION)) {
11032e5b6d6dSopenharmony_ci        UChar32 a, b, composite;
11042e5b6d6dSopenharmony_ci        i=0;
11052e5b6d6dSopenharmony_ci        U16_NEXT(dm, i, dmLength, a);
11062e5b6d6dSopenharmony_ci        U16_NEXT(dm, i, dmLength, b);
11072e5b6d6dSopenharmony_ci        /* i==dmLength */
11082e5b6d6dSopenharmony_ci        composite=unorm2_composePair(nfc, a, b);
11092e5b6d6dSopenharmony_ci        if(composite!=c) {
11102e5b6d6dSopenharmony_ci            log_err("error: nfc U+%04lX decomposes to U+%04lX+U+%04lX but does not compose back (instead U+%04lX)\n",
11112e5b6d6dSopenharmony_ci                    (long)c, (long)a, (long)b, (long)composite);
11122e5b6d6dSopenharmony_ci        }
11132e5b6d6dSopenharmony_ci        /*
11142e5b6d6dSopenharmony_ci         * Note: NFKC has fewer round-trip mappings than NFC,
11152e5b6d6dSopenharmony_ci         * so we can't just test unorm2_composePair(nfkc, a, b) here without further data.
11162e5b6d6dSopenharmony_ci         */
11172e5b6d6dSopenharmony_ci    }
11182e5b6d6dSopenharmony_ci#endif
11192e5b6d6dSopenharmony_ci
11202e5b6d6dSopenharmony_ci    /* get ISO Comment, field 11 */
11212e5b6d6dSopenharmony_ci    *fields[11][1]=0;
11222e5b6d6dSopenharmony_ci    i=u_getISOComment(c, buffer, sizeof(buffer), pErrorCode);
11232e5b6d6dSopenharmony_ci    if(U_FAILURE(*pErrorCode) || 0!=strcmp(fields[11][0], buffer)) {
11242e5b6d6dSopenharmony_ci        log_err_status(*pErrorCode, "error: u_getISOComment(U+%04lx) wrong (%s): \"%s\" should be \"%s\"\n",
11252e5b6d6dSopenharmony_ci            c, u_errorName(*pErrorCode),
11262e5b6d6dSopenharmony_ci            U_FAILURE(*pErrorCode) ? buffer : "[error]",
11272e5b6d6dSopenharmony_ci            fields[11][0]);
11282e5b6d6dSopenharmony_ci    }
11292e5b6d6dSopenharmony_ci
11302e5b6d6dSopenharmony_ci    /* get uppercase mapping, field 12 */
11312e5b6d6dSopenharmony_ci    if(fields[12][0]!=fields[12][1]) {
11322e5b6d6dSopenharmony_ci        value=strtoul(fields[12][0], &end, 16);
11332e5b6d6dSopenharmony_ci        if(end!=fields[12][1]) {
11342e5b6d6dSopenharmony_ci            log_err("error: syntax error in field 12 at code 0x%lx\n", c);
11352e5b6d6dSopenharmony_ci            return;
11362e5b6d6dSopenharmony_ci        }
11372e5b6d6dSopenharmony_ci        if((UChar32)value!=u_toupper(c)) {
11382e5b6d6dSopenharmony_ci            log_err("error: u_toupper(U+%04lx)==U+%04lx instead of U+%04lx\n", c, u_toupper(c), value);
11392e5b6d6dSopenharmony_ci        }
11402e5b6d6dSopenharmony_ci    } else {
11412e5b6d6dSopenharmony_ci        /* no case mapping: the API must map the code point to itself */
11422e5b6d6dSopenharmony_ci        if(c!=u_toupper(c)) {
11432e5b6d6dSopenharmony_ci            log_err("error: U+%04lx does not have an uppercase mapping but u_toupper()==U+%04lx\n", c, u_toupper(c));
11442e5b6d6dSopenharmony_ci        }
11452e5b6d6dSopenharmony_ci    }
11462e5b6d6dSopenharmony_ci
11472e5b6d6dSopenharmony_ci    /* get lowercase mapping, field 13 */
11482e5b6d6dSopenharmony_ci    if(fields[13][0]!=fields[13][1]) {
11492e5b6d6dSopenharmony_ci        value=strtoul(fields[13][0], &end, 16);
11502e5b6d6dSopenharmony_ci        if(end!=fields[13][1]) {
11512e5b6d6dSopenharmony_ci            log_err("error: syntax error in field 13 at code 0x%lx\n", c);
11522e5b6d6dSopenharmony_ci            return;
11532e5b6d6dSopenharmony_ci        }
11542e5b6d6dSopenharmony_ci        if((UChar32)value!=u_tolower(c)) {
11552e5b6d6dSopenharmony_ci            log_err("error: u_tolower(U+%04lx)==U+%04lx instead of U+%04lx\n", c, u_tolower(c), value);
11562e5b6d6dSopenharmony_ci        }
11572e5b6d6dSopenharmony_ci    } else {
11582e5b6d6dSopenharmony_ci        /* no case mapping: the API must map the code point to itself */
11592e5b6d6dSopenharmony_ci        if(c!=u_tolower(c)) {
11602e5b6d6dSopenharmony_ci            log_err("error: U+%04lx does not have a lowercase mapping but u_tolower()==U+%04lx\n", c, u_tolower(c));
11612e5b6d6dSopenharmony_ci        }
11622e5b6d6dSopenharmony_ci    }
11632e5b6d6dSopenharmony_ci
11642e5b6d6dSopenharmony_ci    /* get titlecase mapping, field 14 */
11652e5b6d6dSopenharmony_ci    if(fields[14][0]!=fields[14][1]) {
11662e5b6d6dSopenharmony_ci        value=strtoul(fields[14][0], &end, 16);
11672e5b6d6dSopenharmony_ci        if(end!=fields[14][1]) {
11682e5b6d6dSopenharmony_ci            log_err("error: syntax error in field 14 at code 0x%lx\n", c);
11692e5b6d6dSopenharmony_ci            return;
11702e5b6d6dSopenharmony_ci        }
11712e5b6d6dSopenharmony_ci        if((UChar32)value!=u_totitle(c)) {
11722e5b6d6dSopenharmony_ci            log_err("error: u_totitle(U+%04lx)==U+%04lx instead of U+%04lx\n", c, u_totitle(c), value);
11732e5b6d6dSopenharmony_ci        }
11742e5b6d6dSopenharmony_ci    } else {
11752e5b6d6dSopenharmony_ci        /* no case mapping: the API must map the code point to itself */
11762e5b6d6dSopenharmony_ci        if(c!=u_totitle(c)) {
11772e5b6d6dSopenharmony_ci            log_err("error: U+%04lx does not have a titlecase mapping but u_totitle()==U+%04lx\n", c, u_totitle(c));
11782e5b6d6dSopenharmony_ci        }
11792e5b6d6dSopenharmony_ci    }
11802e5b6d6dSopenharmony_ci}
11812e5b6d6dSopenharmony_ci
11822e5b6d6dSopenharmony_cistatic UBool U_CALLCONV
11832e5b6d6dSopenharmony_cienumTypeRange(const void *context, UChar32 start, UChar32 limit, UCharCategory type) {
11842e5b6d6dSopenharmony_ci    static const UChar32 test[][2]={
11852e5b6d6dSopenharmony_ci        {0x41, U_UPPERCASE_LETTER},
11862e5b6d6dSopenharmony_ci        {0x308, U_NON_SPACING_MARK},
11872e5b6d6dSopenharmony_ci        {0xfffe, U_GENERAL_OTHER_TYPES},
11882e5b6d6dSopenharmony_ci        {0xe0041, U_FORMAT_CHAR},
11892e5b6d6dSopenharmony_ci        {0xeffff, U_UNASSIGNED}
11902e5b6d6dSopenharmony_ci    };
11912e5b6d6dSopenharmony_ci
11922e5b6d6dSopenharmony_ci    int32_t i, count;
11932e5b6d6dSopenharmony_ci
11942e5b6d6dSopenharmony_ci    if(0!=strcmp((const char *)context, "a1")) {
11952e5b6d6dSopenharmony_ci        log_err("error: u_enumCharTypes() passes on an incorrect context pointer\n");
11962e5b6d6dSopenharmony_ci        return false;
11972e5b6d6dSopenharmony_ci    }
11982e5b6d6dSopenharmony_ci
11992e5b6d6dSopenharmony_ci    count=UPRV_LENGTHOF(test);
12002e5b6d6dSopenharmony_ci    for(i=0; i<count; ++i) {
12012e5b6d6dSopenharmony_ci        if(start<=test[i][0] && test[i][0]<limit) {
12022e5b6d6dSopenharmony_ci            if(type!=(UCharCategory)test[i][1]) {
12032e5b6d6dSopenharmony_ci                log_err("error: u_enumCharTypes() has range [U+%04lx, U+%04lx[ with %ld instead of U+%04lx with %ld\n",
12042e5b6d6dSopenharmony_ci                        start, limit, (long)type, test[i][0], test[i][1]);
12052e5b6d6dSopenharmony_ci            }
12062e5b6d6dSopenharmony_ci            /* stop at the range that includes the last test code point (increases code coverage for enumeration) */
12072e5b6d6dSopenharmony_ci            return i==(count-1) ? false : true;
12082e5b6d6dSopenharmony_ci        }
12092e5b6d6dSopenharmony_ci    }
12102e5b6d6dSopenharmony_ci
12112e5b6d6dSopenharmony_ci    if(start>test[count-1][0]) {
12122e5b6d6dSopenharmony_ci        log_err("error: u_enumCharTypes() has range [U+%04lx, U+%04lx[ with %ld after it should have stopped\n",
12132e5b6d6dSopenharmony_ci                start, limit, (long)type);
12142e5b6d6dSopenharmony_ci        return false;
12152e5b6d6dSopenharmony_ci    }
12162e5b6d6dSopenharmony_ci
12172e5b6d6dSopenharmony_ci    return true;
12182e5b6d6dSopenharmony_ci}
12192e5b6d6dSopenharmony_ci
12202e5b6d6dSopenharmony_cistatic UBool U_CALLCONV
12212e5b6d6dSopenharmony_cienumDefaultsRange(const void *context, UChar32 start, UChar32 limit, UCharCategory type) {
12222e5b6d6dSopenharmony_ci    (void)context; // suppress compiler warnings about unused variable
12232e5b6d6dSopenharmony_ci
12242e5b6d6dSopenharmony_ci    /* default Bidi classes for unassigned code points, from the DerivedBidiClass.txt header */
12252e5b6d6dSopenharmony_ci    static const int32_t defaultBidi[][2]={ /* { limit, class } */
12262e5b6d6dSopenharmony_ci        { 0x0590, U_LEFT_TO_RIGHT },
12272e5b6d6dSopenharmony_ci        { 0x0600, U_RIGHT_TO_LEFT },
12282e5b6d6dSopenharmony_ci        { 0x07C0, U_RIGHT_TO_LEFT_ARABIC },
12292e5b6d6dSopenharmony_ci        { 0x0860, U_RIGHT_TO_LEFT },
12302e5b6d6dSopenharmony_ci        { 0x0870, U_RIGHT_TO_LEFT_ARABIC },  // Unicode 10 changes U+0860..U+086F from R to AL.
12312e5b6d6dSopenharmony_ci        { 0x08A0, U_RIGHT_TO_LEFT_ARABIC },  // Unicode 14 changes U+0870..U+089F from R to AL.
12322e5b6d6dSopenharmony_ci        { 0x0900, U_RIGHT_TO_LEFT_ARABIC },  /* Unicode 6.1 changes U+08A0..U+08FF from R to AL */
12332e5b6d6dSopenharmony_ci        { 0x20A0, U_LEFT_TO_RIGHT },
12342e5b6d6dSopenharmony_ci        { 0x20D0, U_EUROPEAN_NUMBER_TERMINATOR },  /* Unicode 6.3 changes the currency symbols block U+20A0..U+20CF to default to ET not L */
12352e5b6d6dSopenharmony_ci        { 0xFB1D, U_LEFT_TO_RIGHT },
12362e5b6d6dSopenharmony_ci        { 0xFB50, U_RIGHT_TO_LEFT },
12372e5b6d6dSopenharmony_ci        { 0xFE00, U_RIGHT_TO_LEFT_ARABIC },
12382e5b6d6dSopenharmony_ci        { 0xFE70, U_LEFT_TO_RIGHT },
12392e5b6d6dSopenharmony_ci        { 0xFF00, U_RIGHT_TO_LEFT_ARABIC },
12402e5b6d6dSopenharmony_ci
12412e5b6d6dSopenharmony_ci        { 0x10800, U_LEFT_TO_RIGHT },
12422e5b6d6dSopenharmony_ci        { 0x10D00, U_RIGHT_TO_LEFT },  // Unicode 11 changes U+10D00..U+10D3F from R to AL.
12432e5b6d6dSopenharmony_ci        { 0x10D40, U_RIGHT_TO_LEFT_ARABIC },
12442e5b6d6dSopenharmony_ci        { 0x10EC0, U_RIGHT_TO_LEFT },  // Unicode 15 changes U+10EC0..U+10EFF from R to AL.
12452e5b6d6dSopenharmony_ci        { 0x10F00, U_RIGHT_TO_LEFT_ARABIC },
12462e5b6d6dSopenharmony_ci        { 0x10F30, U_RIGHT_TO_LEFT },  // Unicode 11 changes U+10F30..U+10F6F from R to AL.
12472e5b6d6dSopenharmony_ci        { 0x10F70, U_RIGHT_TO_LEFT_ARABIC },
12482e5b6d6dSopenharmony_ci        { 0x11000, U_RIGHT_TO_LEFT },
12492e5b6d6dSopenharmony_ci
12502e5b6d6dSopenharmony_ci        { 0x1E800, U_LEFT_TO_RIGHT },  /* new default-R range in Unicode 5.2: U+1E800 - U+1EFFF */
12512e5b6d6dSopenharmony_ci        { 0x1EC70, U_RIGHT_TO_LEFT },  // Unicode 11 changes U+1EC70..U+1ECBF from R to AL.
12522e5b6d6dSopenharmony_ci        { 0x1ECC0, U_RIGHT_TO_LEFT_ARABIC },
12532e5b6d6dSopenharmony_ci        { 0x1ED00, U_RIGHT_TO_LEFT },  // Unicode 12 changes U+1ED00..U+1ED4F from R to AL.
12542e5b6d6dSopenharmony_ci        { 0x1ED50, U_RIGHT_TO_LEFT_ARABIC },
12552e5b6d6dSopenharmony_ci        { 0x1EE00, U_RIGHT_TO_LEFT },
12562e5b6d6dSopenharmony_ci        { 0x1EF00, U_RIGHT_TO_LEFT_ARABIC },  /* Unicode 6.1 changes U+1EE00..U+1EEFF from R to AL */
12572e5b6d6dSopenharmony_ci        { 0x1F000, U_RIGHT_TO_LEFT },
12582e5b6d6dSopenharmony_ci        { 0x110000, U_LEFT_TO_RIGHT }
12592e5b6d6dSopenharmony_ci    };
12602e5b6d6dSopenharmony_ci
12612e5b6d6dSopenharmony_ci    UChar32 c;
12622e5b6d6dSopenharmony_ci    int32_t i;
12632e5b6d6dSopenharmony_ci    UCharDirection shouldBeDir;
12642e5b6d6dSopenharmony_ci
12652e5b6d6dSopenharmony_ci    /*
12662e5b6d6dSopenharmony_ci     * LineBreak.txt specifies:
12672e5b6d6dSopenharmony_ci     *   #  - Assigned characters that are not listed explicitly are given the value
12682e5b6d6dSopenharmony_ci     *   #    "AL".
12692e5b6d6dSopenharmony_ci     *   #  - Unassigned characters are given the value "XX".
12702e5b6d6dSopenharmony_ci     *
12712e5b6d6dSopenharmony_ci     * PUA characters are listed explicitly with "XX".
12722e5b6d6dSopenharmony_ci     * Verify that no assigned character has "XX".
12732e5b6d6dSopenharmony_ci     */
12742e5b6d6dSopenharmony_ci    if(type!=U_UNASSIGNED && type!=U_PRIVATE_USE_CHAR) {
12752e5b6d6dSopenharmony_ci        c=start;
12762e5b6d6dSopenharmony_ci        while(c<limit) {
12772e5b6d6dSopenharmony_ci            if(0==u_getIntPropertyValue(c, UCHAR_LINE_BREAK)) {
12782e5b6d6dSopenharmony_ci                log_err("error UCHAR_LINE_BREAK(assigned U+%04lx)=XX\n", c);
12792e5b6d6dSopenharmony_ci            }
12802e5b6d6dSopenharmony_ci            ++c;
12812e5b6d6dSopenharmony_ci        }
12822e5b6d6dSopenharmony_ci    }
12832e5b6d6dSopenharmony_ci
12842e5b6d6dSopenharmony_ci    /*
12852e5b6d6dSopenharmony_ci     * Verify default Bidi classes.
12862e5b6d6dSopenharmony_ci     * See DerivedBidiClass.txt, especially for unassigned code points.
12872e5b6d6dSopenharmony_ci     */
12882e5b6d6dSopenharmony_ci    if(type==U_UNASSIGNED || type==U_PRIVATE_USE_CHAR) {
12892e5b6d6dSopenharmony_ci        /* enumerate the intersections of defaultBidi ranges with [start..limit[ */
12902e5b6d6dSopenharmony_ci        c=start;
12912e5b6d6dSopenharmony_ci        for(i=0; i<UPRV_LENGTHOF(defaultBidi) && c<limit; ++i) {
12922e5b6d6dSopenharmony_ci            if((int32_t)c<defaultBidi[i][0]) {
12932e5b6d6dSopenharmony_ci                while(c<limit && (int32_t)c<defaultBidi[i][0]) {
12942e5b6d6dSopenharmony_ci                    if(U_IS_UNICODE_NONCHAR(c) || u_hasBinaryProperty(c, UCHAR_DEFAULT_IGNORABLE_CODE_POINT)) {
12952e5b6d6dSopenharmony_ci                        shouldBeDir=U_BOUNDARY_NEUTRAL;
12962e5b6d6dSopenharmony_ci                    } else {
12972e5b6d6dSopenharmony_ci                        shouldBeDir=(UCharDirection)defaultBidi[i][1];
12982e5b6d6dSopenharmony_ci                    }
12992e5b6d6dSopenharmony_ci
13002e5b6d6dSopenharmony_ci                    if( u_charDirection(c)!=shouldBeDir ||
13012e5b6d6dSopenharmony_ci                        (UCharDirection)u_getIntPropertyValue(c, UCHAR_BIDI_CLASS)!=shouldBeDir
13022e5b6d6dSopenharmony_ci                    ) {
13032e5b6d6dSopenharmony_ci                        log_err("error: u_charDirection(unassigned/PUA U+%04lx)=%s should be %s\n",
13042e5b6d6dSopenharmony_ci                            c, dirStrings[u_charDirection(c)], dirStrings[shouldBeDir]);
13052e5b6d6dSopenharmony_ci                    }
13062e5b6d6dSopenharmony_ci                    ++c;
13072e5b6d6dSopenharmony_ci                }
13082e5b6d6dSopenharmony_ci            }
13092e5b6d6dSopenharmony_ci        }
13102e5b6d6dSopenharmony_ci    }
13112e5b6d6dSopenharmony_ci
13122e5b6d6dSopenharmony_ci    return true;
13132e5b6d6dSopenharmony_ci}
13142e5b6d6dSopenharmony_ci
13152e5b6d6dSopenharmony_ci/* tests for several properties */
13162e5b6d6dSopenharmony_cistatic void TestUnicodeData()
13172e5b6d6dSopenharmony_ci{
13182e5b6d6dSopenharmony_ci    UVersionInfo expectVersionArray;
13192e5b6d6dSopenharmony_ci    UVersionInfo versionArray;
13202e5b6d6dSopenharmony_ci    char *fields[15][2];
13212e5b6d6dSopenharmony_ci    UErrorCode errorCode;
13222e5b6d6dSopenharmony_ci    UChar32 c;
13232e5b6d6dSopenharmony_ci    int8_t type;
13242e5b6d6dSopenharmony_ci
13252e5b6d6dSopenharmony_ci    UnicodeDataContext context;
13262e5b6d6dSopenharmony_ci
13272e5b6d6dSopenharmony_ci    u_versionFromString(expectVersionArray, U_UNICODE_VERSION);
13282e5b6d6dSopenharmony_ci    u_getUnicodeVersion(versionArray);
13292e5b6d6dSopenharmony_ci    if(memcmp(versionArray, expectVersionArray, U_MAX_VERSION_LENGTH) != 0)
13302e5b6d6dSopenharmony_ci    {
13312e5b6d6dSopenharmony_ci        log_err("Testing u_getUnicodeVersion() - expected " U_UNICODE_VERSION " got %d.%d.%d.%d\n",
13322e5b6d6dSopenharmony_ci        versionArray[0], versionArray[1], versionArray[2], versionArray[3]);
13332e5b6d6dSopenharmony_ci    }
13342e5b6d6dSopenharmony_ci
13352e5b6d6dSopenharmony_ci#if defined(ICU_UNICODE_VERSION)
13362e5b6d6dSopenharmony_ci    /* test only happens where we have configure.in with UNICODE_VERSION - sanity check. */
13372e5b6d6dSopenharmony_ci    if(strcmp(U_UNICODE_VERSION, ICU_UNICODE_VERSION))
13382e5b6d6dSopenharmony_ci    {
13392e5b6d6dSopenharmony_ci         log_err("Testing configure.in's ICU_UNICODE_VERSION - expected " U_UNICODE_VERSION " got " ICU_UNICODE_VERSION "\n");
13402e5b6d6dSopenharmony_ci    }
13412e5b6d6dSopenharmony_ci#endif
13422e5b6d6dSopenharmony_ci
13432e5b6d6dSopenharmony_ci    if (ublock_getCode((UChar)0x0041) != UBLOCK_BASIC_LATIN || u_getIntPropertyValue(0x41, UCHAR_BLOCK)!=(int32_t)UBLOCK_BASIC_LATIN) {
13442e5b6d6dSopenharmony_ci        log_err("ublock_getCode(U+0041) property failed! Expected : %i Got: %i \n", UBLOCK_BASIC_LATIN,ublock_getCode((UChar)0x0041));
13452e5b6d6dSopenharmony_ci    }
13462e5b6d6dSopenharmony_ci
13472e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
13482e5b6d6dSopenharmony_ci#if !UCONFIG_NO_NORMALIZATION
13492e5b6d6dSopenharmony_ci    context.nfc=unorm2_getNFCInstance(&errorCode);
13502e5b6d6dSopenharmony_ci    context.nfkc=unorm2_getNFKCInstance(&errorCode);
13512e5b6d6dSopenharmony_ci    if(U_FAILURE(errorCode)) {
13522e5b6d6dSopenharmony_ci        log_data_err("error: unable to open an NFC or NFKC UNormalizer2 - %s\n", u_errorName(errorCode));
13532e5b6d6dSopenharmony_ci        return;
13542e5b6d6dSopenharmony_ci    }
13552e5b6d6dSopenharmony_ci#endif
13562e5b6d6dSopenharmony_ci    parseUCDFile("UnicodeData.txt", fields, 15, unicodeDataLineFn, &context, &errorCode);
13572e5b6d6dSopenharmony_ci    if(U_FAILURE(errorCode)) {
13582e5b6d6dSopenharmony_ci        return; /* if we couldn't parse UnicodeData.txt, we should return */
13592e5b6d6dSopenharmony_ci    }
13602e5b6d6dSopenharmony_ci
13612e5b6d6dSopenharmony_ci    /* sanity check on repeated properties */
13622e5b6d6dSopenharmony_ci    for(c=0xfffe; c<=0x10ffff;) {
13632e5b6d6dSopenharmony_ci        type=u_charType(c);
13642e5b6d6dSopenharmony_ci        if((uint32_t)u_getIntPropertyValue(c, UCHAR_GENERAL_CATEGORY_MASK)!=U_MASK(type)) {
13652e5b6d6dSopenharmony_ci            log_err("error: (uint32_t)u_getIntPropertyValue(U+%04lx, UCHAR_GENERAL_CATEGORY_MASK)!=U_MASK(u_charType())\n", c);
13662e5b6d6dSopenharmony_ci        }
13672e5b6d6dSopenharmony_ci        if(type!=U_UNASSIGNED) {
13682e5b6d6dSopenharmony_ci            log_err("error: u_charType(U+%04lx)!=U_UNASSIGNED (returns %d)\n", c, u_charType(c));
13692e5b6d6dSopenharmony_ci        }
13702e5b6d6dSopenharmony_ci        if((c&0xffff)==0xfffe) {
13712e5b6d6dSopenharmony_ci            ++c;
13722e5b6d6dSopenharmony_ci        } else {
13732e5b6d6dSopenharmony_ci            c+=0xffff;
13742e5b6d6dSopenharmony_ci        }
13752e5b6d6dSopenharmony_ci    }
13762e5b6d6dSopenharmony_ci
13772e5b6d6dSopenharmony_ci    /* test that PUA is not "unassigned" */
13782e5b6d6dSopenharmony_ci    for(c=0xe000; c<=0x10fffd;) {
13792e5b6d6dSopenharmony_ci        type=u_charType(c);
13802e5b6d6dSopenharmony_ci        if((uint32_t)u_getIntPropertyValue(c, UCHAR_GENERAL_CATEGORY_MASK)!=U_MASK(type)) {
13812e5b6d6dSopenharmony_ci            log_err("error: (uint32_t)u_getIntPropertyValue(U+%04lx, UCHAR_GENERAL_CATEGORY_MASK)!=U_MASK(u_charType())\n", c);
13822e5b6d6dSopenharmony_ci        }
13832e5b6d6dSopenharmony_ci        if(type==U_UNASSIGNED) {
13842e5b6d6dSopenharmony_ci            log_err("error: u_charType(U+%04lx)==U_UNASSIGNED\n", c);
13852e5b6d6dSopenharmony_ci        } else if(type!=U_PRIVATE_USE_CHAR) {
13862e5b6d6dSopenharmony_ci            log_verbose("PUA override: u_charType(U+%04lx)=%d\n", c, type);
13872e5b6d6dSopenharmony_ci        }
13882e5b6d6dSopenharmony_ci        if(c==0xf8ff) {
13892e5b6d6dSopenharmony_ci            c=0xf0000;
13902e5b6d6dSopenharmony_ci        } else if(c==0xffffd) {
13912e5b6d6dSopenharmony_ci            c=0x100000;
13922e5b6d6dSopenharmony_ci        } else {
13932e5b6d6dSopenharmony_ci            ++c;
13942e5b6d6dSopenharmony_ci        }
13952e5b6d6dSopenharmony_ci    }
13962e5b6d6dSopenharmony_ci
13972e5b6d6dSopenharmony_ci    /* test u_enumCharTypes() */
13982e5b6d6dSopenharmony_ci    u_enumCharTypes(enumTypeRange, "a1");
13992e5b6d6dSopenharmony_ci
14002e5b6d6dSopenharmony_ci    /* check default properties */
14012e5b6d6dSopenharmony_ci    u_enumCharTypes(enumDefaultsRange, NULL);
14022e5b6d6dSopenharmony_ci}
14032e5b6d6dSopenharmony_ci
14042e5b6d6dSopenharmony_cistatic void TestCodeUnit(){
14052e5b6d6dSopenharmony_ci    const UChar codeunit[]={0x0000,0xe065,0x20ac,0xd7ff,0xd800,0xd841,0xd905,0xdbff,0xdc00,0xdc02,0xddee,0xdfff,0};
14062e5b6d6dSopenharmony_ci
14072e5b6d6dSopenharmony_ci    int32_t i;
14082e5b6d6dSopenharmony_ci
14092e5b6d6dSopenharmony_ci    for(i=0; i<UPRV_LENGTHOF(codeunit); i++){
14102e5b6d6dSopenharmony_ci        UChar c=codeunit[i];
14112e5b6d6dSopenharmony_ci        if(i<4){
14122e5b6d6dSopenharmony_ci            if(!(U16_IS_SINGLE(c)) || (U16_IS_LEAD(c)) || (U16_IS_TRAIL(c)) ||
14132e5b6d6dSopenharmony_ci                    U16_IS_SURROGATE(c) || U_IS_SURROGATE(c)) {
14142e5b6d6dSopenharmony_ci                log_err("ERROR: U+%04x is a single", c);
14152e5b6d6dSopenharmony_ci            }
14162e5b6d6dSopenharmony_ci
14172e5b6d6dSopenharmony_ci        }
14182e5b6d6dSopenharmony_ci        if(i >= 4 && i< 8){
14192e5b6d6dSopenharmony_ci            if(!(U16_IS_LEAD(c)) || U16_IS_SINGLE(c) || U16_IS_TRAIL(c) ||
14202e5b6d6dSopenharmony_ci                    !U16_IS_SURROGATE(c) || !U_IS_SURROGATE(c)){
14212e5b6d6dSopenharmony_ci                log_err("ERROR: U+%04x is a first surrogate", c);
14222e5b6d6dSopenharmony_ci            }
14232e5b6d6dSopenharmony_ci        }
14242e5b6d6dSopenharmony_ci        if(i >= 8 && i< 12){
14252e5b6d6dSopenharmony_ci            if(!(U16_IS_TRAIL(c)) || U16_IS_SINGLE(c) || U16_IS_LEAD(c) ||
14262e5b6d6dSopenharmony_ci                    !U16_IS_SURROGATE(c) || !U_IS_SURROGATE(c)){
14272e5b6d6dSopenharmony_ci                log_err("ERROR: U+%04x is a second surrogate", c);
14282e5b6d6dSopenharmony_ci            }
14292e5b6d6dSopenharmony_ci        }
14302e5b6d6dSopenharmony_ci#if !U_HIDE_OBSOLETE_UTF_OLD_H
14312e5b6d6dSopenharmony_ci        if(i<4){
14322e5b6d6dSopenharmony_ci            if(!(UTF_IS_SINGLE(c)) || (UTF_IS_LEAD(c)) || (UTF_IS_TRAIL(c)) ||(UTF_IS_SURROGATE(c))){
14332e5b6d6dSopenharmony_ci                log_err("ERROR: U+%04x is a single", c);
14342e5b6d6dSopenharmony_ci            }
14352e5b6d6dSopenharmony_ci
14362e5b6d6dSopenharmony_ci        }
14372e5b6d6dSopenharmony_ci        if(i >= 4 && i< 8){
14382e5b6d6dSopenharmony_ci            if(!(UTF_IS_LEAD(c)) || UTF_IS_SINGLE(c) || UTF_IS_TRAIL(c) || !(UTF_IS_SURROGATE(c))){
14392e5b6d6dSopenharmony_ci                log_err("ERROR: U+%04x is a first surrogate", c);
14402e5b6d6dSopenharmony_ci            }
14412e5b6d6dSopenharmony_ci        }
14422e5b6d6dSopenharmony_ci        if(i >= 8 && i< 12){
14432e5b6d6dSopenharmony_ci            if(!(UTF_IS_TRAIL(c)) || UTF_IS_SINGLE(c) || UTF_IS_LEAD(c) || !(UTF_IS_SURROGATE(c))){
14442e5b6d6dSopenharmony_ci                log_err("ERROR: U+%04x is a second surrogate", c);
14452e5b6d6dSopenharmony_ci            }
14462e5b6d6dSopenharmony_ci        }
14472e5b6d6dSopenharmony_ci#endif
14482e5b6d6dSopenharmony_ci    }
14492e5b6d6dSopenharmony_ci}
14502e5b6d6dSopenharmony_ci
14512e5b6d6dSopenharmony_cistatic void TestCodePoint(){
14522e5b6d6dSopenharmony_ci    const UChar32 codePoint[]={
14532e5b6d6dSopenharmony_ci        /*surrogate, notvalid(codepoint), not a UnicodeChar, not Error */
14542e5b6d6dSopenharmony_ci        0xd800,
14552e5b6d6dSopenharmony_ci        0xdbff,
14562e5b6d6dSopenharmony_ci        0xdc00,
14572e5b6d6dSopenharmony_ci        0xdfff,
14582e5b6d6dSopenharmony_ci        0xdc04,
14592e5b6d6dSopenharmony_ci        0xd821,
14602e5b6d6dSopenharmony_ci        /*not a surrogate, valid, isUnicodeChar , not Error*/
14612e5b6d6dSopenharmony_ci        0x20ac,
14622e5b6d6dSopenharmony_ci        0xd7ff,
14632e5b6d6dSopenharmony_ci        0xe000,
14642e5b6d6dSopenharmony_ci        0xe123,
14652e5b6d6dSopenharmony_ci        0x0061,
14662e5b6d6dSopenharmony_ci        0xe065,
14672e5b6d6dSopenharmony_ci        0x20402,
14682e5b6d6dSopenharmony_ci        0x24506,
14692e5b6d6dSopenharmony_ci        0x23456,
14702e5b6d6dSopenharmony_ci        0x20402,
14712e5b6d6dSopenharmony_ci        0x10402,
14722e5b6d6dSopenharmony_ci        0x23456,
14732e5b6d6dSopenharmony_ci        /*not a surrogate, not valid, isUnicodeChar, isError */
14742e5b6d6dSopenharmony_ci        0x0015,
14752e5b6d6dSopenharmony_ci        0x009f,
14762e5b6d6dSopenharmony_ci        /*not a surrogate, not valid, not isUnicodeChar, isError */
14772e5b6d6dSopenharmony_ci        0xffff,
14782e5b6d6dSopenharmony_ci        0xfffe,
14792e5b6d6dSopenharmony_ci    };
14802e5b6d6dSopenharmony_ci    int32_t i;
14812e5b6d6dSopenharmony_ci    for(i=0; i<UPRV_LENGTHOF(codePoint); i++) {
14822e5b6d6dSopenharmony_ci        UChar32 c=codePoint[i];
14832e5b6d6dSopenharmony_ci        if(i<6) {
14842e5b6d6dSopenharmony_ci            if(!U_IS_SURROGATE(c) || !U16_IS_SURROGATE(c)) {
14852e5b6d6dSopenharmony_ci                log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
14862e5b6d6dSopenharmony_ci            }
14872e5b6d6dSopenharmony_ci            if(U_IS_UNICODE_CHAR(c)) {
14882e5b6d6dSopenharmony_ci                log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
14892e5b6d6dSopenharmony_ci            }
14902e5b6d6dSopenharmony_ci        } else if(i >=6 && i<18) {
14912e5b6d6dSopenharmony_ci            if(U_IS_SURROGATE(c) || U16_IS_SURROGATE(c)) {
14922e5b6d6dSopenharmony_ci                log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
14932e5b6d6dSopenharmony_ci            }
14942e5b6d6dSopenharmony_ci            if(!U_IS_UNICODE_CHAR(c)) {
14952e5b6d6dSopenharmony_ci                log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
14962e5b6d6dSopenharmony_ci            }
14972e5b6d6dSopenharmony_ci        } else if(i >=18 && i<20) {
14982e5b6d6dSopenharmony_ci            if(U_IS_SURROGATE(c) || U16_IS_SURROGATE(c)) {
14992e5b6d6dSopenharmony_ci                log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
15002e5b6d6dSopenharmony_ci            }
15012e5b6d6dSopenharmony_ci            if(!U_IS_UNICODE_CHAR(c)) {
15022e5b6d6dSopenharmony_ci                log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
15032e5b6d6dSopenharmony_ci            }
15042e5b6d6dSopenharmony_ci        } else if(i >=18 && i<UPRV_LENGTHOF(codePoint)) {
15052e5b6d6dSopenharmony_ci            if(U_IS_SURROGATE(c) || U16_IS_SURROGATE(c)) {
15062e5b6d6dSopenharmony_ci                log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
15072e5b6d6dSopenharmony_ci            }
15082e5b6d6dSopenharmony_ci            if(U_IS_UNICODE_CHAR(c)) {
15092e5b6d6dSopenharmony_ci                log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
15102e5b6d6dSopenharmony_ci            }
15112e5b6d6dSopenharmony_ci        }
15122e5b6d6dSopenharmony_ci#if !U_HIDE_OBSOLETE_UTF_OLD_H
15132e5b6d6dSopenharmony_ci        if(i<6){
15142e5b6d6dSopenharmony_ci            if(!UTF_IS_SURROGATE(c)){
15152e5b6d6dSopenharmony_ci                log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
15162e5b6d6dSopenharmony_ci            }
15172e5b6d6dSopenharmony_ci            if(UTF_IS_VALID(c)){
15182e5b6d6dSopenharmony_ci                log_err("ERROR: isValid() failed for U+%04x\n", c);
15192e5b6d6dSopenharmony_ci            }
15202e5b6d6dSopenharmony_ci            if(UTF_IS_UNICODE_CHAR(c)){
15212e5b6d6dSopenharmony_ci                log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
15222e5b6d6dSopenharmony_ci            }
15232e5b6d6dSopenharmony_ci            if(UTF_IS_ERROR(c)){
15242e5b6d6dSopenharmony_ci                log_err("ERROR: isError() failed for U+%04x\n", c);
15252e5b6d6dSopenharmony_ci            }
15262e5b6d6dSopenharmony_ci        }else if(i >=6 && i<18){
15272e5b6d6dSopenharmony_ci            if(UTF_IS_SURROGATE(c)){
15282e5b6d6dSopenharmony_ci                log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
15292e5b6d6dSopenharmony_ci            }
15302e5b6d6dSopenharmony_ci            if(!UTF_IS_VALID(c)){
15312e5b6d6dSopenharmony_ci                log_err("ERROR: isValid() failed for U+%04x\n", c);
15322e5b6d6dSopenharmony_ci            }
15332e5b6d6dSopenharmony_ci            if(!UTF_IS_UNICODE_CHAR(c)){
15342e5b6d6dSopenharmony_ci                log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
15352e5b6d6dSopenharmony_ci            }
15362e5b6d6dSopenharmony_ci            if(UTF_IS_ERROR(c)){
15372e5b6d6dSopenharmony_ci                log_err("ERROR: isError() failed for U+%04x\n", c);
15382e5b6d6dSopenharmony_ci            }
15392e5b6d6dSopenharmony_ci        }else if(i >=18 && i<20){
15402e5b6d6dSopenharmony_ci            if(UTF_IS_SURROGATE(c)){
15412e5b6d6dSopenharmony_ci                log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
15422e5b6d6dSopenharmony_ci            }
15432e5b6d6dSopenharmony_ci            if(UTF_IS_VALID(c)){
15442e5b6d6dSopenharmony_ci                log_err("ERROR: isValid() failed for U+%04x\n", c);
15452e5b6d6dSopenharmony_ci            }
15462e5b6d6dSopenharmony_ci            if(!UTF_IS_UNICODE_CHAR(c)){
15472e5b6d6dSopenharmony_ci                log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
15482e5b6d6dSopenharmony_ci            }
15492e5b6d6dSopenharmony_ci            if(!UTF_IS_ERROR(c)){
15502e5b6d6dSopenharmony_ci                log_err("ERROR: isError() failed for U+%04x\n", c);
15512e5b6d6dSopenharmony_ci            }
15522e5b6d6dSopenharmony_ci        }
15532e5b6d6dSopenharmony_ci        else if(i >=18 && i<UPRV_LENGTHOF(codePoint)){
15542e5b6d6dSopenharmony_ci            if(UTF_IS_SURROGATE(c)){
15552e5b6d6dSopenharmony_ci                log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
15562e5b6d6dSopenharmony_ci            }
15572e5b6d6dSopenharmony_ci            if(UTF_IS_VALID(c)){
15582e5b6d6dSopenharmony_ci                log_err("ERROR: isValid() failed for U+%04x\n", c);
15592e5b6d6dSopenharmony_ci            }
15602e5b6d6dSopenharmony_ci            if(UTF_IS_UNICODE_CHAR(c)){
15612e5b6d6dSopenharmony_ci                log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
15622e5b6d6dSopenharmony_ci            }
15632e5b6d6dSopenharmony_ci            if(!UTF_IS_ERROR(c)){
15642e5b6d6dSopenharmony_ci                log_err("ERROR: isError() failed for U+%04x\n", c);
15652e5b6d6dSopenharmony_ci            }
15662e5b6d6dSopenharmony_ci        }
15672e5b6d6dSopenharmony_ci#endif
15682e5b6d6dSopenharmony_ci    }
15692e5b6d6dSopenharmony_ci
15702e5b6d6dSopenharmony_ci    if(
15712e5b6d6dSopenharmony_ci        !U_IS_BMP(0) || !U_IS_BMP(0x61) || !U_IS_BMP(0x20ac) ||
15722e5b6d6dSopenharmony_ci        !U_IS_BMP(0xd9da) || !U_IS_BMP(0xdfed) || !U_IS_BMP(0xffff) ||
15732e5b6d6dSopenharmony_ci        U_IS_BMP(U_SENTINEL) || U_IS_BMP(0x10000) || U_IS_BMP(0x50005) ||
15742e5b6d6dSopenharmony_ci        U_IS_BMP(0x10ffff) || U_IS_BMP(0x110000) || U_IS_BMP(0x7fffffff)
15752e5b6d6dSopenharmony_ci    ) {
15762e5b6d6dSopenharmony_ci        log_err("error with U_IS_BMP()\n");
15772e5b6d6dSopenharmony_ci    }
15782e5b6d6dSopenharmony_ci
15792e5b6d6dSopenharmony_ci    if(
15802e5b6d6dSopenharmony_ci        U_IS_SUPPLEMENTARY(0) || U_IS_SUPPLEMENTARY(0x61) || U_IS_SUPPLEMENTARY(0x20ac) ||
15812e5b6d6dSopenharmony_ci        U_IS_SUPPLEMENTARY(0xd9da) || U_IS_SUPPLEMENTARY(0xdfed) || U_IS_SUPPLEMENTARY(0xffff) ||
15822e5b6d6dSopenharmony_ci        U_IS_SUPPLEMENTARY(U_SENTINEL) || !U_IS_SUPPLEMENTARY(0x10000) || !U_IS_SUPPLEMENTARY(0x50005) ||
15832e5b6d6dSopenharmony_ci        !U_IS_SUPPLEMENTARY(0x10ffff) || U_IS_SUPPLEMENTARY(0x110000) || U_IS_SUPPLEMENTARY(0x7fffffff)
15842e5b6d6dSopenharmony_ci    ) {
15852e5b6d6dSopenharmony_ci        log_err("error with U_IS_SUPPLEMENTARY()\n");
15862e5b6d6dSopenharmony_ci    }
15872e5b6d6dSopenharmony_ci}
15882e5b6d6dSopenharmony_ci
15892e5b6d6dSopenharmony_cistatic void TestCharLength()
15902e5b6d6dSopenharmony_ci{
15912e5b6d6dSopenharmony_ci    const int32_t codepoint[]={
15922e5b6d6dSopenharmony_ci        1, 0x0061,
15932e5b6d6dSopenharmony_ci        1, 0xe065,
15942e5b6d6dSopenharmony_ci        1, 0x20ac,
15952e5b6d6dSopenharmony_ci        2, 0x20402,
15962e5b6d6dSopenharmony_ci        2, 0x23456,
15972e5b6d6dSopenharmony_ci        2, 0x24506,
15982e5b6d6dSopenharmony_ci        2, 0x20402,
15992e5b6d6dSopenharmony_ci        2, 0x10402,
16002e5b6d6dSopenharmony_ci        1, 0xd7ff,
16012e5b6d6dSopenharmony_ci        1, 0xe000
16022e5b6d6dSopenharmony_ci    };
16032e5b6d6dSopenharmony_ci
16042e5b6d6dSopenharmony_ci    int32_t i;
16052e5b6d6dSopenharmony_ci#if !U_HIDE_OBSOLETE_UTF_OLD_H
16062e5b6d6dSopenharmony_ci    UBool multiple;
16072e5b6d6dSopenharmony_ci#endif
16082e5b6d6dSopenharmony_ci    for(i=0; i<UPRV_LENGTHOF(codepoint); i=(int16_t)(i+2)){
16092e5b6d6dSopenharmony_ci        UChar32 c=codepoint[i+1];
16102e5b6d6dSopenharmony_ci        if(
16112e5b6d6dSopenharmony_ci#if !U_HIDE_OBSOLETE_UTF_OLD_H
16122e5b6d6dSopenharmony_ci                UTF_CHAR_LENGTH(c) != codepoint[i] ||
16132e5b6d6dSopenharmony_ci#endif
16142e5b6d6dSopenharmony_ci                U16_LENGTH(c) != codepoint[i]) {
16152e5b6d6dSopenharmony_ci            log_err("The no: of code units for U+%04x:- Expected: %d Got: %d\n", c, codepoint[i], U16_LENGTH(c));
16162e5b6d6dSopenharmony_ci        }
16172e5b6d6dSopenharmony_ci#if !U_HIDE_OBSOLETE_UTF_OLD_H
16182e5b6d6dSopenharmony_ci        multiple=(UBool)(codepoint[i] == 1 ? false : true);
16192e5b6d6dSopenharmony_ci        if(UTF_NEED_MULTIPLE_UCHAR(c) != multiple){
16202e5b6d6dSopenharmony_ci            log_err("ERROR: Unicode::needMultipleUChar() failed for U+%04x\n", c);
16212e5b6d6dSopenharmony_ci        }
16222e5b6d6dSopenharmony_ci#endif
16232e5b6d6dSopenharmony_ci    }
16242e5b6d6dSopenharmony_ci}
16252e5b6d6dSopenharmony_ci
16262e5b6d6dSopenharmony_ci/*internal functions ----*/
16272e5b6d6dSopenharmony_cistatic int32_t MakeProp(char* str)
16282e5b6d6dSopenharmony_ci{
16292e5b6d6dSopenharmony_ci    int32_t result = 0;
16302e5b6d6dSopenharmony_ci    char* matchPosition =0;
16312e5b6d6dSopenharmony_ci
16322e5b6d6dSopenharmony_ci    matchPosition = strstr(tagStrings, str);
16332e5b6d6dSopenharmony_ci    if (matchPosition == 0)
16342e5b6d6dSopenharmony_ci    {
16352e5b6d6dSopenharmony_ci        log_err("unrecognized type letter ");
16362e5b6d6dSopenharmony_ci        log_err(str);
16372e5b6d6dSopenharmony_ci    }
16382e5b6d6dSopenharmony_ci    else
16392e5b6d6dSopenharmony_ci        result = (int32_t)((matchPosition - tagStrings) / 2);
16402e5b6d6dSopenharmony_ci    return result;
16412e5b6d6dSopenharmony_ci}
16422e5b6d6dSopenharmony_ci
16432e5b6d6dSopenharmony_cistatic int32_t MakeDir(char* str)
16442e5b6d6dSopenharmony_ci{
16452e5b6d6dSopenharmony_ci    int32_t pos = 0;
16462e5b6d6dSopenharmony_ci    for (pos = 0; pos < U_CHAR_DIRECTION_COUNT; pos++) {
16472e5b6d6dSopenharmony_ci        if (strcmp(str, dirStrings[pos]) == 0) {
16482e5b6d6dSopenharmony_ci            return pos;
16492e5b6d6dSopenharmony_ci        }
16502e5b6d6dSopenharmony_ci    }
16512e5b6d6dSopenharmony_ci    return -1;
16522e5b6d6dSopenharmony_ci}
16532e5b6d6dSopenharmony_ci
16542e5b6d6dSopenharmony_ci/* test u_charName() -------------------------------------------------------- */
16552e5b6d6dSopenharmony_ci
16562e5b6d6dSopenharmony_cistatic const struct {
16572e5b6d6dSopenharmony_ci    uint32_t code;
16582e5b6d6dSopenharmony_ci    const char *name, *oldName, *extName, *alias;
16592e5b6d6dSopenharmony_ci} names[]={
16602e5b6d6dSopenharmony_ci    {0x0061, "LATIN SMALL LETTER A", "", "LATIN SMALL LETTER A", NULL},
16612e5b6d6dSopenharmony_ci    {0x01a2, "LATIN CAPITAL LETTER OI", "",
16622e5b6d6dSopenharmony_ci             "LATIN CAPITAL LETTER OI",
16632e5b6d6dSopenharmony_ci             "LATIN CAPITAL LETTER GHA"},
16642e5b6d6dSopenharmony_ci    {0x0284, "LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK", "",
16652e5b6d6dSopenharmony_ci             "LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK", NULL},
16662e5b6d6dSopenharmony_ci    {0x0fd0, "TIBETAN MARK BSKA- SHOG GI MGO RGYAN", "",
16672e5b6d6dSopenharmony_ci             "TIBETAN MARK BSKA- SHOG GI MGO RGYAN",
16682e5b6d6dSopenharmony_ci             "TIBETAN MARK BKA- SHOG GI MGO RGYAN"},
16692e5b6d6dSopenharmony_ci    {0x3401, "CJK UNIFIED IDEOGRAPH-3401", "", "CJK UNIFIED IDEOGRAPH-3401", NULL},
16702e5b6d6dSopenharmony_ci    {0x7fed, "CJK UNIFIED IDEOGRAPH-7FED", "", "CJK UNIFIED IDEOGRAPH-7FED", NULL},
16712e5b6d6dSopenharmony_ci    {0xac00, "HANGUL SYLLABLE GA", "", "HANGUL SYLLABLE GA", NULL},
16722e5b6d6dSopenharmony_ci    {0xd7a3, "HANGUL SYLLABLE HIH", "", "HANGUL SYLLABLE HIH", NULL},
16732e5b6d6dSopenharmony_ci    {0xd800, "", "", "<lead surrogate-D800>", NULL},
16742e5b6d6dSopenharmony_ci    {0xdc00, "", "", "<trail surrogate-DC00>", NULL},
16752e5b6d6dSopenharmony_ci    {0xff08, "FULLWIDTH LEFT PARENTHESIS", "", "FULLWIDTH LEFT PARENTHESIS", NULL},
16762e5b6d6dSopenharmony_ci    {0xffe5, "FULLWIDTH YEN SIGN", "", "FULLWIDTH YEN SIGN", NULL},
16772e5b6d6dSopenharmony_ci    {0xffff, "", "", "<noncharacter-FFFF>", NULL},
16782e5b6d6dSopenharmony_ci    {0x1d0c5, "BYZANTINE MUSICAL SYMBOL FHTORA SKLIRON CHROMA VASIS", "",
16792e5b6d6dSopenharmony_ci              "BYZANTINE MUSICAL SYMBOL FHTORA SKLIRON CHROMA VASIS",
16802e5b6d6dSopenharmony_ci              "BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON CHROMA VASIS"},
16812e5b6d6dSopenharmony_ci    {0x23456, "CJK UNIFIED IDEOGRAPH-23456", "", "CJK UNIFIED IDEOGRAPH-23456", NULL}
16822e5b6d6dSopenharmony_ci};
16832e5b6d6dSopenharmony_ci
16842e5b6d6dSopenharmony_cistatic UBool
16852e5b6d6dSopenharmony_cienumCharNamesFn(void *context,
16862e5b6d6dSopenharmony_ci                UChar32 code, UCharNameChoice nameChoice,
16872e5b6d6dSopenharmony_ci                const char *name, int32_t length) {
16882e5b6d6dSopenharmony_ci    int32_t *pCount=(int32_t *)context;
16892e5b6d6dSopenharmony_ci    const char *expected;
16902e5b6d6dSopenharmony_ci    int i;
16912e5b6d6dSopenharmony_ci
16922e5b6d6dSopenharmony_ci    if(length<=0 || length!=(int32_t)strlen(name)) {
16932e5b6d6dSopenharmony_ci        /* should not be called with an empty string or invalid length */
16942e5b6d6dSopenharmony_ci        log_err("u_enumCharName(0x%lx)=%s but length=%ld\n", name, length);
16952e5b6d6dSopenharmony_ci        return true;
16962e5b6d6dSopenharmony_ci    }
16972e5b6d6dSopenharmony_ci
16982e5b6d6dSopenharmony_ci    ++*pCount;
16992e5b6d6dSopenharmony_ci    for(i=0; i<UPRV_LENGTHOF(names); ++i) {
17002e5b6d6dSopenharmony_ci        if(code==(UChar32)names[i].code) {
17012e5b6d6dSopenharmony_ci            switch (nameChoice) {
17022e5b6d6dSopenharmony_ci                case U_EXTENDED_CHAR_NAME:
17032e5b6d6dSopenharmony_ci                    if(0!=strcmp(name, names[i].extName)) {
17042e5b6d6dSopenharmony_ci                        log_err("u_enumCharName(0x%lx - Extended)=%s instead of %s\n", code, name, names[i].extName);
17052e5b6d6dSopenharmony_ci                    }
17062e5b6d6dSopenharmony_ci                    break;
17072e5b6d6dSopenharmony_ci                case U_UNICODE_CHAR_NAME:
17082e5b6d6dSopenharmony_ci                    if(0!=strcmp(name, names[i].name)) {
17092e5b6d6dSopenharmony_ci                        log_err("u_enumCharName(0x%lx)=%s instead of %s\n", code, name, names[i].name);
17102e5b6d6dSopenharmony_ci                    }
17112e5b6d6dSopenharmony_ci                    break;
17122e5b6d6dSopenharmony_ci                case U_UNICODE_10_CHAR_NAME:
17132e5b6d6dSopenharmony_ci                    expected=names[i].oldName;
17142e5b6d6dSopenharmony_ci                    if(expected[0]==0 || 0!=strcmp(name, expected)) {
17152e5b6d6dSopenharmony_ci                        log_err("u_enumCharName(0x%lx - 1.0)=%s instead of %s\n", code, name, expected);
17162e5b6d6dSopenharmony_ci                    }
17172e5b6d6dSopenharmony_ci                    break;
17182e5b6d6dSopenharmony_ci                case U_CHAR_NAME_ALIAS:
17192e5b6d6dSopenharmony_ci                    expected=names[i].alias;
17202e5b6d6dSopenharmony_ci                    if(expected==NULL || expected[0]==0 || 0!=strcmp(name, expected)) {
17212e5b6d6dSopenharmony_ci                        log_err("u_enumCharName(0x%lx - alias)=%s instead of %s\n", code, name, expected);
17222e5b6d6dSopenharmony_ci                    }
17232e5b6d6dSopenharmony_ci                    break;
17242e5b6d6dSopenharmony_ci                case U_CHAR_NAME_CHOICE_COUNT:
17252e5b6d6dSopenharmony_ci                    break;
17262e5b6d6dSopenharmony_ci            }
17272e5b6d6dSopenharmony_ci            break;
17282e5b6d6dSopenharmony_ci        }
17292e5b6d6dSopenharmony_ci    }
17302e5b6d6dSopenharmony_ci    return true;
17312e5b6d6dSopenharmony_ci}
17322e5b6d6dSopenharmony_ci
17332e5b6d6dSopenharmony_cistruct enumExtCharNamesContext {
17342e5b6d6dSopenharmony_ci    uint32_t length;
17352e5b6d6dSopenharmony_ci    int32_t last;
17362e5b6d6dSopenharmony_ci};
17372e5b6d6dSopenharmony_ci
17382e5b6d6dSopenharmony_cistatic UBool
17392e5b6d6dSopenharmony_cienumExtCharNamesFn(void *context,
17402e5b6d6dSopenharmony_ci                UChar32 code, UCharNameChoice nameChoice,
17412e5b6d6dSopenharmony_ci                const char *name, int32_t length) {
17422e5b6d6dSopenharmony_ci    struct enumExtCharNamesContext *ecncp = (struct enumExtCharNamesContext *) context;
17432e5b6d6dSopenharmony_ci
17442e5b6d6dSopenharmony_ci    if (ecncp->last != (int32_t) code - 1) {
17452e5b6d6dSopenharmony_ci        if (ecncp->last < 0) {
17462e5b6d6dSopenharmony_ci            log_err("u_enumCharName(0x%lx - Ext) after u_enumCharName(0x%lx - Ext) instead of u_enumCharName(0x%lx - Ext)\n", code, ecncp->last, ecncp->last + 1);
17472e5b6d6dSopenharmony_ci        } else {
17482e5b6d6dSopenharmony_ci            log_err("u_enumCharName(0x%lx - Ext) instead of u_enumCharName(0x0 - Ext)\n", code);
17492e5b6d6dSopenharmony_ci        }
17502e5b6d6dSopenharmony_ci    }
17512e5b6d6dSopenharmony_ci    ecncp->last = (int32_t) code;
17522e5b6d6dSopenharmony_ci
17532e5b6d6dSopenharmony_ci    if (!*name) {
17542e5b6d6dSopenharmony_ci        log_err("u_enumCharName(0x%lx - Ext) should not be an empty string\n", code);
17552e5b6d6dSopenharmony_ci    }
17562e5b6d6dSopenharmony_ci
17572e5b6d6dSopenharmony_ci    return enumCharNamesFn(&ecncp->length, code, nameChoice, name, length);
17582e5b6d6dSopenharmony_ci}
17592e5b6d6dSopenharmony_ci
17602e5b6d6dSopenharmony_ci/**
17612e5b6d6dSopenharmony_ci * This can be made more efficient by moving it into putil.c and having
17622e5b6d6dSopenharmony_ci * it directly access the ebcdic translation tables.
17632e5b6d6dSopenharmony_ci * TODO: If we get this method in putil.c, then delete it from here.
17642e5b6d6dSopenharmony_ci */
17652e5b6d6dSopenharmony_cistatic UChar
17662e5b6d6dSopenharmony_ciu_charToUChar(char c) {
17672e5b6d6dSopenharmony_ci    UChar uc;
17682e5b6d6dSopenharmony_ci    u_charsToUChars(&c, &uc, 1);
17692e5b6d6dSopenharmony_ci    return uc;
17702e5b6d6dSopenharmony_ci}
17712e5b6d6dSopenharmony_ci
17722e5b6d6dSopenharmony_cistatic void
17732e5b6d6dSopenharmony_ciTestCharNames() {
17742e5b6d6dSopenharmony_ci    static char name[80];
17752e5b6d6dSopenharmony_ci    UErrorCode errorCode=U_ZERO_ERROR;
17762e5b6d6dSopenharmony_ci    struct enumExtCharNamesContext extContext;
17772e5b6d6dSopenharmony_ci    const char *expected;
17782e5b6d6dSopenharmony_ci    int32_t length;
17792e5b6d6dSopenharmony_ci    UChar32 c;
17802e5b6d6dSopenharmony_ci    int32_t i;
17812e5b6d6dSopenharmony_ci
17822e5b6d6dSopenharmony_ci    log_verbose("Testing uprv_getMaxCharNameLength()\n");
17832e5b6d6dSopenharmony_ci    length=uprv_getMaxCharNameLength();
17842e5b6d6dSopenharmony_ci    if(length==0) {
17852e5b6d6dSopenharmony_ci        /* no names data available */
17862e5b6d6dSopenharmony_ci        return;
17872e5b6d6dSopenharmony_ci    }
17882e5b6d6dSopenharmony_ci    if(length<83) { /* Unicode 3.2 max char name length */
17892e5b6d6dSopenharmony_ci        log_err("uprv_getMaxCharNameLength()=%d is too short");
17902e5b6d6dSopenharmony_ci    }
17912e5b6d6dSopenharmony_ci    /* ### TODO same tests for max ISO comment length as for max name length */
17922e5b6d6dSopenharmony_ci
17932e5b6d6dSopenharmony_ci    log_verbose("Testing u_charName()\n");
17942e5b6d6dSopenharmony_ci    for(i=0; i<UPRV_LENGTHOF(names); ++i) {
17952e5b6d6dSopenharmony_ci        /* modern Unicode character name */
17962e5b6d6dSopenharmony_ci        length=u_charName(names[i].code, U_UNICODE_CHAR_NAME, name, sizeof(name), &errorCode);
17972e5b6d6dSopenharmony_ci        if(U_FAILURE(errorCode)) {
17982e5b6d6dSopenharmony_ci            log_err("u_charName(0x%lx) error %s\n", names[i].code, u_errorName(errorCode));
17992e5b6d6dSopenharmony_ci            return;
18002e5b6d6dSopenharmony_ci        }
18012e5b6d6dSopenharmony_ci        if(length<0 || 0!=strcmp(name, names[i].name) || length!=(uint16_t)strlen(name)) {
18022e5b6d6dSopenharmony_ci            log_err("u_charName(0x%lx) gets: %s (length %ld) instead of: %s\n", names[i].code, name, length, names[i].name);
18032e5b6d6dSopenharmony_ci        }
18042e5b6d6dSopenharmony_ci
18052e5b6d6dSopenharmony_ci        /* find the modern name */
18062e5b6d6dSopenharmony_ci        if (*names[i].name) {
18072e5b6d6dSopenharmony_ci            c=u_charFromName(U_UNICODE_CHAR_NAME, names[i].name, &errorCode);
18082e5b6d6dSopenharmony_ci            if(U_FAILURE(errorCode)) {
18092e5b6d6dSopenharmony_ci                log_err("u_charFromName(%s) error %s\n", names[i].name, u_errorName(errorCode));
18102e5b6d6dSopenharmony_ci                return;
18112e5b6d6dSopenharmony_ci            }
18122e5b6d6dSopenharmony_ci            if(c!=(UChar32)names[i].code) {
18132e5b6d6dSopenharmony_ci                log_err("u_charFromName(%s) gets 0x%lx instead of 0x%lx\n", names[i].name, c, names[i].code);
18142e5b6d6dSopenharmony_ci            }
18152e5b6d6dSopenharmony_ci        }
18162e5b6d6dSopenharmony_ci
18172e5b6d6dSopenharmony_ci        /* Unicode 1.0 character name */
18182e5b6d6dSopenharmony_ci        length=u_charName(names[i].code, U_UNICODE_10_CHAR_NAME, name, sizeof(name), &errorCode);
18192e5b6d6dSopenharmony_ci        if(U_FAILURE(errorCode)) {
18202e5b6d6dSopenharmony_ci            log_err("u_charName(0x%lx - 1.0) error %s\n", names[i].code, u_errorName(errorCode));
18212e5b6d6dSopenharmony_ci            return;
18222e5b6d6dSopenharmony_ci        }
18232e5b6d6dSopenharmony_ci        if(length<0 || (length>0 && 0!=strcmp(name, names[i].oldName)) || length!=(uint16_t)strlen(name)) {
18242e5b6d6dSopenharmony_ci            log_err("u_charName(0x%lx - 1.0) gets %s length %ld instead of nothing or %s\n", names[i].code, name, length, names[i].oldName);
18252e5b6d6dSopenharmony_ci        }
18262e5b6d6dSopenharmony_ci
18272e5b6d6dSopenharmony_ci        /* find the Unicode 1.0 name if it is stored (length>0 means that we could read it) */
18282e5b6d6dSopenharmony_ci        if(names[i].oldName[0]!=0 /* && length>0 */) {
18292e5b6d6dSopenharmony_ci            c=u_charFromName(U_UNICODE_10_CHAR_NAME, names[i].oldName, &errorCode);
18302e5b6d6dSopenharmony_ci            if(U_FAILURE(errorCode)) {
18312e5b6d6dSopenharmony_ci                log_err("u_charFromName(%s - 1.0) error %s\n", names[i].oldName, u_errorName(errorCode));
18322e5b6d6dSopenharmony_ci                return;
18332e5b6d6dSopenharmony_ci            }
18342e5b6d6dSopenharmony_ci            if(c!=(UChar32)names[i].code) {
18352e5b6d6dSopenharmony_ci                log_err("u_charFromName(%s - 1.0) gets 0x%lx instead of 0x%lx\n", names[i].oldName, c, names[i].code);
18362e5b6d6dSopenharmony_ci            }
18372e5b6d6dSopenharmony_ci        }
18382e5b6d6dSopenharmony_ci
18392e5b6d6dSopenharmony_ci        /* Unicode character name alias */
18402e5b6d6dSopenharmony_ci        length=u_charName(names[i].code, U_CHAR_NAME_ALIAS, name, sizeof(name), &errorCode);
18412e5b6d6dSopenharmony_ci        if(U_FAILURE(errorCode)) {
18422e5b6d6dSopenharmony_ci            log_err("u_charName(0x%lx - alias) error %s\n", names[i].code, u_errorName(errorCode));
18432e5b6d6dSopenharmony_ci            return;
18442e5b6d6dSopenharmony_ci        }
18452e5b6d6dSopenharmony_ci        expected=names[i].alias;
18462e5b6d6dSopenharmony_ci        if(expected==NULL) {
18472e5b6d6dSopenharmony_ci            expected="";
18482e5b6d6dSopenharmony_ci        }
18492e5b6d6dSopenharmony_ci        if(length<0 || (length>0 && 0!=strcmp(name, expected)) || length!=(uint16_t)strlen(name)) {
18502e5b6d6dSopenharmony_ci            log_err("u_charName(0x%lx - alias) gets %s length %ld instead of nothing or %s\n",
18512e5b6d6dSopenharmony_ci                    names[i].code, name, length, expected);
18522e5b6d6dSopenharmony_ci        }
18532e5b6d6dSopenharmony_ci
18542e5b6d6dSopenharmony_ci        /* find the Unicode character name alias if it is stored (length>0 means that we could read it) */
18552e5b6d6dSopenharmony_ci        if(expected[0]!=0 /* && length>0 */) {
18562e5b6d6dSopenharmony_ci            c=u_charFromName(U_CHAR_NAME_ALIAS, expected, &errorCode);
18572e5b6d6dSopenharmony_ci            if(U_FAILURE(errorCode)) {
18582e5b6d6dSopenharmony_ci                log_err("u_charFromName(%s - alias) error %s\n",
18592e5b6d6dSopenharmony_ci                        expected, u_errorName(errorCode));
18602e5b6d6dSopenharmony_ci                return;
18612e5b6d6dSopenharmony_ci            }
18622e5b6d6dSopenharmony_ci            if(c!=(UChar32)names[i].code) {
18632e5b6d6dSopenharmony_ci                log_err("u_charFromName(%s - alias) gets 0x%lx instead of 0x%lx\n",
18642e5b6d6dSopenharmony_ci                        expected, c, names[i].code);
18652e5b6d6dSopenharmony_ci            }
18662e5b6d6dSopenharmony_ci        }
18672e5b6d6dSopenharmony_ci    }
18682e5b6d6dSopenharmony_ci
18692e5b6d6dSopenharmony_ci    /* test u_enumCharNames() */
18702e5b6d6dSopenharmony_ci    length=0;
18712e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
18722e5b6d6dSopenharmony_ci    u_enumCharNames(UCHAR_MIN_VALUE, UCHAR_MAX_VALUE + 1, enumCharNamesFn, &length, U_UNICODE_CHAR_NAME, &errorCode);
18732e5b6d6dSopenharmony_ci    if(U_FAILURE(errorCode) || length<94140) {
18742e5b6d6dSopenharmony_ci        log_err("u_enumCharNames(%ld..%lx) error %s names count=%ld\n", UCHAR_MIN_VALUE, UCHAR_MAX_VALUE, u_errorName(errorCode), length);
18752e5b6d6dSopenharmony_ci    }
18762e5b6d6dSopenharmony_ci
18772e5b6d6dSopenharmony_ci    extContext.length = 0;
18782e5b6d6dSopenharmony_ci    extContext.last = -1;
18792e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
18802e5b6d6dSopenharmony_ci    u_enumCharNames(UCHAR_MIN_VALUE, UCHAR_MAX_VALUE + 1, enumExtCharNamesFn, &extContext, U_EXTENDED_CHAR_NAME, &errorCode);
18812e5b6d6dSopenharmony_ci    if(U_FAILURE(errorCode) || extContext.length<UCHAR_MAX_VALUE + 1) {
18822e5b6d6dSopenharmony_ci        log_err("u_enumCharNames(%ld..0x%lx - Extended) error %s names count=%ld\n", UCHAR_MIN_VALUE, UCHAR_MAX_VALUE + 1, u_errorName(errorCode), extContext.length);
18832e5b6d6dSopenharmony_ci    }
18842e5b6d6dSopenharmony_ci
18852e5b6d6dSopenharmony_ci    /* test that u_charFromName() uppercases the input name, i.e., works with mixed-case names (new in 2.0) */
18862e5b6d6dSopenharmony_ci    if(0x61!=u_charFromName(U_UNICODE_CHAR_NAME, "LATin smALl letTER A", &errorCode)) {
18872e5b6d6dSopenharmony_ci        log_err("u_charFromName(U_UNICODE_CHAR_NAME, \"LATin smALl letTER A\") did not find U+0061 (%s)\n", u_errorName(errorCode));
18882e5b6d6dSopenharmony_ci    }
18892e5b6d6dSopenharmony_ci
18902e5b6d6dSopenharmony_ci    /* Test getCharNameCharacters */
18912e5b6d6dSopenharmony_ci    if(!getTestOption(QUICK_OPTION)) {
18922e5b6d6dSopenharmony_ci        enum { BUFSIZE = 256 };
18932e5b6d6dSopenharmony_ci        UErrorCode ec = U_ZERO_ERROR;
18942e5b6d6dSopenharmony_ci        char buf[BUFSIZE];
18952e5b6d6dSopenharmony_ci        int32_t maxLength;
18962e5b6d6dSopenharmony_ci        UChar32 cp;
18972e5b6d6dSopenharmony_ci        UChar pat[BUFSIZE], dumbPat[BUFSIZE];
18982e5b6d6dSopenharmony_ci        int32_t l1, l2;
18992e5b6d6dSopenharmony_ci        UBool map[256];
19002e5b6d6dSopenharmony_ci        UBool ok;
19012e5b6d6dSopenharmony_ci
19022e5b6d6dSopenharmony_ci        USet* set = uset_open(1, 0); /* empty set */
19032e5b6d6dSopenharmony_ci        USet* dumb = uset_open(1, 0); /* empty set */
19042e5b6d6dSopenharmony_ci
19052e5b6d6dSopenharmony_ci        /*
19062e5b6d6dSopenharmony_ci         * uprv_getCharNameCharacters() will likely return more lowercase
19072e5b6d6dSopenharmony_ci         * letters than actual character names contain because
19082e5b6d6dSopenharmony_ci         * it includes all the characters in lowercased names of
19092e5b6d6dSopenharmony_ci         * general categories, for the full possible set of extended names.
19102e5b6d6dSopenharmony_ci         */
19112e5b6d6dSopenharmony_ci        {
19122e5b6d6dSopenharmony_ci            USetAdder sa={
19132e5b6d6dSopenharmony_ci                NULL,
19142e5b6d6dSopenharmony_ci                uset_add,
19152e5b6d6dSopenharmony_ci                uset_addRange,
19162e5b6d6dSopenharmony_ci                uset_addString,
19172e5b6d6dSopenharmony_ci                NULL, /* don't need remove() */
19182e5b6d6dSopenharmony_ci                NULL  /* don't need removeRange() */
19192e5b6d6dSopenharmony_ci            };
19202e5b6d6dSopenharmony_ci            sa.set=set;
19212e5b6d6dSopenharmony_ci            uprv_getCharNameCharacters(&sa);
19222e5b6d6dSopenharmony_ci        }
19232e5b6d6dSopenharmony_ci
19242e5b6d6dSopenharmony_ci        /* build set the dumb (but sure-fire) way */
19252e5b6d6dSopenharmony_ci        for (i=0; i<256; ++i) {
19262e5b6d6dSopenharmony_ci            map[i] = false;
19272e5b6d6dSopenharmony_ci        }
19282e5b6d6dSopenharmony_ci
19292e5b6d6dSopenharmony_ci        maxLength=0;
19302e5b6d6dSopenharmony_ci        for (cp=0; cp<0x110000; ++cp) {
19312e5b6d6dSopenharmony_ci            int32_t len = u_charName(cp, U_EXTENDED_CHAR_NAME,
19322e5b6d6dSopenharmony_ci                                     buf, BUFSIZE, &ec);
19332e5b6d6dSopenharmony_ci            if (U_FAILURE(ec)) {
19342e5b6d6dSopenharmony_ci                log_err("FAIL: u_charName failed when it shouldn't\n");
19352e5b6d6dSopenharmony_ci                uset_close(set);
19362e5b6d6dSopenharmony_ci                uset_close(dumb);
19372e5b6d6dSopenharmony_ci                return;
19382e5b6d6dSopenharmony_ci            }
19392e5b6d6dSopenharmony_ci            if(len>maxLength) {
19402e5b6d6dSopenharmony_ci                maxLength=len;
19412e5b6d6dSopenharmony_ci            }
19422e5b6d6dSopenharmony_ci
19432e5b6d6dSopenharmony_ci            for (i=0; i<len; ++i) {
19442e5b6d6dSopenharmony_ci                if (!map[(uint8_t) buf[i]]) {
19452e5b6d6dSopenharmony_ci                    uset_add(dumb, (UChar32)u_charToUChar(buf[i]));
19462e5b6d6dSopenharmony_ci                    map[(uint8_t) buf[i]] = true;
19472e5b6d6dSopenharmony_ci                }
19482e5b6d6dSopenharmony_ci            }
19492e5b6d6dSopenharmony_ci
19502e5b6d6dSopenharmony_ci            /* test for leading/trailing whitespace */
19512e5b6d6dSopenharmony_ci            if(buf[0]==' ' || buf[0]=='\t' || buf[len-1]==' ' || buf[len-1]=='\t') {
19522e5b6d6dSopenharmony_ci                log_err("u_charName(U+%04x) returns a name with leading or trailing whitespace\n", cp);
19532e5b6d6dSopenharmony_ci            }
19542e5b6d6dSopenharmony_ci        }
19552e5b6d6dSopenharmony_ci
19562e5b6d6dSopenharmony_ci        if(map[(uint8_t)'\t']) {
19572e5b6d6dSopenharmony_ci            log_err("u_charName() returned a name with a TAB for some code point\n", cp);
19582e5b6d6dSopenharmony_ci        }
19592e5b6d6dSopenharmony_ci
19602e5b6d6dSopenharmony_ci        length=uprv_getMaxCharNameLength();
19612e5b6d6dSopenharmony_ci        if(length!=maxLength) {
19622e5b6d6dSopenharmony_ci            log_err("uprv_getMaxCharNameLength()=%d differs from the maximum length %d of all extended names\n",
19632e5b6d6dSopenharmony_ci                    length, maxLength);
19642e5b6d6dSopenharmony_ci        }
19652e5b6d6dSopenharmony_ci
19662e5b6d6dSopenharmony_ci        /* compare the sets.  Where is my uset_equals?!! */
19672e5b6d6dSopenharmony_ci        ok=true;
19682e5b6d6dSopenharmony_ci        for(i=0; i<256; ++i) {
19692e5b6d6dSopenharmony_ci            if(uset_contains(set, i)!=uset_contains(dumb, i)) {
19702e5b6d6dSopenharmony_ci                if(0x61<=i && i<=0x7a /* a-z */ && uset_contains(set, i) && !uset_contains(dumb, i)) {
19712e5b6d6dSopenharmony_ci                    /* ignore lowercase a-z that are in set but not in dumb */
19722e5b6d6dSopenharmony_ci                    ok=true;
19732e5b6d6dSopenharmony_ci                } else {
19742e5b6d6dSopenharmony_ci                    ok=false;
19752e5b6d6dSopenharmony_ci                    break;
19762e5b6d6dSopenharmony_ci                }
19772e5b6d6dSopenharmony_ci            }
19782e5b6d6dSopenharmony_ci        }
19792e5b6d6dSopenharmony_ci
19802e5b6d6dSopenharmony_ci        l1 = uset_toPattern(set, pat, BUFSIZE, true, &ec);
19812e5b6d6dSopenharmony_ci        l2 = uset_toPattern(dumb, dumbPat, BUFSIZE, true, &ec);
19822e5b6d6dSopenharmony_ci        if (U_FAILURE(ec)) {
19832e5b6d6dSopenharmony_ci            log_err("FAIL: uset_toPattern failed when it shouldn't\n");
19842e5b6d6dSopenharmony_ci            uset_close(set);
19852e5b6d6dSopenharmony_ci            uset_close(dumb);
19862e5b6d6dSopenharmony_ci            return;
19872e5b6d6dSopenharmony_ci        }
19882e5b6d6dSopenharmony_ci
19892e5b6d6dSopenharmony_ci        if (l1 >= BUFSIZE) {
19902e5b6d6dSopenharmony_ci            l1 = BUFSIZE-1;
19912e5b6d6dSopenharmony_ci            pat[l1] = 0;
19922e5b6d6dSopenharmony_ci        }
19932e5b6d6dSopenharmony_ci        if (l2 >= BUFSIZE) {
19942e5b6d6dSopenharmony_ci            l2 = BUFSIZE-1;
19952e5b6d6dSopenharmony_ci            dumbPat[l2] = 0;
19962e5b6d6dSopenharmony_ci        }
19972e5b6d6dSopenharmony_ci
19982e5b6d6dSopenharmony_ci        if (!ok) {
19992e5b6d6dSopenharmony_ci            log_err("FAIL: uprv_getCharNameCharacters() returned %s, expected %s (too many lowercase a-z are ok)\n",
20002e5b6d6dSopenharmony_ci                    aescstrdup(pat, l1), aescstrdup(dumbPat, l2));
20012e5b6d6dSopenharmony_ci        } else if(getTestOption(VERBOSITY_OPTION)) {
20022e5b6d6dSopenharmony_ci            log_verbose("Ok: uprv_getCharNameCharacters() returned %s\n", aescstrdup(pat, l1));
20032e5b6d6dSopenharmony_ci        }
20042e5b6d6dSopenharmony_ci
20052e5b6d6dSopenharmony_ci        uset_close(set);
20062e5b6d6dSopenharmony_ci        uset_close(dumb);
20072e5b6d6dSopenharmony_ci    }
20082e5b6d6dSopenharmony_ci
20092e5b6d6dSopenharmony_ci    /* ### TODO: test error cases and other interesting things */
20102e5b6d6dSopenharmony_ci}
20112e5b6d6dSopenharmony_ci
20122e5b6d6dSopenharmony_cistatic void
20132e5b6d6dSopenharmony_ciTestUCharFromNameUnderflow() {
20142e5b6d6dSopenharmony_ci    // Ticket #10889: Underflow crash when there is no dash.
20152e5b6d6dSopenharmony_ci    const char *name="<NO BREAK SPACE>";
20162e5b6d6dSopenharmony_ci    UErrorCode errorCode=U_ZERO_ERROR;
20172e5b6d6dSopenharmony_ci    UChar32 c=u_charFromName(U_EXTENDED_CHAR_NAME, name, &errorCode);
20182e5b6d6dSopenharmony_ci    if(U_SUCCESS(errorCode)) {
20192e5b6d6dSopenharmony_ci        log_err("u_charFromName(%s) = U+%04x but should fail - %s\n",
20202e5b6d6dSopenharmony_ci                name, c, u_errorName(errorCode));
20212e5b6d6dSopenharmony_ci    }
20222e5b6d6dSopenharmony_ci
20232e5b6d6dSopenharmony_ci    // Test related edge cases.
20242e5b6d6dSopenharmony_ci    name="<-00a0>";
20252e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
20262e5b6d6dSopenharmony_ci    c=u_charFromName(U_EXTENDED_CHAR_NAME, name, &errorCode);
20272e5b6d6dSopenharmony_ci    if(U_SUCCESS(errorCode)) {
20282e5b6d6dSopenharmony_ci        log_err("u_charFromName(%s) = U+%04x but should fail - %s\n",
20292e5b6d6dSopenharmony_ci                name, c, u_errorName(errorCode));
20302e5b6d6dSopenharmony_ci    }
20312e5b6d6dSopenharmony_ci
20322e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
20332e5b6d6dSopenharmony_ci    name="<control->";
20342e5b6d6dSopenharmony_ci    c=u_charFromName(U_EXTENDED_CHAR_NAME, name, &errorCode);
20352e5b6d6dSopenharmony_ci    if(U_SUCCESS(errorCode)) {
20362e5b6d6dSopenharmony_ci        log_err("u_charFromName(%s) = U+%04x but should fail - %s\n",
20372e5b6d6dSopenharmony_ci                name, c, u_errorName(errorCode));
20382e5b6d6dSopenharmony_ci    }
20392e5b6d6dSopenharmony_ci
20402e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
20412e5b6d6dSopenharmony_ci    name="<control-111111>";
20422e5b6d6dSopenharmony_ci    c=u_charFromName(U_EXTENDED_CHAR_NAME, name, &errorCode);
20432e5b6d6dSopenharmony_ci    if(U_SUCCESS(errorCode)) {
20442e5b6d6dSopenharmony_ci        log_err("u_charFromName(%s) = U+%04x but should fail - %s\n",
20452e5b6d6dSopenharmony_ci                name, c, u_errorName(errorCode));
20462e5b6d6dSopenharmony_ci    }
20472e5b6d6dSopenharmony_ci
20482e5b6d6dSopenharmony_ci    // ICU-20292: integer overflow
20492e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
20502e5b6d6dSopenharmony_ci    name="<noncharacter-10010FFFF>";
20512e5b6d6dSopenharmony_ci    c=u_charFromName(U_EXTENDED_CHAR_NAME, name, &errorCode);
20522e5b6d6dSopenharmony_ci    if(U_SUCCESS(errorCode)) {
20532e5b6d6dSopenharmony_ci        log_err("u_charFromName(%s) = U+%04x but should fail - %s\n",
20542e5b6d6dSopenharmony_ci                name, c, u_errorName(errorCode));
20552e5b6d6dSopenharmony_ci    }
20562e5b6d6dSopenharmony_ci
20572e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
20582e5b6d6dSopenharmony_ci    name="<noncharacter-00010FFFF>";  // too many digits even if only leading 0s
20592e5b6d6dSopenharmony_ci    c=u_charFromName(U_EXTENDED_CHAR_NAME, name, &errorCode);
20602e5b6d6dSopenharmony_ci    if(U_SUCCESS(errorCode)) {
20612e5b6d6dSopenharmony_ci        log_err("u_charFromName(%s) = U+%04x but should fail - %s\n",
20622e5b6d6dSopenharmony_ci                name, c, u_errorName(errorCode));
20632e5b6d6dSopenharmony_ci    }
20642e5b6d6dSopenharmony_ci
20652e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
20662e5b6d6dSopenharmony_ci    name="<noncharacter-fFFf>>";
20672e5b6d6dSopenharmony_ci    c=u_charFromName(U_EXTENDED_CHAR_NAME, name, &errorCode);
20682e5b6d6dSopenharmony_ci    if(U_SUCCESS(errorCode)) {
20692e5b6d6dSopenharmony_ci        log_err("u_charFromName(%s) = U+%04x but should fail - %s\n",
20702e5b6d6dSopenharmony_ci                name, c, u_errorName(errorCode));
20712e5b6d6dSopenharmony_ci    }
20722e5b6d6dSopenharmony_ci}
20732e5b6d6dSopenharmony_ci
20742e5b6d6dSopenharmony_ci/* test u_isMirrored() and u_charMirror() ----------------------------------- */
20752e5b6d6dSopenharmony_ci
20762e5b6d6dSopenharmony_cistatic void
20772e5b6d6dSopenharmony_ciTestMirroring() {
20782e5b6d6dSopenharmony_ci    USet *set;
20792e5b6d6dSopenharmony_ci    UErrorCode errorCode;
20802e5b6d6dSopenharmony_ci
20812e5b6d6dSopenharmony_ci    UChar32 start, end, c2, c3;
20822e5b6d6dSopenharmony_ci    int32_t i;
20832e5b6d6dSopenharmony_ci
20842e5b6d6dSopenharmony_ci    U_STRING_DECL(mirroredPattern, "[:Bidi_Mirrored:]", 17);
20852e5b6d6dSopenharmony_ci
20862e5b6d6dSopenharmony_ci    U_STRING_INIT(mirroredPattern, "[:Bidi_Mirrored:]", 17);
20872e5b6d6dSopenharmony_ci
20882e5b6d6dSopenharmony_ci    log_verbose("Testing u_isMirrored()\n");
20892e5b6d6dSopenharmony_ci    if(!(u_isMirrored(0x28) && u_isMirrored(0xbb) && u_isMirrored(0x2045) && u_isMirrored(0x232a) &&
20902e5b6d6dSopenharmony_ci         !u_isMirrored(0x27) && !u_isMirrored(0x61) && !u_isMirrored(0x284) && !u_isMirrored(0x3400)
20912e5b6d6dSopenharmony_ci        )
20922e5b6d6dSopenharmony_ci    ) {
20932e5b6d6dSopenharmony_ci        log_err("u_isMirrored() does not work correctly\n");
20942e5b6d6dSopenharmony_ci    }
20952e5b6d6dSopenharmony_ci
20962e5b6d6dSopenharmony_ci    log_verbose("Testing u_charMirror()\n");
20972e5b6d6dSopenharmony_ci    if(!(u_charMirror(0x3c)==0x3e && u_charMirror(0x5d)==0x5b && u_charMirror(0x208d)==0x208e && u_charMirror(0x3017)==0x3016 &&
20982e5b6d6dSopenharmony_ci         u_charMirror(0xbb)==0xab && u_charMirror(0x2215)==0x29F5 && u_charMirror(0x29F5)==0x2215 && /* large delta between the code points */
20992e5b6d6dSopenharmony_ci         u_charMirror(0x2e)==0x2e && u_charMirror(0x6f3)==0x6f3 && u_charMirror(0x301c)==0x301c && u_charMirror(0xa4ab)==0xa4ab &&
21002e5b6d6dSopenharmony_ci         /* see Unicode Corrigendum #6 at http://www.unicode.org/versions/corrigendum6.html */
21012e5b6d6dSopenharmony_ci         u_charMirror(0x2018)==0x2018 && u_charMirror(0x201b)==0x201b && u_charMirror(0x301d)==0x301d
21022e5b6d6dSopenharmony_ci         )
21032e5b6d6dSopenharmony_ci    ) {
21042e5b6d6dSopenharmony_ci        log_err("u_charMirror() does not work correctly\n");
21052e5b6d6dSopenharmony_ci    }
21062e5b6d6dSopenharmony_ci
21072e5b6d6dSopenharmony_ci    /* verify that Bidi_Mirroring_Glyph roundtrips */
21082e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
21092e5b6d6dSopenharmony_ci    set=uset_openPattern(mirroredPattern, 17, &errorCode);
21102e5b6d6dSopenharmony_ci
21112e5b6d6dSopenharmony_ci    if (U_FAILURE(errorCode)) {
21122e5b6d6dSopenharmony_ci        log_data_err("uset_openPattern(mirroredPattern, 17, &errorCode) failed!\n");
21132e5b6d6dSopenharmony_ci    } else {
21142e5b6d6dSopenharmony_ci        for(i=0; 0==uset_getItem(set, i, &start, &end, NULL, 0, &errorCode); ++i) {
21152e5b6d6dSopenharmony_ci            do {
21162e5b6d6dSopenharmony_ci                c2=u_charMirror(start);
21172e5b6d6dSopenharmony_ci                c3=u_charMirror(c2);
21182e5b6d6dSopenharmony_ci                if(c3!=start) {
21192e5b6d6dSopenharmony_ci                    log_err("u_charMirror() does not roundtrip: U+%04lx->U+%04lx->U+%04lx\n", (long)start, (long)c2, (long)c3);
21202e5b6d6dSopenharmony_ci                }
21212e5b6d6dSopenharmony_ci                c3=u_getBidiPairedBracket(start);
21222e5b6d6dSopenharmony_ci                if(u_getIntPropertyValue(start, UCHAR_BIDI_PAIRED_BRACKET_TYPE)==U_BPT_NONE) {
21232e5b6d6dSopenharmony_ci                    if(c3!=start) {
21242e5b6d6dSopenharmony_ci                        log_err("u_getBidiPairedBracket(U+%04lx) != self for bpt(c)==None\n",
21252e5b6d6dSopenharmony_ci                                (long)start);
21262e5b6d6dSopenharmony_ci                    }
21272e5b6d6dSopenharmony_ci                } else {
21282e5b6d6dSopenharmony_ci                    if(c3!=c2) {
21292e5b6d6dSopenharmony_ci                        log_err("u_getBidiPairedBracket(U+%04lx) != U+%04lx = bmg(c)'\n",
21302e5b6d6dSopenharmony_ci                                (long)start, (long)c2);
21312e5b6d6dSopenharmony_ci                    }
21322e5b6d6dSopenharmony_ci                }
21332e5b6d6dSopenharmony_ci            } while(++start<=end);
21342e5b6d6dSopenharmony_ci        }
21352e5b6d6dSopenharmony_ci    }
21362e5b6d6dSopenharmony_ci
21372e5b6d6dSopenharmony_ci    uset_close(set);
21382e5b6d6dSopenharmony_ci}
21392e5b6d6dSopenharmony_ci
21402e5b6d6dSopenharmony_ci
21412e5b6d6dSopenharmony_cistruct RunTestData
21422e5b6d6dSopenharmony_ci{
21432e5b6d6dSopenharmony_ci    const char *runText;
21442e5b6d6dSopenharmony_ci    UScriptCode runCode;
21452e5b6d6dSopenharmony_ci};
21462e5b6d6dSopenharmony_ci
21472e5b6d6dSopenharmony_citypedef struct RunTestData RunTestData;
21482e5b6d6dSopenharmony_ci
21492e5b6d6dSopenharmony_cistatic void
21502e5b6d6dSopenharmony_ciCheckScriptRuns(UScriptRun *scriptRun, int32_t *runStarts, const RunTestData *testData, int32_t nRuns,
21512e5b6d6dSopenharmony_ci                const char *prefix)
21522e5b6d6dSopenharmony_ci{
21532e5b6d6dSopenharmony_ci    int32_t run, runStart, runLimit;
21542e5b6d6dSopenharmony_ci    UScriptCode runCode;
21552e5b6d6dSopenharmony_ci
21562e5b6d6dSopenharmony_ci    /* iterate over all the runs */
21572e5b6d6dSopenharmony_ci    run = 0;
21582e5b6d6dSopenharmony_ci    while (uscript_nextRun(scriptRun, &runStart, &runLimit, &runCode)) {
21592e5b6d6dSopenharmony_ci        if (runStart != runStarts[run]) {
21602e5b6d6dSopenharmony_ci            log_err("%s: incorrect start offset for run %d: expected %d, got %d\n",
21612e5b6d6dSopenharmony_ci                prefix, run, runStarts[run], runStart);
21622e5b6d6dSopenharmony_ci        }
21632e5b6d6dSopenharmony_ci
21642e5b6d6dSopenharmony_ci        if (runLimit != runStarts[run + 1]) {
21652e5b6d6dSopenharmony_ci            log_err("%s: incorrect limit offset for run %d: expected %d, got %d\n",
21662e5b6d6dSopenharmony_ci                prefix, run, runStarts[run + 1], runLimit);
21672e5b6d6dSopenharmony_ci        }
21682e5b6d6dSopenharmony_ci
21692e5b6d6dSopenharmony_ci        if (runCode != testData[run].runCode) {
21702e5b6d6dSopenharmony_ci            log_err("%s: incorrect script for run %d: expected \"%s\", got \"%s\"\n",
21712e5b6d6dSopenharmony_ci                prefix, run, uscript_getName(testData[run].runCode), uscript_getName(runCode));
21722e5b6d6dSopenharmony_ci        }
21732e5b6d6dSopenharmony_ci
21742e5b6d6dSopenharmony_ci        run += 1;
21752e5b6d6dSopenharmony_ci
21762e5b6d6dSopenharmony_ci        /* stop when we've seen all the runs we expect to see */
21772e5b6d6dSopenharmony_ci        if (run >= nRuns) {
21782e5b6d6dSopenharmony_ci            break;
21792e5b6d6dSopenharmony_ci        }
21802e5b6d6dSopenharmony_ci    }
21812e5b6d6dSopenharmony_ci
21822e5b6d6dSopenharmony_ci    /* Complain if we didn't see then number of runs we expected */
21832e5b6d6dSopenharmony_ci    if (run != nRuns) {
21842e5b6d6dSopenharmony_ci        log_err("%s: incorrect number of runs: expected %d, got %d\n", prefix, run, nRuns);
21852e5b6d6dSopenharmony_ci    }
21862e5b6d6dSopenharmony_ci}
21872e5b6d6dSopenharmony_ci
21882e5b6d6dSopenharmony_cistatic void
21892e5b6d6dSopenharmony_ciTestUScriptRunAPI()
21902e5b6d6dSopenharmony_ci{
21912e5b6d6dSopenharmony_ci    static const RunTestData testData1[] = {
21922e5b6d6dSopenharmony_ci        {"\\u0020\\u0946\\u0939\\u093F\\u0928\\u094D\\u0926\\u0940\\u0020", USCRIPT_DEVANAGARI},
21932e5b6d6dSopenharmony_ci        {"\\u0627\\u0644\\u0639\\u0631\\u0628\\u064A\\u0629\\u0020", USCRIPT_ARABIC},
21942e5b6d6dSopenharmony_ci        {"\\u0420\\u0443\\u0441\\u0441\\u043A\\u0438\\u0439\\u0020", USCRIPT_CYRILLIC},
21952e5b6d6dSopenharmony_ci        {"English (", USCRIPT_LATIN},
21962e5b6d6dSopenharmony_ci        {"\\u0E44\\u0E17\\u0E22", USCRIPT_THAI},
21972e5b6d6dSopenharmony_ci        {") ", USCRIPT_LATIN},
21982e5b6d6dSopenharmony_ci        {"\\u6F22\\u5B75", USCRIPT_HAN},
21992e5b6d6dSopenharmony_ci        {"\\u3068\\u3072\\u3089\\u304C\\u306A\\u3068", USCRIPT_HIRAGANA},
22002e5b6d6dSopenharmony_ci        {"\\u30AB\\u30BF\\u30AB\\u30CA", USCRIPT_KATAKANA},
22012e5b6d6dSopenharmony_ci        {"\\U00010400\\U00010401\\U00010402\\U00010403", USCRIPT_DESERET}
22022e5b6d6dSopenharmony_ci    };
22032e5b6d6dSopenharmony_ci
22042e5b6d6dSopenharmony_ci    static const RunTestData testData2[] = {
22052e5b6d6dSopenharmony_ci       {"((((((((((abc))))))))))", USCRIPT_LATIN}
22062e5b6d6dSopenharmony_ci    };
22072e5b6d6dSopenharmony_ci
22082e5b6d6dSopenharmony_ci    static const struct {
22092e5b6d6dSopenharmony_ci      const RunTestData *testData;
22102e5b6d6dSopenharmony_ci      int32_t nRuns;
22112e5b6d6dSopenharmony_ci    } testDataEntries[] = {
22122e5b6d6dSopenharmony_ci        {testData1, UPRV_LENGTHOF(testData1)},
22132e5b6d6dSopenharmony_ci        {testData2, UPRV_LENGTHOF(testData2)}
22142e5b6d6dSopenharmony_ci    };
22152e5b6d6dSopenharmony_ci
22162e5b6d6dSopenharmony_ci    static const int32_t nTestEntries = UPRV_LENGTHOF(testDataEntries);
22172e5b6d6dSopenharmony_ci    int32_t testEntry;
22182e5b6d6dSopenharmony_ci
22192e5b6d6dSopenharmony_ci    for (testEntry = 0; testEntry < nTestEntries; testEntry += 1) {
22202e5b6d6dSopenharmony_ci        UChar testString[1024];
22212e5b6d6dSopenharmony_ci        int32_t runStarts[256];
22222e5b6d6dSopenharmony_ci        int32_t nTestRuns = testDataEntries[testEntry].nRuns;
22232e5b6d6dSopenharmony_ci        const RunTestData *testData = testDataEntries[testEntry].testData;
22242e5b6d6dSopenharmony_ci
22252e5b6d6dSopenharmony_ci        int32_t run, stringLimit;
22262e5b6d6dSopenharmony_ci        UScriptRun *scriptRun = NULL;
22272e5b6d6dSopenharmony_ci        UErrorCode err;
22282e5b6d6dSopenharmony_ci
22292e5b6d6dSopenharmony_ci        /*
22302e5b6d6dSopenharmony_ci         * Fill in the test string and the runStarts array.
22312e5b6d6dSopenharmony_ci         */
22322e5b6d6dSopenharmony_ci        stringLimit = 0;
22332e5b6d6dSopenharmony_ci        for (run = 0; run < nTestRuns; run += 1) {
22342e5b6d6dSopenharmony_ci            runStarts[run] = stringLimit;
22352e5b6d6dSopenharmony_ci            stringLimit += u_unescape(testData[run].runText, &testString[stringLimit], 1024 - stringLimit);
22362e5b6d6dSopenharmony_ci            /*stringLimit -= 1;*/
22372e5b6d6dSopenharmony_ci        }
22382e5b6d6dSopenharmony_ci
22392e5b6d6dSopenharmony_ci        /* The limit of the last run */
22402e5b6d6dSopenharmony_ci        runStarts[nTestRuns] = stringLimit;
22412e5b6d6dSopenharmony_ci
22422e5b6d6dSopenharmony_ci        /*
22432e5b6d6dSopenharmony_ci         * Make sure that calling uscript_OpenRun with a NULL text pointer
22442e5b6d6dSopenharmony_ci         * and a non-zero text length returns the correct error.
22452e5b6d6dSopenharmony_ci         */
22462e5b6d6dSopenharmony_ci        err = U_ZERO_ERROR;
22472e5b6d6dSopenharmony_ci        scriptRun = uscript_openRun(NULL, stringLimit, &err);
22482e5b6d6dSopenharmony_ci
22492e5b6d6dSopenharmony_ci        if (err != U_ILLEGAL_ARGUMENT_ERROR) {
22502e5b6d6dSopenharmony_ci            log_err("uscript_openRun(NULL, stringLimit, &err) returned %s instead of U_ILLEGAL_ARGUMENT_ERROR.\n", u_errorName(err));
22512e5b6d6dSopenharmony_ci        }
22522e5b6d6dSopenharmony_ci
22532e5b6d6dSopenharmony_ci        if (scriptRun != NULL) {
22542e5b6d6dSopenharmony_ci            log_err("uscript_openRun(NULL, stringLimit, &err) returned a non-NULL result.\n");
22552e5b6d6dSopenharmony_ci            uscript_closeRun(scriptRun);
22562e5b6d6dSopenharmony_ci        }
22572e5b6d6dSopenharmony_ci
22582e5b6d6dSopenharmony_ci        /*
22592e5b6d6dSopenharmony_ci         * Make sure that calling uscript_OpenRun with a non-NULL text pointer
22602e5b6d6dSopenharmony_ci         * and a zero text length returns the correct error.
22612e5b6d6dSopenharmony_ci         */
22622e5b6d6dSopenharmony_ci        err = U_ZERO_ERROR;
22632e5b6d6dSopenharmony_ci        scriptRun = uscript_openRun(testString, 0, &err);
22642e5b6d6dSopenharmony_ci
22652e5b6d6dSopenharmony_ci        if (err != U_ILLEGAL_ARGUMENT_ERROR) {
22662e5b6d6dSopenharmony_ci            log_err("uscript_openRun(testString, 0, &err) returned %s instead of U_ILLEGAL_ARGUMENT_ERROR.\n", u_errorName(err));
22672e5b6d6dSopenharmony_ci        }
22682e5b6d6dSopenharmony_ci
22692e5b6d6dSopenharmony_ci        if (scriptRun != NULL) {
22702e5b6d6dSopenharmony_ci            log_err("uscript_openRun(testString, 0, &err) returned a non-NULL result.\n");
22712e5b6d6dSopenharmony_ci            uscript_closeRun(scriptRun);
22722e5b6d6dSopenharmony_ci        }
22732e5b6d6dSopenharmony_ci
22742e5b6d6dSopenharmony_ci        /*
22752e5b6d6dSopenharmony_ci         * Make sure that calling uscript_openRun with a NULL text pointer
22762e5b6d6dSopenharmony_ci         * and a zero text length doesn't return an error.
22772e5b6d6dSopenharmony_ci         */
22782e5b6d6dSopenharmony_ci        err = U_ZERO_ERROR;
22792e5b6d6dSopenharmony_ci        scriptRun = uscript_openRun(NULL, 0, &err);
22802e5b6d6dSopenharmony_ci
22812e5b6d6dSopenharmony_ci        if (U_FAILURE(err)) {
22822e5b6d6dSopenharmony_ci            log_err("Got error %s from uscript_openRun(NULL, 0, &err)\n", u_errorName(err));
22832e5b6d6dSopenharmony_ci        }
22842e5b6d6dSopenharmony_ci
22852e5b6d6dSopenharmony_ci        /* Make sure that the empty iterator doesn't find any runs */
22862e5b6d6dSopenharmony_ci        if (uscript_nextRun(scriptRun, NULL, NULL, NULL)) {
22872e5b6d6dSopenharmony_ci            log_err("uscript_nextRun(...) returned true for an empty iterator.\n");
22882e5b6d6dSopenharmony_ci        }
22892e5b6d6dSopenharmony_ci
22902e5b6d6dSopenharmony_ci        /*
22912e5b6d6dSopenharmony_ci         * Make sure that calling uscript_setRunText with a NULL text pointer
22922e5b6d6dSopenharmony_ci         * and a non-zero text length returns the correct error.
22932e5b6d6dSopenharmony_ci         */
22942e5b6d6dSopenharmony_ci        err = U_ZERO_ERROR;
22952e5b6d6dSopenharmony_ci        uscript_setRunText(scriptRun, NULL, stringLimit, &err);
22962e5b6d6dSopenharmony_ci
22972e5b6d6dSopenharmony_ci        if (err != U_ILLEGAL_ARGUMENT_ERROR) {
22982e5b6d6dSopenharmony_ci            log_err("uscript_setRunText(scriptRun, NULL, stringLimit, &err) returned %s instead of U_ILLEGAL_ARGUMENT_ERROR.\n", u_errorName(err));
22992e5b6d6dSopenharmony_ci        }
23002e5b6d6dSopenharmony_ci
23012e5b6d6dSopenharmony_ci        /*
23022e5b6d6dSopenharmony_ci         * Make sure that calling uscript_OpenRun with a non-NULL text pointer
23032e5b6d6dSopenharmony_ci         * and a zero text length returns the correct error.
23042e5b6d6dSopenharmony_ci         */
23052e5b6d6dSopenharmony_ci        err = U_ZERO_ERROR;
23062e5b6d6dSopenharmony_ci        uscript_setRunText(scriptRun, testString, 0, &err);
23072e5b6d6dSopenharmony_ci
23082e5b6d6dSopenharmony_ci        if (err != U_ILLEGAL_ARGUMENT_ERROR) {
23092e5b6d6dSopenharmony_ci            log_err("uscript_setRunText(scriptRun, testString, 0, &err) returned %s instead of U_ILLEGAL_ARGUMENT_ERROR.\n", u_errorName(err));
23102e5b6d6dSopenharmony_ci        }
23112e5b6d6dSopenharmony_ci
23122e5b6d6dSopenharmony_ci        /*
23132e5b6d6dSopenharmony_ci         * Now call uscript_setRunText on the empty iterator
23142e5b6d6dSopenharmony_ci         * and make sure that it works.
23152e5b6d6dSopenharmony_ci         */
23162e5b6d6dSopenharmony_ci        err = U_ZERO_ERROR;
23172e5b6d6dSopenharmony_ci        uscript_setRunText(scriptRun, testString, stringLimit, &err);
23182e5b6d6dSopenharmony_ci
23192e5b6d6dSopenharmony_ci        if (U_FAILURE(err)) {
23202e5b6d6dSopenharmony_ci            log_err("Got error %s from uscript_setRunText(...)\n", u_errorName(err));
23212e5b6d6dSopenharmony_ci        } else {
23222e5b6d6dSopenharmony_ci            CheckScriptRuns(scriptRun, runStarts, testData, nTestRuns, "uscript_setRunText");
23232e5b6d6dSopenharmony_ci        }
23242e5b6d6dSopenharmony_ci
23252e5b6d6dSopenharmony_ci        uscript_closeRun(scriptRun);
23262e5b6d6dSopenharmony_ci
23272e5b6d6dSopenharmony_ci        /*
23282e5b6d6dSopenharmony_ci         * Now open an iterator over the testString
23292e5b6d6dSopenharmony_ci         * using uscript_openRun and make sure that it works
23302e5b6d6dSopenharmony_ci         */
23312e5b6d6dSopenharmony_ci        scriptRun = uscript_openRun(testString, stringLimit, &err);
23322e5b6d6dSopenharmony_ci
23332e5b6d6dSopenharmony_ci        if (U_FAILURE(err)) {
23342e5b6d6dSopenharmony_ci            log_err("Got error %s from uscript_openRun(...)\n", u_errorName(err));
23352e5b6d6dSopenharmony_ci        } else {
23362e5b6d6dSopenharmony_ci            CheckScriptRuns(scriptRun, runStarts, testData, nTestRuns, "uscript_openRun");
23372e5b6d6dSopenharmony_ci        }
23382e5b6d6dSopenharmony_ci
23392e5b6d6dSopenharmony_ci        /* Now reset the iterator, and make sure
23402e5b6d6dSopenharmony_ci         * that it still works.
23412e5b6d6dSopenharmony_ci         */
23422e5b6d6dSopenharmony_ci        uscript_resetRun(scriptRun);
23432e5b6d6dSopenharmony_ci
23442e5b6d6dSopenharmony_ci        CheckScriptRuns(scriptRun, runStarts, testData, nTestRuns, "uscript_resetRun");
23452e5b6d6dSopenharmony_ci
23462e5b6d6dSopenharmony_ci        /* Close the iterator */
23472e5b6d6dSopenharmony_ci        uscript_closeRun(scriptRun);
23482e5b6d6dSopenharmony_ci    }
23492e5b6d6dSopenharmony_ci}
23502e5b6d6dSopenharmony_ci
23512e5b6d6dSopenharmony_ci/* test additional, non-core properties */
23522e5b6d6dSopenharmony_cistatic void
23532e5b6d6dSopenharmony_ciTestAdditionalProperties() {
23542e5b6d6dSopenharmony_ci    /* test data for u_charAge() */
23552e5b6d6dSopenharmony_ci    static const struct {
23562e5b6d6dSopenharmony_ci        UChar32 c;
23572e5b6d6dSopenharmony_ci        UVersionInfo version;
23582e5b6d6dSopenharmony_ci    } charAges[]={
23592e5b6d6dSopenharmony_ci        {0x41,    { 1, 1, 0, 0 }},
23602e5b6d6dSopenharmony_ci        {0xffff,  { 1, 1, 0, 0 }},
23612e5b6d6dSopenharmony_ci        {0x20ab,  { 2, 0, 0, 0 }},
23622e5b6d6dSopenharmony_ci        {0x2fffe, { 2, 0, 0, 0 }},
23632e5b6d6dSopenharmony_ci        {0x20ac,  { 2, 1, 0, 0 }},
23642e5b6d6dSopenharmony_ci        {0xfb1d,  { 3, 0, 0, 0 }},
23652e5b6d6dSopenharmony_ci        {0x3f4,   { 3, 1, 0, 0 }},
23662e5b6d6dSopenharmony_ci        {0x10300, { 3, 1, 0, 0 }},
23672e5b6d6dSopenharmony_ci        {0x220,   { 3, 2, 0, 0 }},
23682e5b6d6dSopenharmony_ci        {0xff60,  { 3, 2, 0, 0 }}
23692e5b6d6dSopenharmony_ci    };
23702e5b6d6dSopenharmony_ci
23712e5b6d6dSopenharmony_ci    /* test data for u_hasBinaryProperty() */
23722e5b6d6dSopenharmony_ci    static const int32_t
23732e5b6d6dSopenharmony_ci    props[][3]={ /* code point, property, value */
23742e5b6d6dSopenharmony_ci        { 0x0627, UCHAR_ALPHABETIC, true },
23752e5b6d6dSopenharmony_ci        { 0x1034a, UCHAR_ALPHABETIC, true },
23762e5b6d6dSopenharmony_ci        { 0x2028, UCHAR_ALPHABETIC, false },
23772e5b6d6dSopenharmony_ci
23782e5b6d6dSopenharmony_ci        { 0x0066, UCHAR_ASCII_HEX_DIGIT, true },
23792e5b6d6dSopenharmony_ci        { 0x0067, UCHAR_ASCII_HEX_DIGIT, false },
23802e5b6d6dSopenharmony_ci
23812e5b6d6dSopenharmony_ci        { 0x202c, UCHAR_BIDI_CONTROL, true },
23822e5b6d6dSopenharmony_ci        { 0x202f, UCHAR_BIDI_CONTROL, false },
23832e5b6d6dSopenharmony_ci
23842e5b6d6dSopenharmony_ci        { 0x003c, UCHAR_BIDI_MIRRORED, true },
23852e5b6d6dSopenharmony_ci        { 0x003d, UCHAR_BIDI_MIRRORED, false },
23862e5b6d6dSopenharmony_ci
23872e5b6d6dSopenharmony_ci        /* see Unicode Corrigendum #6 at http://www.unicode.org/versions/corrigendum6.html */
23882e5b6d6dSopenharmony_ci        { 0x2018, UCHAR_BIDI_MIRRORED, false },
23892e5b6d6dSopenharmony_ci        { 0x201d, UCHAR_BIDI_MIRRORED, false },
23902e5b6d6dSopenharmony_ci        { 0x201f, UCHAR_BIDI_MIRRORED, false },
23912e5b6d6dSopenharmony_ci        { 0x301e, UCHAR_BIDI_MIRRORED, false },
23922e5b6d6dSopenharmony_ci
23932e5b6d6dSopenharmony_ci        { 0x058a, UCHAR_DASH, true },
23942e5b6d6dSopenharmony_ci        { 0x007e, UCHAR_DASH, false },
23952e5b6d6dSopenharmony_ci
23962e5b6d6dSopenharmony_ci        { 0x0c4d, UCHAR_DIACRITIC, true },
23972e5b6d6dSopenharmony_ci        { 0x3000, UCHAR_DIACRITIC, false },
23982e5b6d6dSopenharmony_ci
23992e5b6d6dSopenharmony_ci        { 0x0e46, UCHAR_EXTENDER, true },
24002e5b6d6dSopenharmony_ci        { 0x0020, UCHAR_EXTENDER, false },
24012e5b6d6dSopenharmony_ci
24022e5b6d6dSopenharmony_ci#if !UCONFIG_NO_NORMALIZATION
24032e5b6d6dSopenharmony_ci        { 0xfb1d, UCHAR_FULL_COMPOSITION_EXCLUSION, true },
24042e5b6d6dSopenharmony_ci        { 0x1d15f, UCHAR_FULL_COMPOSITION_EXCLUSION, true },
24052e5b6d6dSopenharmony_ci        { 0xfb1e, UCHAR_FULL_COMPOSITION_EXCLUSION, false },
24062e5b6d6dSopenharmony_ci
24072e5b6d6dSopenharmony_ci        { 0x110a, UCHAR_NFD_INERT, true },      /* Jamo L */
24082e5b6d6dSopenharmony_ci        { 0x0308, UCHAR_NFD_INERT, false },
24092e5b6d6dSopenharmony_ci
24102e5b6d6dSopenharmony_ci        { 0x1164, UCHAR_NFKD_INERT, true },     /* Jamo V */
24112e5b6d6dSopenharmony_ci        { 0x1d79d, UCHAR_NFKD_INERT, false },   /* math compat version of xi */
24122e5b6d6dSopenharmony_ci
24132e5b6d6dSopenharmony_ci        { 0x0021, UCHAR_NFC_INERT, true },      /* ! */
24142e5b6d6dSopenharmony_ci        { 0x0061, UCHAR_NFC_INERT, false },     /* a */
24152e5b6d6dSopenharmony_ci        { 0x00e4, UCHAR_NFC_INERT, false },     /* a-umlaut */
24162e5b6d6dSopenharmony_ci        { 0x0102, UCHAR_NFC_INERT, false },     /* a-breve */
24172e5b6d6dSopenharmony_ci        { 0xac1c, UCHAR_NFC_INERT, false },     /* Hangul LV */
24182e5b6d6dSopenharmony_ci        { 0xac1d, UCHAR_NFC_INERT, true },      /* Hangul LVT */
24192e5b6d6dSopenharmony_ci
24202e5b6d6dSopenharmony_ci        { 0x1d79d, UCHAR_NFKC_INERT, false },   /* math compat version of xi */
24212e5b6d6dSopenharmony_ci        { 0x2a6d6, UCHAR_NFKC_INERT, true },    /* Han, last of CJK ext. B */
24222e5b6d6dSopenharmony_ci
24232e5b6d6dSopenharmony_ci        { 0x00e4, UCHAR_SEGMENT_STARTER, true },
24242e5b6d6dSopenharmony_ci        { 0x0308, UCHAR_SEGMENT_STARTER, false },
24252e5b6d6dSopenharmony_ci        { 0x110a, UCHAR_SEGMENT_STARTER, true }, /* Jamo L */
24262e5b6d6dSopenharmony_ci        { 0x1164, UCHAR_SEGMENT_STARTER, false },/* Jamo V */
24272e5b6d6dSopenharmony_ci        { 0xac1c, UCHAR_SEGMENT_STARTER, true }, /* Hangul LV */
24282e5b6d6dSopenharmony_ci        { 0xac1d, UCHAR_SEGMENT_STARTER, true }, /* Hangul LVT */
24292e5b6d6dSopenharmony_ci#endif
24302e5b6d6dSopenharmony_ci
24312e5b6d6dSopenharmony_ci        { 0x0044, UCHAR_HEX_DIGIT, true },
24322e5b6d6dSopenharmony_ci        { 0xff46, UCHAR_HEX_DIGIT, true },
24332e5b6d6dSopenharmony_ci        { 0x0047, UCHAR_HEX_DIGIT, false },
24342e5b6d6dSopenharmony_ci
24352e5b6d6dSopenharmony_ci        { 0x30fb, UCHAR_HYPHEN, true },
24362e5b6d6dSopenharmony_ci        { 0xfe58, UCHAR_HYPHEN, false },
24372e5b6d6dSopenharmony_ci
24382e5b6d6dSopenharmony_ci        { 0x2172, UCHAR_ID_CONTINUE, true },
24392e5b6d6dSopenharmony_ci        { 0x0307, UCHAR_ID_CONTINUE, true },
24402e5b6d6dSopenharmony_ci        { 0x005c, UCHAR_ID_CONTINUE, false },
24412e5b6d6dSopenharmony_ci
24422e5b6d6dSopenharmony_ci        { 0x2172, UCHAR_ID_START, true },
24432e5b6d6dSopenharmony_ci        { 0x007a, UCHAR_ID_START, true },
24442e5b6d6dSopenharmony_ci        { 0x0039, UCHAR_ID_START, false },
24452e5b6d6dSopenharmony_ci
24462e5b6d6dSopenharmony_ci        { 0x4db5, UCHAR_IDEOGRAPHIC, true },
24472e5b6d6dSopenharmony_ci        { 0x2f999, UCHAR_IDEOGRAPHIC, true },
24482e5b6d6dSopenharmony_ci        { 0x2f99, UCHAR_IDEOGRAPHIC, false },
24492e5b6d6dSopenharmony_ci
24502e5b6d6dSopenharmony_ci        { 0x200c, UCHAR_JOIN_CONTROL, true },
24512e5b6d6dSopenharmony_ci        { 0x2029, UCHAR_JOIN_CONTROL, false },
24522e5b6d6dSopenharmony_ci
24532e5b6d6dSopenharmony_ci        { 0x1d7bc, UCHAR_LOWERCASE, true },
24542e5b6d6dSopenharmony_ci        { 0x0345, UCHAR_LOWERCASE, true },
24552e5b6d6dSopenharmony_ci        { 0x0030, UCHAR_LOWERCASE, false },
24562e5b6d6dSopenharmony_ci
24572e5b6d6dSopenharmony_ci        { 0x1d7a9, UCHAR_MATH, true },
24582e5b6d6dSopenharmony_ci        { 0x2135, UCHAR_MATH, true },
24592e5b6d6dSopenharmony_ci        { 0x0062, UCHAR_MATH, false },
24602e5b6d6dSopenharmony_ci
24612e5b6d6dSopenharmony_ci        { 0xfde1, UCHAR_NONCHARACTER_CODE_POINT, true },
24622e5b6d6dSopenharmony_ci        { 0x10ffff, UCHAR_NONCHARACTER_CODE_POINT, true },
24632e5b6d6dSopenharmony_ci        { 0x10fffd, UCHAR_NONCHARACTER_CODE_POINT, false },
24642e5b6d6dSopenharmony_ci
24652e5b6d6dSopenharmony_ci        { 0x0022, UCHAR_QUOTATION_MARK, true },
24662e5b6d6dSopenharmony_ci        { 0xff62, UCHAR_QUOTATION_MARK, true },
24672e5b6d6dSopenharmony_ci        { 0xd840, UCHAR_QUOTATION_MARK, false },
24682e5b6d6dSopenharmony_ci
24692e5b6d6dSopenharmony_ci        { 0x061f, UCHAR_TERMINAL_PUNCTUATION, true },
24702e5b6d6dSopenharmony_ci        { 0xe003f, UCHAR_TERMINAL_PUNCTUATION, false },
24712e5b6d6dSopenharmony_ci
24722e5b6d6dSopenharmony_ci        { 0x1d44a, UCHAR_UPPERCASE, true },
24732e5b6d6dSopenharmony_ci        { 0x2162, UCHAR_UPPERCASE, true },
24742e5b6d6dSopenharmony_ci        { 0x0345, UCHAR_UPPERCASE, false },
24752e5b6d6dSopenharmony_ci
24762e5b6d6dSopenharmony_ci        { 0x0020, UCHAR_WHITE_SPACE, true },
24772e5b6d6dSopenharmony_ci        { 0x202f, UCHAR_WHITE_SPACE, true },
24782e5b6d6dSopenharmony_ci        { 0x3001, UCHAR_WHITE_SPACE, false },
24792e5b6d6dSopenharmony_ci
24802e5b6d6dSopenharmony_ci        { 0x0711, UCHAR_XID_CONTINUE, true },
24812e5b6d6dSopenharmony_ci        { 0x1d1aa, UCHAR_XID_CONTINUE, true },
24822e5b6d6dSopenharmony_ci        { 0x007c, UCHAR_XID_CONTINUE, false },
24832e5b6d6dSopenharmony_ci
24842e5b6d6dSopenharmony_ci        { 0x16ee, UCHAR_XID_START, true },
24852e5b6d6dSopenharmony_ci        { 0x23456, UCHAR_XID_START, true },
24862e5b6d6dSopenharmony_ci        { 0x1d1aa, UCHAR_XID_START, false },
24872e5b6d6dSopenharmony_ci
24882e5b6d6dSopenharmony_ci        /*
24892e5b6d6dSopenharmony_ci         * Version break:
24902e5b6d6dSopenharmony_ci         * The following properties are only supported starting with the
24912e5b6d6dSopenharmony_ci         * Unicode version indicated in the second field.
24922e5b6d6dSopenharmony_ci         */
24932e5b6d6dSopenharmony_ci        { -1, 0x320, 0 },
24942e5b6d6dSopenharmony_ci
24952e5b6d6dSopenharmony_ci        { 0x180c, UCHAR_DEFAULT_IGNORABLE_CODE_POINT, true },
24962e5b6d6dSopenharmony_ci        { 0xfe02, UCHAR_DEFAULT_IGNORABLE_CODE_POINT, true },
24972e5b6d6dSopenharmony_ci        { 0x1801, UCHAR_DEFAULT_IGNORABLE_CODE_POINT, false },
24982e5b6d6dSopenharmony_ci
24992e5b6d6dSopenharmony_ci        { 0x0149, UCHAR_DEPRECATED, true },         /* changed in Unicode 5.2 */
25002e5b6d6dSopenharmony_ci        { 0x0341, UCHAR_DEPRECATED, false },        /* changed in Unicode 5.2 */
25012e5b6d6dSopenharmony_ci        { 0xe0001, UCHAR_DEPRECATED, true },        /* changed from Unicode 5 to 5.1 */
25022e5b6d6dSopenharmony_ci        { 0xe0100, UCHAR_DEPRECATED, false },
25032e5b6d6dSopenharmony_ci
25042e5b6d6dSopenharmony_ci        { 0x00a0, UCHAR_GRAPHEME_BASE, true },
25052e5b6d6dSopenharmony_ci        { 0x0a4d, UCHAR_GRAPHEME_BASE, false },
25062e5b6d6dSopenharmony_ci        { 0xff9d, UCHAR_GRAPHEME_BASE, true },
25072e5b6d6dSopenharmony_ci        { 0xff9f, UCHAR_GRAPHEME_BASE, false },     /* changed from Unicode 3.2 to 4 and again from 5 to 5.1 */
25082e5b6d6dSopenharmony_ci
25092e5b6d6dSopenharmony_ci        { 0x0300, UCHAR_GRAPHEME_EXTEND, true },
25102e5b6d6dSopenharmony_ci        { 0xff9d, UCHAR_GRAPHEME_EXTEND, false },
25112e5b6d6dSopenharmony_ci        { 0xff9f, UCHAR_GRAPHEME_EXTEND, true },    /* changed from Unicode 3.2 to 4 and again from 5 to 5.1 */
25122e5b6d6dSopenharmony_ci        { 0x0603, UCHAR_GRAPHEME_EXTEND, false },
25132e5b6d6dSopenharmony_ci
25142e5b6d6dSopenharmony_ci        { 0x0a4d, UCHAR_GRAPHEME_LINK, true },
25152e5b6d6dSopenharmony_ci        { 0xff9f, UCHAR_GRAPHEME_LINK, false },
25162e5b6d6dSopenharmony_ci
25172e5b6d6dSopenharmony_ci        { 0x2ff7, UCHAR_IDS_BINARY_OPERATOR, true },
25182e5b6d6dSopenharmony_ci        { 0x2ff3, UCHAR_IDS_BINARY_OPERATOR, false },
25192e5b6d6dSopenharmony_ci
25202e5b6d6dSopenharmony_ci        { 0x2ff3, UCHAR_IDS_TRINARY_OPERATOR, true },
25212e5b6d6dSopenharmony_ci        { 0x2f03, UCHAR_IDS_TRINARY_OPERATOR, false },
25222e5b6d6dSopenharmony_ci
25232e5b6d6dSopenharmony_ci        { 0x0ec1, UCHAR_LOGICAL_ORDER_EXCEPTION, true },
25242e5b6d6dSopenharmony_ci        { 0xdcba, UCHAR_LOGICAL_ORDER_EXCEPTION, false },
25252e5b6d6dSopenharmony_ci
25262e5b6d6dSopenharmony_ci        { 0x2e9b, UCHAR_RADICAL, true },
25272e5b6d6dSopenharmony_ci        { 0x4e00, UCHAR_RADICAL, false },
25282e5b6d6dSopenharmony_ci
25292e5b6d6dSopenharmony_ci        { 0x012f, UCHAR_SOFT_DOTTED, true },
25302e5b6d6dSopenharmony_ci        { 0x0049, UCHAR_SOFT_DOTTED, false },
25312e5b6d6dSopenharmony_ci
25322e5b6d6dSopenharmony_ci        { 0xfa11, UCHAR_UNIFIED_IDEOGRAPH, true },
25332e5b6d6dSopenharmony_ci        { 0xfa12, UCHAR_UNIFIED_IDEOGRAPH, false },
25342e5b6d6dSopenharmony_ci
25352e5b6d6dSopenharmony_ci        { -1, 0x401, 0 }, /* version break for Unicode 4.0.1 */
25362e5b6d6dSopenharmony_ci
25372e5b6d6dSopenharmony_ci        { 0x002e, UCHAR_S_TERM, true },
25382e5b6d6dSopenharmony_ci        { 0x0061, UCHAR_S_TERM, false },
25392e5b6d6dSopenharmony_ci
25402e5b6d6dSopenharmony_ci        { 0x180c, UCHAR_VARIATION_SELECTOR, true },
25412e5b6d6dSopenharmony_ci        { 0xfe03, UCHAR_VARIATION_SELECTOR, true },
25422e5b6d6dSopenharmony_ci        { 0xe01ef, UCHAR_VARIATION_SELECTOR, true },
25432e5b6d6dSopenharmony_ci        { 0xe0200, UCHAR_VARIATION_SELECTOR, false },
25442e5b6d6dSopenharmony_ci
25452e5b6d6dSopenharmony_ci        /* enum/integer type properties */
25462e5b6d6dSopenharmony_ci
25472e5b6d6dSopenharmony_ci        /* UCHAR_BIDI_CLASS tested for assigned characters in TestUnicodeData() */
25482e5b6d6dSopenharmony_ci        /* test default Bidi classes for unassigned code points */
25492e5b6d6dSopenharmony_ci        { 0x0590, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
25502e5b6d6dSopenharmony_ci        { 0x05cf, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
25512e5b6d6dSopenharmony_ci        { 0x05ed, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
25522e5b6d6dSopenharmony_ci        { 0x07f2, UCHAR_BIDI_CLASS, U_DIR_NON_SPACING_MARK }, /* Nko, new in Unicode 5.0 */
25532e5b6d6dSopenharmony_ci        { 0x07fe, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, /* unassigned R */
25542e5b6d6dSopenharmony_ci        { 0xfb37, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
25552e5b6d6dSopenharmony_ci        { 0xfb42, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
25562e5b6d6dSopenharmony_ci        { 0x10806, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
25572e5b6d6dSopenharmony_ci        { 0x10909, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
25582e5b6d6dSopenharmony_ci        { 0x10fe4, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
25592e5b6d6dSopenharmony_ci
25602e5b6d6dSopenharmony_ci        { 0x061d, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
25612e5b6d6dSopenharmony_ci        { 0x063f, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
25622e5b6d6dSopenharmony_ci        { 0x070e, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
25632e5b6d6dSopenharmony_ci        { 0x0775, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
25642e5b6d6dSopenharmony_ci        { 0xfbc2, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
25652e5b6d6dSopenharmony_ci        { 0xfd90, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
25662e5b6d6dSopenharmony_ci        { 0xfefe, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
25672e5b6d6dSopenharmony_ci
25682e5b6d6dSopenharmony_ci        { 0x02AF, UCHAR_BLOCK, UBLOCK_IPA_EXTENSIONS },
25692e5b6d6dSopenharmony_ci        { 0x0C4E, UCHAR_BLOCK, UBLOCK_TELUGU },
25702e5b6d6dSopenharmony_ci        { 0x155A, UCHAR_BLOCK, UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS },
25712e5b6d6dSopenharmony_ci        { 0x1717, UCHAR_BLOCK, UBLOCK_TAGALOG },
25722e5b6d6dSopenharmony_ci        { 0x1900, UCHAR_BLOCK, UBLOCK_LIMBU },
25732e5b6d6dSopenharmony_ci        { 0x2FE0, UCHAR_BLOCK, UBLOCK_NO_BLOCK },
25742e5b6d6dSopenharmony_ci        { 0x3040, UCHAR_BLOCK, UBLOCK_HIRAGANA },
25752e5b6d6dSopenharmony_ci        { 0x1D0FF, UCHAR_BLOCK, UBLOCK_BYZANTINE_MUSICAL_SYMBOLS },
25762e5b6d6dSopenharmony_ci        { 0x50000, UCHAR_BLOCK, UBLOCK_NO_BLOCK },
25772e5b6d6dSopenharmony_ci        { 0xEFFFF, UCHAR_BLOCK, UBLOCK_NO_BLOCK },
25782e5b6d6dSopenharmony_ci        { 0x10D0FF, UCHAR_BLOCK, UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B },
25792e5b6d6dSopenharmony_ci
25802e5b6d6dSopenharmony_ci        /* UCHAR_CANONICAL_COMBINING_CLASS tested for assigned characters in TestUnicodeData() */
25812e5b6d6dSopenharmony_ci        { 0xd7d7, UCHAR_CANONICAL_COMBINING_CLASS, 0 },
25822e5b6d6dSopenharmony_ci
25832e5b6d6dSopenharmony_ci        { 0x00A0, UCHAR_DECOMPOSITION_TYPE, U_DT_NOBREAK },
25842e5b6d6dSopenharmony_ci        { 0x00A8, UCHAR_DECOMPOSITION_TYPE, U_DT_COMPAT },
25852e5b6d6dSopenharmony_ci        { 0x00bf, UCHAR_DECOMPOSITION_TYPE, U_DT_NONE },
25862e5b6d6dSopenharmony_ci        { 0x00c0, UCHAR_DECOMPOSITION_TYPE, U_DT_CANONICAL },
25872e5b6d6dSopenharmony_ci        { 0x1E9B, UCHAR_DECOMPOSITION_TYPE, U_DT_CANONICAL },
25882e5b6d6dSopenharmony_ci        { 0xBCDE, UCHAR_DECOMPOSITION_TYPE, U_DT_CANONICAL },
25892e5b6d6dSopenharmony_ci        { 0xFB5D, UCHAR_DECOMPOSITION_TYPE, U_DT_MEDIAL },
25902e5b6d6dSopenharmony_ci        { 0x1D736, UCHAR_DECOMPOSITION_TYPE, U_DT_FONT },
25912e5b6d6dSopenharmony_ci        { 0xe0033, UCHAR_DECOMPOSITION_TYPE, U_DT_NONE },
25922e5b6d6dSopenharmony_ci
25932e5b6d6dSopenharmony_ci        { 0x0009, UCHAR_EAST_ASIAN_WIDTH, U_EA_NEUTRAL },
25942e5b6d6dSopenharmony_ci        { 0x0020, UCHAR_EAST_ASIAN_WIDTH, U_EA_NARROW },
25952e5b6d6dSopenharmony_ci        { 0x00B1, UCHAR_EAST_ASIAN_WIDTH, U_EA_AMBIGUOUS },
25962e5b6d6dSopenharmony_ci        { 0x20A9, UCHAR_EAST_ASIAN_WIDTH, U_EA_HALFWIDTH },
25972e5b6d6dSopenharmony_ci        { 0x2FFB, UCHAR_EAST_ASIAN_WIDTH, U_EA_WIDE },
25982e5b6d6dSopenharmony_ci        { 0x3000, UCHAR_EAST_ASIAN_WIDTH, U_EA_FULLWIDTH },
25992e5b6d6dSopenharmony_ci        { 0x35bb, UCHAR_EAST_ASIAN_WIDTH, U_EA_WIDE },
26002e5b6d6dSopenharmony_ci        { 0x58bd, UCHAR_EAST_ASIAN_WIDTH, U_EA_WIDE },
26012e5b6d6dSopenharmony_ci        { 0xD7A3, UCHAR_EAST_ASIAN_WIDTH, U_EA_WIDE },
26022e5b6d6dSopenharmony_ci        { 0xEEEE, UCHAR_EAST_ASIAN_WIDTH, U_EA_AMBIGUOUS },
26032e5b6d6dSopenharmony_ci        { 0x1D198, UCHAR_EAST_ASIAN_WIDTH, U_EA_NEUTRAL },
26042e5b6d6dSopenharmony_ci        { 0x20000, UCHAR_EAST_ASIAN_WIDTH, U_EA_WIDE },
26052e5b6d6dSopenharmony_ci        { 0x2F8C7, UCHAR_EAST_ASIAN_WIDTH, U_EA_WIDE },
26062e5b6d6dSopenharmony_ci        { 0x3a5bd, UCHAR_EAST_ASIAN_WIDTH, U_EA_WIDE }, /* plane 3 got default W values in Unicode 4 */
26072e5b6d6dSopenharmony_ci        { 0x5a5bd, UCHAR_EAST_ASIAN_WIDTH, U_EA_NEUTRAL },
26082e5b6d6dSopenharmony_ci        { 0xFEEEE, UCHAR_EAST_ASIAN_WIDTH, U_EA_AMBIGUOUS },
26092e5b6d6dSopenharmony_ci        { 0x10EEEE, UCHAR_EAST_ASIAN_WIDTH, U_EA_AMBIGUOUS },
26102e5b6d6dSopenharmony_ci
26112e5b6d6dSopenharmony_ci        /* UCHAR_GENERAL_CATEGORY tested for assigned characters in TestUnicodeData() */
26122e5b6d6dSopenharmony_ci        { 0xd7c7, UCHAR_GENERAL_CATEGORY, 0 },
26132e5b6d6dSopenharmony_ci        { 0xd7d7, UCHAR_GENERAL_CATEGORY, U_OTHER_LETTER },     /* changed in Unicode 5.2 */
26142e5b6d6dSopenharmony_ci
26152e5b6d6dSopenharmony_ci        { 0x0444, UCHAR_JOINING_GROUP, U_JG_NO_JOINING_GROUP },
26162e5b6d6dSopenharmony_ci        { 0x0639, UCHAR_JOINING_GROUP, U_JG_AIN },
26172e5b6d6dSopenharmony_ci        { 0x072A, UCHAR_JOINING_GROUP, U_JG_DALATH_RISH },
26182e5b6d6dSopenharmony_ci        { 0x0647, UCHAR_JOINING_GROUP, U_JG_HEH },
26192e5b6d6dSopenharmony_ci        { 0x06C1, UCHAR_JOINING_GROUP, U_JG_HEH_GOAL },
26202e5b6d6dSopenharmony_ci
26212e5b6d6dSopenharmony_ci        { 0x200C, UCHAR_JOINING_TYPE, U_JT_NON_JOINING },
26222e5b6d6dSopenharmony_ci        { 0x200D, UCHAR_JOINING_TYPE, U_JT_JOIN_CAUSING },
26232e5b6d6dSopenharmony_ci        { 0x0639, UCHAR_JOINING_TYPE, U_JT_DUAL_JOINING },
26242e5b6d6dSopenharmony_ci        { 0x0640, UCHAR_JOINING_TYPE, U_JT_JOIN_CAUSING },
26252e5b6d6dSopenharmony_ci        { 0x06C3, UCHAR_JOINING_TYPE, U_JT_RIGHT_JOINING },
26262e5b6d6dSopenharmony_ci        { 0x0300, UCHAR_JOINING_TYPE, U_JT_TRANSPARENT },
26272e5b6d6dSopenharmony_ci        { 0x070F, UCHAR_JOINING_TYPE, U_JT_TRANSPARENT },
26282e5b6d6dSopenharmony_ci        { 0xe0033, UCHAR_JOINING_TYPE, U_JT_TRANSPARENT },
26292e5b6d6dSopenharmony_ci
26302e5b6d6dSopenharmony_ci        /* TestUnicodeData() verifies that no assigned character has "XX" (unknown) */
26312e5b6d6dSopenharmony_ci        { 0xe7e7, UCHAR_LINE_BREAK, U_LB_UNKNOWN },
26322e5b6d6dSopenharmony_ci        { 0x10fffd, UCHAR_LINE_BREAK, U_LB_UNKNOWN },
26332e5b6d6dSopenharmony_ci        { 0x0028, UCHAR_LINE_BREAK, U_LB_OPEN_PUNCTUATION },
26342e5b6d6dSopenharmony_ci        { 0x232A, UCHAR_LINE_BREAK, U_LB_CLOSE_PUNCTUATION },
26352e5b6d6dSopenharmony_ci        { 0x3401, UCHAR_LINE_BREAK, U_LB_IDEOGRAPHIC },
26362e5b6d6dSopenharmony_ci        { 0x4e02, UCHAR_LINE_BREAK, U_LB_IDEOGRAPHIC },
26372e5b6d6dSopenharmony_ci        { 0x20004, UCHAR_LINE_BREAK, U_LB_IDEOGRAPHIC },
26382e5b6d6dSopenharmony_ci        { 0xf905, UCHAR_LINE_BREAK, U_LB_IDEOGRAPHIC },
26392e5b6d6dSopenharmony_ci        { 0xdb7e, UCHAR_LINE_BREAK, U_LB_SURROGATE },
26402e5b6d6dSopenharmony_ci        { 0xdbfd, UCHAR_LINE_BREAK, U_LB_SURROGATE },
26412e5b6d6dSopenharmony_ci        { 0xdffc, UCHAR_LINE_BREAK, U_LB_SURROGATE },
26422e5b6d6dSopenharmony_ci        { 0x2762, UCHAR_LINE_BREAK, U_LB_EXCLAMATION },
26432e5b6d6dSopenharmony_ci        { 0x002F, UCHAR_LINE_BREAK, U_LB_BREAK_SYMBOLS },
26442e5b6d6dSopenharmony_ci        { 0x1D49C, UCHAR_LINE_BREAK, U_LB_ALPHABETIC },
26452e5b6d6dSopenharmony_ci        { 0x1731, UCHAR_LINE_BREAK, U_LB_ALPHABETIC },
26462e5b6d6dSopenharmony_ci
26472e5b6d6dSopenharmony_ci        /* UCHAR_NUMERIC_TYPE tested in TestNumericProperties() */
26482e5b6d6dSopenharmony_ci
26492e5b6d6dSopenharmony_ci        /* UCHAR_SCRIPT tested in cucdapi.c TestUScriptCodeAPI() */
26502e5b6d6dSopenharmony_ci
26512e5b6d6dSopenharmony_ci        { 0x10ff, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
26522e5b6d6dSopenharmony_ci        { 0x1100, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },
26532e5b6d6dSopenharmony_ci        { 0x1111, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },
26542e5b6d6dSopenharmony_ci        { 0x1159, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },
26552e5b6d6dSopenharmony_ci        { 0x115a, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },     /* changed in Unicode 5.2 */
26562e5b6d6dSopenharmony_ci        { 0x115e, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },     /* changed in Unicode 5.2 */
26572e5b6d6dSopenharmony_ci        { 0x115f, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },
26582e5b6d6dSopenharmony_ci
26592e5b6d6dSopenharmony_ci        { 0xa95f, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
26602e5b6d6dSopenharmony_ci        { 0xa960, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },     /* changed in Unicode 5.2 */
26612e5b6d6dSopenharmony_ci        { 0xa97c, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LEADING_JAMO },     /* changed in Unicode 5.2 */
26622e5b6d6dSopenharmony_ci        { 0xa97d, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
26632e5b6d6dSopenharmony_ci
26642e5b6d6dSopenharmony_ci        { 0x1160, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },
26652e5b6d6dSopenharmony_ci        { 0x1161, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },
26662e5b6d6dSopenharmony_ci        { 0x1172, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },
26672e5b6d6dSopenharmony_ci        { 0x11a2, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },
26682e5b6d6dSopenharmony_ci        { 0x11a3, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },       /* changed in Unicode 5.2 */
26692e5b6d6dSopenharmony_ci        { 0x11a7, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },       /* changed in Unicode 5.2 */
26702e5b6d6dSopenharmony_ci
26712e5b6d6dSopenharmony_ci        { 0xd7af, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
26722e5b6d6dSopenharmony_ci        { 0xd7b0, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },       /* changed in Unicode 5.2 */
26732e5b6d6dSopenharmony_ci        { 0xd7c6, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_VOWEL_JAMO },       /* changed in Unicode 5.2 */
26742e5b6d6dSopenharmony_ci        { 0xd7c7, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
26752e5b6d6dSopenharmony_ci
26762e5b6d6dSopenharmony_ci        { 0x11a8, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },
26772e5b6d6dSopenharmony_ci        { 0x11b8, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },
26782e5b6d6dSopenharmony_ci        { 0x11c8, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },
26792e5b6d6dSopenharmony_ci        { 0x11f9, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },
26802e5b6d6dSopenharmony_ci        { 0x11fa, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },    /* changed in Unicode 5.2 */
26812e5b6d6dSopenharmony_ci        { 0x11ff, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },    /* changed in Unicode 5.2 */
26822e5b6d6dSopenharmony_ci        { 0x1200, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
26832e5b6d6dSopenharmony_ci
26842e5b6d6dSopenharmony_ci        { 0xd7ca, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
26852e5b6d6dSopenharmony_ci        { 0xd7cb, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },    /* changed in Unicode 5.2 */
26862e5b6d6dSopenharmony_ci        { 0xd7fb, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_TRAILING_JAMO },    /* changed in Unicode 5.2 */
26872e5b6d6dSopenharmony_ci        { 0xd7fc, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
26882e5b6d6dSopenharmony_ci
26892e5b6d6dSopenharmony_ci        { 0xac00, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LV_SYLLABLE },
26902e5b6d6dSopenharmony_ci        { 0xac1c, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LV_SYLLABLE },
26912e5b6d6dSopenharmony_ci        { 0xc5ec, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LV_SYLLABLE },
26922e5b6d6dSopenharmony_ci        { 0xd788, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LV_SYLLABLE },
26932e5b6d6dSopenharmony_ci
26942e5b6d6dSopenharmony_ci        { 0xac01, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LVT_SYLLABLE },
26952e5b6d6dSopenharmony_ci        { 0xac1b, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LVT_SYLLABLE },
26962e5b6d6dSopenharmony_ci        { 0xac1d, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LVT_SYLLABLE },
26972e5b6d6dSopenharmony_ci        { 0xc5ee, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LVT_SYLLABLE },
26982e5b6d6dSopenharmony_ci        { 0xd7a3, UCHAR_HANGUL_SYLLABLE_TYPE, U_HST_LVT_SYLLABLE },
26992e5b6d6dSopenharmony_ci
27002e5b6d6dSopenharmony_ci        { 0xd7a4, UCHAR_HANGUL_SYLLABLE_TYPE, 0 },
27012e5b6d6dSopenharmony_ci
27022e5b6d6dSopenharmony_ci        { -1, 0x410, 0 }, /* version break for Unicode 4.1 */
27032e5b6d6dSopenharmony_ci
27042e5b6d6dSopenharmony_ci        { 0x00d7, UCHAR_PATTERN_SYNTAX, true },
27052e5b6d6dSopenharmony_ci        { 0xfe45, UCHAR_PATTERN_SYNTAX, true },
27062e5b6d6dSopenharmony_ci        { 0x0061, UCHAR_PATTERN_SYNTAX, false },
27072e5b6d6dSopenharmony_ci
27082e5b6d6dSopenharmony_ci        { 0x0020, UCHAR_PATTERN_WHITE_SPACE, true },
27092e5b6d6dSopenharmony_ci        { 0x0085, UCHAR_PATTERN_WHITE_SPACE, true },
27102e5b6d6dSopenharmony_ci        { 0x200f, UCHAR_PATTERN_WHITE_SPACE, true },
27112e5b6d6dSopenharmony_ci        { 0x00a0, UCHAR_PATTERN_WHITE_SPACE, false },
27122e5b6d6dSopenharmony_ci        { 0x3000, UCHAR_PATTERN_WHITE_SPACE, false },
27132e5b6d6dSopenharmony_ci
27142e5b6d6dSopenharmony_ci        { 0x1d200, UCHAR_BLOCK, UBLOCK_ANCIENT_GREEK_MUSICAL_NOTATION },
27152e5b6d6dSopenharmony_ci        { 0x2c8e,  UCHAR_BLOCK, UBLOCK_COPTIC },
27162e5b6d6dSopenharmony_ci        { 0xfe17,  UCHAR_BLOCK, UBLOCK_VERTICAL_FORMS },
27172e5b6d6dSopenharmony_ci
27182e5b6d6dSopenharmony_ci        { 0x1a00,  UCHAR_SCRIPT, USCRIPT_BUGINESE },
27192e5b6d6dSopenharmony_ci        { 0x2cea,  UCHAR_SCRIPT, USCRIPT_COPTIC },
27202e5b6d6dSopenharmony_ci        { 0xa82b,  UCHAR_SCRIPT, USCRIPT_SYLOTI_NAGRI },
27212e5b6d6dSopenharmony_ci        { 0x103d0, UCHAR_SCRIPT, USCRIPT_OLD_PERSIAN },
27222e5b6d6dSopenharmony_ci
27232e5b6d6dSopenharmony_ci        { 0xcc28, UCHAR_LINE_BREAK, U_LB_H2 },
27242e5b6d6dSopenharmony_ci        { 0xcc29, UCHAR_LINE_BREAK, U_LB_H3 },
27252e5b6d6dSopenharmony_ci        { 0xac03, UCHAR_LINE_BREAK, U_LB_H3 },
27262e5b6d6dSopenharmony_ci        { 0x115f, UCHAR_LINE_BREAK, U_LB_JL },
27272e5b6d6dSopenharmony_ci        { 0x11aa, UCHAR_LINE_BREAK, U_LB_JT },
27282e5b6d6dSopenharmony_ci        { 0x11a1, UCHAR_LINE_BREAK, U_LB_JV },
27292e5b6d6dSopenharmony_ci
27302e5b6d6dSopenharmony_ci        { 0xb2c9, UCHAR_GRAPHEME_CLUSTER_BREAK, U_GCB_LVT },
27312e5b6d6dSopenharmony_ci        { 0x036f, UCHAR_GRAPHEME_CLUSTER_BREAK, U_GCB_EXTEND },
27322e5b6d6dSopenharmony_ci        { 0x0000, UCHAR_GRAPHEME_CLUSTER_BREAK, U_GCB_CONTROL },
27332e5b6d6dSopenharmony_ci        { 0x1160, UCHAR_GRAPHEME_CLUSTER_BREAK, U_GCB_V },
27342e5b6d6dSopenharmony_ci
27352e5b6d6dSopenharmony_ci        { 0x05f4, UCHAR_WORD_BREAK, U_WB_MIDLETTER },
27362e5b6d6dSopenharmony_ci        { 0x4ef0, UCHAR_WORD_BREAK, U_WB_OTHER },
27372e5b6d6dSopenharmony_ci        { 0x19d9, UCHAR_WORD_BREAK, U_WB_NUMERIC },
27382e5b6d6dSopenharmony_ci        { 0x2044, UCHAR_WORD_BREAK, U_WB_MIDNUM },
27392e5b6d6dSopenharmony_ci
27402e5b6d6dSopenharmony_ci        { 0xfffd, UCHAR_SENTENCE_BREAK, U_SB_OTHER },
27412e5b6d6dSopenharmony_ci        { 0x1ffc, UCHAR_SENTENCE_BREAK, U_SB_UPPER },
27422e5b6d6dSopenharmony_ci        { 0xff63, UCHAR_SENTENCE_BREAK, U_SB_CLOSE },
27432e5b6d6dSopenharmony_ci        { 0x2028, UCHAR_SENTENCE_BREAK, U_SB_SEP },
27442e5b6d6dSopenharmony_ci
27452e5b6d6dSopenharmony_ci        { -1, 0x520, 0 }, /* version break for Unicode 5.2 */
27462e5b6d6dSopenharmony_ci
27472e5b6d6dSopenharmony_ci        /* unassigned code points in new default Bidi R blocks */
27482e5b6d6dSopenharmony_ci        { 0x1ede4, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
27492e5b6d6dSopenharmony_ci        { 0x1efe4, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT },
27502e5b6d6dSopenharmony_ci
27512e5b6d6dSopenharmony_ci        /* test some script codes >127 */
27522e5b6d6dSopenharmony_ci        { 0xa6e6,  UCHAR_SCRIPT, USCRIPT_BAMUM },
27532e5b6d6dSopenharmony_ci        { 0xa4d0,  UCHAR_SCRIPT, USCRIPT_LISU },
27542e5b6d6dSopenharmony_ci        { 0x10a7f,  UCHAR_SCRIPT, USCRIPT_OLD_SOUTH_ARABIAN },
27552e5b6d6dSopenharmony_ci
27562e5b6d6dSopenharmony_ci        { -1, 0x600, 0 }, /* version break for Unicode 6.0 */
27572e5b6d6dSopenharmony_ci
27582e5b6d6dSopenharmony_ci        /* value changed in Unicode 6.0 */
27592e5b6d6dSopenharmony_ci        { 0x06C3, UCHAR_JOINING_GROUP, U_JG_TEH_MARBUTA_GOAL },
27602e5b6d6dSopenharmony_ci
27612e5b6d6dSopenharmony_ci        { -1, 0x610, 0 }, /* version break for Unicode 6.1 */
27622e5b6d6dSopenharmony_ci
27632e5b6d6dSopenharmony_ci        /* unassigned code points in new/changed default Bidi AL blocks */
27642e5b6d6dSopenharmony_ci        { 0x08ba, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
27652e5b6d6dSopenharmony_ci        { 0x1eee4, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC },
27662e5b6d6dSopenharmony_ci
27672e5b6d6dSopenharmony_ci        { -1, 0x630, 0 }, /* version break for Unicode 6.3 */
27682e5b6d6dSopenharmony_ci
27692e5b6d6dSopenharmony_ci        /* unassigned code points in the currency symbols block now default to ET */
27702e5b6d6dSopenharmony_ci        { 0x20C0, UCHAR_BIDI_CLASS, U_EUROPEAN_NUMBER_TERMINATOR },
27712e5b6d6dSopenharmony_ci        { 0x20CF, UCHAR_BIDI_CLASS, U_EUROPEAN_NUMBER_TERMINATOR },
27722e5b6d6dSopenharmony_ci
27732e5b6d6dSopenharmony_ci        /* new property in Unicode 6.3 */
27742e5b6d6dSopenharmony_ci        { 0x0027, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_NONE },
27752e5b6d6dSopenharmony_ci        { 0x0028, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_OPEN },
27762e5b6d6dSopenharmony_ci        { 0x0029, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_CLOSE },
27772e5b6d6dSopenharmony_ci        { 0xFF5C, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_NONE },
27782e5b6d6dSopenharmony_ci        { 0xFF5B, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_OPEN },
27792e5b6d6dSopenharmony_ci        { 0xFF5D, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_CLOSE },
27802e5b6d6dSopenharmony_ci
27812e5b6d6dSopenharmony_ci        { -1, 0x700, 0 }, /* version break for Unicode 7.0 */
27822e5b6d6dSopenharmony_ci
27832e5b6d6dSopenharmony_ci        /* new character range with Joining_Group values */
27842e5b6d6dSopenharmony_ci        { 0x10ABF, UCHAR_JOINING_GROUP, U_JG_NO_JOINING_GROUP },
27852e5b6d6dSopenharmony_ci        { 0x10AC0, UCHAR_JOINING_GROUP, U_JG_MANICHAEAN_ALEPH },
27862e5b6d6dSopenharmony_ci        { 0x10AC1, UCHAR_JOINING_GROUP, U_JG_MANICHAEAN_BETH },
27872e5b6d6dSopenharmony_ci        { 0x10AEF, UCHAR_JOINING_GROUP, U_JG_MANICHAEAN_HUNDRED },
27882e5b6d6dSopenharmony_ci        { 0x10AF0, UCHAR_JOINING_GROUP, U_JG_NO_JOINING_GROUP },
27892e5b6d6dSopenharmony_ci
27902e5b6d6dSopenharmony_ci        { -1, 0xa00, 0 },  // version break for Unicode 10
27912e5b6d6dSopenharmony_ci
27922e5b6d6dSopenharmony_ci        { 0x1F1E5, UCHAR_REGIONAL_INDICATOR, false },
27932e5b6d6dSopenharmony_ci        { 0x1F1E7, UCHAR_REGIONAL_INDICATOR, true },
27942e5b6d6dSopenharmony_ci        { 0x1F1FF, UCHAR_REGIONAL_INDICATOR, true },
27952e5b6d6dSopenharmony_ci        { 0x1F200, UCHAR_REGIONAL_INDICATOR, false },
27962e5b6d6dSopenharmony_ci
27972e5b6d6dSopenharmony_ci        { 0x0600, UCHAR_PREPENDED_CONCATENATION_MARK, true },
27982e5b6d6dSopenharmony_ci        { 0x0606, UCHAR_PREPENDED_CONCATENATION_MARK, false },
27992e5b6d6dSopenharmony_ci        { 0x110BD, UCHAR_PREPENDED_CONCATENATION_MARK, true },
28002e5b6d6dSopenharmony_ci
28012e5b6d6dSopenharmony_ci        /* undefined UProperty values */
28022e5b6d6dSopenharmony_ci        { 0x61, 0x4a7, 0 },
28032e5b6d6dSopenharmony_ci        { 0x234bc, 0x15ed, 0 }
28042e5b6d6dSopenharmony_ci    };
28052e5b6d6dSopenharmony_ci
28062e5b6d6dSopenharmony_ci    UVersionInfo version;
28072e5b6d6dSopenharmony_ci    UChar32 c;
28082e5b6d6dSopenharmony_ci    int32_t i, result, uVersion;
28092e5b6d6dSopenharmony_ci    UProperty which;
28102e5b6d6dSopenharmony_ci
28112e5b6d6dSopenharmony_ci    /* what is our Unicode version? */
28122e5b6d6dSopenharmony_ci    u_getUnicodeVersion(version);
28132e5b6d6dSopenharmony_ci    uVersion=((int32_t)version[0]<<8)|(version[1]<<4)|version[2]; /* major/minor/update version numbers */
28142e5b6d6dSopenharmony_ci
28152e5b6d6dSopenharmony_ci    u_charAge(0x20, version);
28162e5b6d6dSopenharmony_ci    if(version[0]==0) {
28172e5b6d6dSopenharmony_ci        /* no additional properties available */
28182e5b6d6dSopenharmony_ci        log_err("TestAdditionalProperties: no additional properties available, not tested\n");
28192e5b6d6dSopenharmony_ci        return;
28202e5b6d6dSopenharmony_ci    }
28212e5b6d6dSopenharmony_ci
28222e5b6d6dSopenharmony_ci    /* test u_charAge() */
28232e5b6d6dSopenharmony_ci    for(i=0; i<UPRV_LENGTHOF(charAges); ++i) {
28242e5b6d6dSopenharmony_ci        u_charAge(charAges[i].c, version);
28252e5b6d6dSopenharmony_ci        if(0!=memcmp(version, charAges[i].version, sizeof(UVersionInfo))) {
28262e5b6d6dSopenharmony_ci            log_err("error: u_charAge(U+%04lx)={ %u, %u, %u, %u } instead of { %u, %u, %u, %u }\n",
28272e5b6d6dSopenharmony_ci                charAges[i].c,
28282e5b6d6dSopenharmony_ci                version[0], version[1], version[2], version[3],
28292e5b6d6dSopenharmony_ci                charAges[i].version[0], charAges[i].version[1], charAges[i].version[2], charAges[i].version[3]);
28302e5b6d6dSopenharmony_ci        }
28312e5b6d6dSopenharmony_ci    }
28322e5b6d6dSopenharmony_ci
28332e5b6d6dSopenharmony_ci    if( u_getIntPropertyMinValue(UCHAR_DASH)!=0 ||
28342e5b6d6dSopenharmony_ci        u_getIntPropertyMinValue(UCHAR_BIDI_CLASS)!=0 ||
28352e5b6d6dSopenharmony_ci        u_getIntPropertyMinValue(UCHAR_BLOCK)!=0 ||   /* j2478 */
28362e5b6d6dSopenharmony_ci        u_getIntPropertyMinValue(UCHAR_SCRIPT)!=0 || /*JB#2410*/
28372e5b6d6dSopenharmony_ci        u_getIntPropertyMinValue(0x2345)!=0
28382e5b6d6dSopenharmony_ci    ) {
28392e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMinValue() wrong\n");
28402e5b6d6dSopenharmony_ci    }
28412e5b6d6dSopenharmony_ci    if( u_getIntPropertyMaxValue(UCHAR_DASH)!=1) {
28422e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_DASH) wrong\n");
28432e5b6d6dSopenharmony_ci    }
28442e5b6d6dSopenharmony_ci    if( u_getIntPropertyMaxValue(UCHAR_ID_CONTINUE)!=1) {
28452e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_ID_CONTINUE) wrong\n");
28462e5b6d6dSopenharmony_ci    }
28472e5b6d6dSopenharmony_ci    if( u_getIntPropertyMaxValue((UProperty)(UCHAR_BINARY_LIMIT-1))!=1) {
28482e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_BINARY_LIMIT-1) wrong\n");
28492e5b6d6dSopenharmony_ci    }
28502e5b6d6dSopenharmony_ci    if( u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)!=(int32_t)U_CHAR_DIRECTION_COUNT-1 ) {
28512e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS) wrong\n");
28522e5b6d6dSopenharmony_ci    }
28532e5b6d6dSopenharmony_ci    if( u_getIntPropertyMaxValue(UCHAR_BLOCK)!=(int32_t)UBLOCK_COUNT-1 ) {
28542e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_BLOCK) wrong\n");
28552e5b6d6dSopenharmony_ci    }
28562e5b6d6dSopenharmony_ci    if(u_getIntPropertyMaxValue(UCHAR_LINE_BREAK)!=(int32_t)U_LB_COUNT-1) {
28572e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_LINE_BREAK) wrong\n");
28582e5b6d6dSopenharmony_ci    }
28592e5b6d6dSopenharmony_ci    if(u_getIntPropertyMaxValue(UCHAR_SCRIPT)!=(int32_t)USCRIPT_CODE_LIMIT-1) {
28602e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_SCRIPT) wrong\n");
28612e5b6d6dSopenharmony_ci    }
28622e5b6d6dSopenharmony_ci    if(u_getIntPropertyMaxValue(UCHAR_NUMERIC_TYPE)!=(int32_t)U_NT_COUNT-1) {
28632e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_NUMERIC_TYPE) wrong\n");
28642e5b6d6dSopenharmony_ci    }
28652e5b6d6dSopenharmony_ci    if(u_getIntPropertyMaxValue(UCHAR_GENERAL_CATEGORY)!=(int32_t)U_CHAR_CATEGORY_COUNT-1) {
28662e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_GENERAL_CATEGORY) wrong\n");
28672e5b6d6dSopenharmony_ci    }
28682e5b6d6dSopenharmony_ci    if(u_getIntPropertyMaxValue(UCHAR_HANGUL_SYLLABLE_TYPE)!=(int32_t)U_HST_COUNT-1) {
28692e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_HANGUL_SYLLABLE_TYPE) wrong\n");
28702e5b6d6dSopenharmony_ci    }
28712e5b6d6dSopenharmony_ci    if(u_getIntPropertyMaxValue(UCHAR_GRAPHEME_CLUSTER_BREAK)!=(int32_t)U_GCB_COUNT-1) {
28722e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_GRAPHEME_CLUSTER_BREAK) wrong\n");
28732e5b6d6dSopenharmony_ci    }
28742e5b6d6dSopenharmony_ci    if(u_getIntPropertyMaxValue(UCHAR_SENTENCE_BREAK)!=(int32_t)U_SB_COUNT-1) {
28752e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_SENTENCE_BREAK) wrong\n");
28762e5b6d6dSopenharmony_ci    }
28772e5b6d6dSopenharmony_ci    if(u_getIntPropertyMaxValue(UCHAR_WORD_BREAK)!=(int32_t)U_WB_COUNT-1) {
28782e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_WORD_BREAK) wrong\n");
28792e5b6d6dSopenharmony_ci    }
28802e5b6d6dSopenharmony_ci    if(u_getIntPropertyMaxValue(UCHAR_BIDI_PAIRED_BRACKET_TYPE)!=(int32_t)U_BPT_COUNT-1) {
28812e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_BIDI_PAIRED_BRACKET_TYPE) wrong\n");
28822e5b6d6dSopenharmony_ci    }
28832e5b6d6dSopenharmony_ci    /*JB#2410*/
28842e5b6d6dSopenharmony_ci    if( u_getIntPropertyMaxValue(0x2345)!=-1) {
28852e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(0x2345) wrong\n");
28862e5b6d6dSopenharmony_ci    }
28872e5b6d6dSopenharmony_ci    if( u_getIntPropertyMaxValue(UCHAR_DECOMPOSITION_TYPE) != (int32_t) (U_DT_COUNT - 1)) {
28882e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_DECOMPOSITION_TYPE) wrong\n");
28892e5b6d6dSopenharmony_ci    }
28902e5b6d6dSopenharmony_ci    if( u_getIntPropertyMaxValue(UCHAR_JOINING_GROUP) !=  (int32_t) (U_JG_COUNT -1)) {
28912e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_JOINING_GROUP) wrong\n");
28922e5b6d6dSopenharmony_ci    }
28932e5b6d6dSopenharmony_ci    if( u_getIntPropertyMaxValue(UCHAR_JOINING_TYPE) != (int32_t) (U_JT_COUNT -1)) {
28942e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_JOINING_TYPE) wrong\n");
28952e5b6d6dSopenharmony_ci    }
28962e5b6d6dSopenharmony_ci    if( u_getIntPropertyMaxValue(UCHAR_EAST_ASIAN_WIDTH) != (int32_t) (U_EA_COUNT -1)) {
28972e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMaxValue(UCHAR_EAST_ASIAN_WIDTH) wrong\n");
28982e5b6d6dSopenharmony_ci    }
28992e5b6d6dSopenharmony_ci
29002e5b6d6dSopenharmony_ci    /* test u_hasBinaryProperty() and u_getIntPropertyValue() */
29012e5b6d6dSopenharmony_ci    for(i=0; i<UPRV_LENGTHOF(props); ++i) {
29022e5b6d6dSopenharmony_ci        const char *whichName;
29032e5b6d6dSopenharmony_ci
29042e5b6d6dSopenharmony_ci        if(props[i][0]<0) {
29052e5b6d6dSopenharmony_ci            /* Unicode version break */
29062e5b6d6dSopenharmony_ci            if(uVersion<props[i][1]) {
29072e5b6d6dSopenharmony_ci                break; /* do not test properties that are not yet supported */
29082e5b6d6dSopenharmony_ci            } else {
29092e5b6d6dSopenharmony_ci                continue; /* skip this row */
29102e5b6d6dSopenharmony_ci            }
29112e5b6d6dSopenharmony_ci        }
29122e5b6d6dSopenharmony_ci
29132e5b6d6dSopenharmony_ci        c=(UChar32)props[i][0];
29142e5b6d6dSopenharmony_ci        which=(UProperty)props[i][1];
29152e5b6d6dSopenharmony_ci        whichName=u_getPropertyName(which, U_LONG_PROPERTY_NAME);
29162e5b6d6dSopenharmony_ci
29172e5b6d6dSopenharmony_ci        if(which<UCHAR_INT_START) {
29182e5b6d6dSopenharmony_ci            result=u_hasBinaryProperty(c, which);
29192e5b6d6dSopenharmony_ci            if(result!=props[i][2]) {
29202e5b6d6dSopenharmony_ci                log_data_err("error: u_hasBinaryProperty(U+%04lx, %s)=%d is wrong (props[%d]) - (Are you missing data?)\n",
29212e5b6d6dSopenharmony_ci                        c, whichName, result, i);
29222e5b6d6dSopenharmony_ci            }
29232e5b6d6dSopenharmony_ci        }
29242e5b6d6dSopenharmony_ci
29252e5b6d6dSopenharmony_ci        result=u_getIntPropertyValue(c, which);
29262e5b6d6dSopenharmony_ci        if(result!=props[i][2]) {
29272e5b6d6dSopenharmony_ci            log_data_err("error: u_getIntPropertyValue(U+%04lx, %s)=%d is wrong, should be %d (props[%d]) - (Are you missing data?)\n",
29282e5b6d6dSopenharmony_ci                    c, whichName, result, props[i][2], i);
29292e5b6d6dSopenharmony_ci        }
29302e5b6d6dSopenharmony_ci
29312e5b6d6dSopenharmony_ci        /* test separate functions, too */
29322e5b6d6dSopenharmony_ci        switch((UProperty)props[i][1]) {
29332e5b6d6dSopenharmony_ci        case UCHAR_ALPHABETIC:
29342e5b6d6dSopenharmony_ci            if(u_isUAlphabetic((UChar32)props[i][0])!=(UBool)props[i][2]) {
29352e5b6d6dSopenharmony_ci                log_err("error: u_isUAlphabetic(U+%04lx)=%d is wrong (props[%d])\n",
29362e5b6d6dSopenharmony_ci                        props[i][0], result, i);
29372e5b6d6dSopenharmony_ci            }
29382e5b6d6dSopenharmony_ci            break;
29392e5b6d6dSopenharmony_ci        case UCHAR_LOWERCASE:
29402e5b6d6dSopenharmony_ci            if(u_isULowercase((UChar32)props[i][0])!=(UBool)props[i][2]) {
29412e5b6d6dSopenharmony_ci                log_err("error: u_isULowercase(U+%04lx)=%d is wrong (props[%d])\n",
29422e5b6d6dSopenharmony_ci                        props[i][0], result, i);
29432e5b6d6dSopenharmony_ci            }
29442e5b6d6dSopenharmony_ci            break;
29452e5b6d6dSopenharmony_ci        case UCHAR_UPPERCASE:
29462e5b6d6dSopenharmony_ci            if(u_isUUppercase((UChar32)props[i][0])!=(UBool)props[i][2]) {
29472e5b6d6dSopenharmony_ci                log_err("error: u_isUUppercase(U+%04lx)=%d is wrong (props[%d])\n",
29482e5b6d6dSopenharmony_ci                        props[i][0], result, i);
29492e5b6d6dSopenharmony_ci            }
29502e5b6d6dSopenharmony_ci            break;
29512e5b6d6dSopenharmony_ci        case UCHAR_WHITE_SPACE:
29522e5b6d6dSopenharmony_ci            if(u_isUWhiteSpace((UChar32)props[i][0])!=(UBool)props[i][2]) {
29532e5b6d6dSopenharmony_ci                log_err("error: u_isUWhiteSpace(U+%04lx)=%d is wrong (props[%d])\n",
29542e5b6d6dSopenharmony_ci                        props[i][0], result, i);
29552e5b6d6dSopenharmony_ci            }
29562e5b6d6dSopenharmony_ci            break;
29572e5b6d6dSopenharmony_ci        default:
29582e5b6d6dSopenharmony_ci            break;
29592e5b6d6dSopenharmony_ci        }
29602e5b6d6dSopenharmony_ci    }
29612e5b6d6dSopenharmony_ci
29622e5b6d6dSopenharmony_ci    // C API coverage
29632e5b6d6dSopenharmony_ci    if (u_stringHasBinaryProperty(u"⏱", 1, UCHAR_BASIC_EMOJI) ||
29642e5b6d6dSopenharmony_ci            u_stringHasBinaryProperty(u"⏱", -1, UCHAR_BASIC_EMOJI) ||
29652e5b6d6dSopenharmony_ci            !u_stringHasBinaryProperty(u"⏱\uFE0F", 2, UCHAR_BASIC_EMOJI) ||
29662e5b6d6dSopenharmony_ci            !u_stringHasBinaryProperty(u"⏱\uFE0F", -1, UCHAR_BASIC_EMOJI)) {
29672e5b6d6dSopenharmony_ci        log_data_err("error: u_stringHasBinaryProperty(stopwatch variants) is wrong\n");
29682e5b6d6dSopenharmony_ci    }
29692e5b6d6dSopenharmony_ci}
29702e5b6d6dSopenharmony_ci
29712e5b6d6dSopenharmony_cistatic void
29722e5b6d6dSopenharmony_ciTestNumericProperties(void) {
29732e5b6d6dSopenharmony_ci    /* see UnicodeData.txt, DerivedNumericValues.txt */
29742e5b6d6dSopenharmony_ci    static const struct {
29752e5b6d6dSopenharmony_ci        UChar32 c;
29762e5b6d6dSopenharmony_ci        int32_t type;
29772e5b6d6dSopenharmony_ci        double numValue;
29782e5b6d6dSopenharmony_ci    } values[]={
29792e5b6d6dSopenharmony_ci        { 0x0F33, U_NT_NUMERIC, -1./2. },
29802e5b6d6dSopenharmony_ci        { 0x0C66, U_NT_DECIMAL, 0 },
29812e5b6d6dSopenharmony_ci        { 0x96f6, U_NT_NUMERIC, 0 },
29822e5b6d6dSopenharmony_ci        { 0xa833, U_NT_NUMERIC, 1./16. },
29832e5b6d6dSopenharmony_ci        { 0x2152, U_NT_NUMERIC, 1./10. },
29842e5b6d6dSopenharmony_ci        { 0x2151, U_NT_NUMERIC, 1./9. },
29852e5b6d6dSopenharmony_ci        { 0x1245f, U_NT_NUMERIC, 1./8. },
29862e5b6d6dSopenharmony_ci        { 0x2150, U_NT_NUMERIC, 1./7. },
29872e5b6d6dSopenharmony_ci        { 0x2159, U_NT_NUMERIC, 1./6. },
29882e5b6d6dSopenharmony_ci        { 0x09f6, U_NT_NUMERIC, 3./16. },
29892e5b6d6dSopenharmony_ci        { 0x2155, U_NT_NUMERIC, 1./5. },
29902e5b6d6dSopenharmony_ci        { 0x00BD, U_NT_NUMERIC, 1./2. },
29912e5b6d6dSopenharmony_ci        { 0x0031, U_NT_DECIMAL, 1. },
29922e5b6d6dSopenharmony_ci        { 0x4e00, U_NT_NUMERIC, 1. },
29932e5b6d6dSopenharmony_ci        { 0x58f1, U_NT_NUMERIC, 1. },
29942e5b6d6dSopenharmony_ci        { 0x10320, U_NT_NUMERIC, 1. },
29952e5b6d6dSopenharmony_ci        { 0x0F2B, U_NT_NUMERIC, 3./2. },
29962e5b6d6dSopenharmony_ci        { 0x00B2, U_NT_DIGIT, 2. },
29972e5b6d6dSopenharmony_ci        { 0x5f10, U_NT_NUMERIC, 2. },
29982e5b6d6dSopenharmony_ci        { 0x1813, U_NT_DECIMAL, 3. },
29992e5b6d6dSopenharmony_ci        { 0x5f0e, U_NT_NUMERIC, 3. },
30002e5b6d6dSopenharmony_ci        { 0x2173, U_NT_NUMERIC, 4. },
30012e5b6d6dSopenharmony_ci        { 0x8086, U_NT_NUMERIC, 4. },
30022e5b6d6dSopenharmony_ci        { 0x278E, U_NT_DIGIT, 5. },
30032e5b6d6dSopenharmony_ci        { 0x1D7F2, U_NT_DECIMAL, 6. },
30042e5b6d6dSopenharmony_ci        { 0x247A, U_NT_DIGIT, 7. },
30052e5b6d6dSopenharmony_ci        { 0x7396, U_NT_NUMERIC, 9. },
30062e5b6d6dSopenharmony_ci        { 0x1372, U_NT_NUMERIC, 10. },
30072e5b6d6dSopenharmony_ci        { 0x216B, U_NT_NUMERIC, 12. },
30082e5b6d6dSopenharmony_ci        { 0x16EE, U_NT_NUMERIC, 17. },
30092e5b6d6dSopenharmony_ci        { 0x249A, U_NT_NUMERIC, 19. },
30102e5b6d6dSopenharmony_ci        { 0x303A, U_NT_NUMERIC, 30. },
30112e5b6d6dSopenharmony_ci        { 0x5345, U_NT_NUMERIC, 30. },
30122e5b6d6dSopenharmony_ci        { 0x32B2, U_NT_NUMERIC, 37. },
30132e5b6d6dSopenharmony_ci        { 0x1375, U_NT_NUMERIC, 40. },
30142e5b6d6dSopenharmony_ci        { 0x10323, U_NT_NUMERIC, 50. },
30152e5b6d6dSopenharmony_ci        { 0x0BF1, U_NT_NUMERIC, 100. },
30162e5b6d6dSopenharmony_ci        { 0x964c, U_NT_NUMERIC, 100. },
30172e5b6d6dSopenharmony_ci        { 0x217E, U_NT_NUMERIC, 500. },
30182e5b6d6dSopenharmony_ci        { 0x2180, U_NT_NUMERIC, 1000. },
30192e5b6d6dSopenharmony_ci        { 0x4edf, U_NT_NUMERIC, 1000. },
30202e5b6d6dSopenharmony_ci        { 0x2181, U_NT_NUMERIC, 5000. },
30212e5b6d6dSopenharmony_ci        { 0x137C, U_NT_NUMERIC, 10000. },
30222e5b6d6dSopenharmony_ci        { 0x4e07, U_NT_NUMERIC, 10000. },
30232e5b6d6dSopenharmony_ci        { 0x12432, U_NT_NUMERIC, 216000. },
30242e5b6d6dSopenharmony_ci        { 0x12433, U_NT_NUMERIC, 432000. },
30252e5b6d6dSopenharmony_ci        { 0x4ebf, U_NT_NUMERIC, 100000000. },
30262e5b6d6dSopenharmony_ci        { 0x5146, U_NT_NUMERIC, 1000000000000. },
30272e5b6d6dSopenharmony_ci        { -1, U_NT_NONE, U_NO_NUMERIC_VALUE },
30282e5b6d6dSopenharmony_ci        { 0x61, U_NT_NONE, U_NO_NUMERIC_VALUE },
30292e5b6d6dSopenharmony_ci        { 0x3000, U_NT_NONE, U_NO_NUMERIC_VALUE },
30302e5b6d6dSopenharmony_ci        { 0xfffe, U_NT_NONE, U_NO_NUMERIC_VALUE },
30312e5b6d6dSopenharmony_ci        { 0x10301, U_NT_NONE, U_NO_NUMERIC_VALUE },
30322e5b6d6dSopenharmony_ci        { 0xe0033, U_NT_NONE, U_NO_NUMERIC_VALUE },
30332e5b6d6dSopenharmony_ci        { 0x10ffff, U_NT_NONE, U_NO_NUMERIC_VALUE },
30342e5b6d6dSopenharmony_ci        { 0x110000, U_NT_NONE, U_NO_NUMERIC_VALUE }
30352e5b6d6dSopenharmony_ci    };
30362e5b6d6dSopenharmony_ci
30372e5b6d6dSopenharmony_ci    double nv;
30382e5b6d6dSopenharmony_ci    UChar32 c;
30392e5b6d6dSopenharmony_ci    int32_t i, type;
30402e5b6d6dSopenharmony_ci
30412e5b6d6dSopenharmony_ci    for(i=0; i<UPRV_LENGTHOF(values); ++i) {
30422e5b6d6dSopenharmony_ci        c=values[i].c;
30432e5b6d6dSopenharmony_ci        type=u_getIntPropertyValue(c, UCHAR_NUMERIC_TYPE);
30442e5b6d6dSopenharmony_ci        nv=u_getNumericValue(c);
30452e5b6d6dSopenharmony_ci
30462e5b6d6dSopenharmony_ci        if(type!=values[i].type) {
30472e5b6d6dSopenharmony_ci            log_err("UCHAR_NUMERIC_TYPE(U+%04lx)=%d should be %d\n", c, type, values[i].type);
30482e5b6d6dSopenharmony_ci        }
30492e5b6d6dSopenharmony_ci        if(0.000001 <= fabs(nv - values[i].numValue)) {
30502e5b6d6dSopenharmony_ci            log_err("u_getNumericValue(U+%04lx)=%g should be %g\n", c, nv, values[i].numValue);
30512e5b6d6dSopenharmony_ci        }
30522e5b6d6dSopenharmony_ci    }
30532e5b6d6dSopenharmony_ci}
30542e5b6d6dSopenharmony_ci
30552e5b6d6dSopenharmony_ci/**
30562e5b6d6dSopenharmony_ci * Test the property names and property value names API.
30572e5b6d6dSopenharmony_ci */
30582e5b6d6dSopenharmony_cistatic void
30592e5b6d6dSopenharmony_ciTestPropertyNames(void) {
30602e5b6d6dSopenharmony_ci    int32_t p, v, choice=0, rev;
30612e5b6d6dSopenharmony_ci    UBool atLeastSomething = false;
30622e5b6d6dSopenharmony_ci
30632e5b6d6dSopenharmony_ci    for (p=0; ; ++p) {
30642e5b6d6dSopenharmony_ci        UProperty propEnum = (UProperty)p;
30652e5b6d6dSopenharmony_ci        UBool sawProp = false;
30662e5b6d6dSopenharmony_ci        if(p > 10 && !atLeastSomething) {
30672e5b6d6dSopenharmony_ci          log_data_err("Never got anything after 10 tries.\nYour data is probably fried. Quitting this test\n", p, choice);
30682e5b6d6dSopenharmony_ci          return;
30692e5b6d6dSopenharmony_ci        }
30702e5b6d6dSopenharmony_ci
30712e5b6d6dSopenharmony_ci        for (choice=0; ; ++choice) {
30722e5b6d6dSopenharmony_ci            const char* name = u_getPropertyName(propEnum, (UPropertyNameChoice)choice);
30732e5b6d6dSopenharmony_ci            if (name) {
30742e5b6d6dSopenharmony_ci                if (!sawProp)
30752e5b6d6dSopenharmony_ci                    log_verbose("prop 0x%04x+%2d:", p&~0xfff, p&0xfff);
30762e5b6d6dSopenharmony_ci                log_verbose("%d=\"%s\"", choice, name);
30772e5b6d6dSopenharmony_ci                sawProp = true;
30782e5b6d6dSopenharmony_ci                atLeastSomething = true;
30792e5b6d6dSopenharmony_ci
30802e5b6d6dSopenharmony_ci                /* test reverse mapping */
30812e5b6d6dSopenharmony_ci                rev = u_getPropertyEnum(name);
30822e5b6d6dSopenharmony_ci                if (rev != p) {
30832e5b6d6dSopenharmony_ci                    log_err("Property round-trip failure: %d -> %s -> %d\n",
30842e5b6d6dSopenharmony_ci                            p, name, rev);
30852e5b6d6dSopenharmony_ci                }
30862e5b6d6dSopenharmony_ci            }
30872e5b6d6dSopenharmony_ci            if (!name && choice>0) break;
30882e5b6d6dSopenharmony_ci        }
30892e5b6d6dSopenharmony_ci        if (sawProp) {
30902e5b6d6dSopenharmony_ci            /* looks like a valid property; check the values */
30912e5b6d6dSopenharmony_ci            const char* pname = u_getPropertyName(propEnum, U_LONG_PROPERTY_NAME);
30922e5b6d6dSopenharmony_ci            int32_t max = 0;
30932e5b6d6dSopenharmony_ci            if (p == UCHAR_CANONICAL_COMBINING_CLASS) {
30942e5b6d6dSopenharmony_ci                max = 255;
30952e5b6d6dSopenharmony_ci            } else if (p == UCHAR_GENERAL_CATEGORY_MASK) {
30962e5b6d6dSopenharmony_ci                /* it's far too slow to iterate all the way up to
30972e5b6d6dSopenharmony_ci                   the real max, U_GC_P_MASK */
30982e5b6d6dSopenharmony_ci                max = U_GC_NL_MASK;
30992e5b6d6dSopenharmony_ci            } else if (p == UCHAR_BLOCK) {
31002e5b6d6dSopenharmony_ci                /* UBlockCodes, unlike other values, start at 1 */
31012e5b6d6dSopenharmony_ci                max = 1;
31022e5b6d6dSopenharmony_ci            }
31032e5b6d6dSopenharmony_ci            log_verbose("\n");
31042e5b6d6dSopenharmony_ci            for (v=-1; ; ++v) {
31052e5b6d6dSopenharmony_ci                UBool sawValue = false;
31062e5b6d6dSopenharmony_ci                for (choice=0; ; ++choice) {
31072e5b6d6dSopenharmony_ci                    const char* vname = u_getPropertyValueName(propEnum, v, (UPropertyNameChoice)choice);
31082e5b6d6dSopenharmony_ci                    if (vname) {
31092e5b6d6dSopenharmony_ci                        if (!sawValue) log_verbose(" %s, value %d:", pname, v);
31102e5b6d6dSopenharmony_ci                        log_verbose("%d=\"%s\"", choice, vname);
31112e5b6d6dSopenharmony_ci                        sawValue = true;
31122e5b6d6dSopenharmony_ci
31132e5b6d6dSopenharmony_ci                        /* test reverse mapping */
31142e5b6d6dSopenharmony_ci                        rev = u_getPropertyValueEnum(propEnum, vname);
31152e5b6d6dSopenharmony_ci                        if (rev != v) {
31162e5b6d6dSopenharmony_ci                            log_err("Value round-trip failure (%s): %d -> %s -> %d\n",
31172e5b6d6dSopenharmony_ci                                    pname, v, vname, rev);
31182e5b6d6dSopenharmony_ci                        }
31192e5b6d6dSopenharmony_ci                    }
31202e5b6d6dSopenharmony_ci                    if (!vname && choice>0) break;
31212e5b6d6dSopenharmony_ci                }
31222e5b6d6dSopenharmony_ci                if (sawValue) {
31232e5b6d6dSopenharmony_ci                    log_verbose("\n");
31242e5b6d6dSopenharmony_ci                }
31252e5b6d6dSopenharmony_ci                if (!sawValue && v>=max) break;
31262e5b6d6dSopenharmony_ci            }
31272e5b6d6dSopenharmony_ci        }
31282e5b6d6dSopenharmony_ci        if (!sawProp) {
31292e5b6d6dSopenharmony_ci            if (p>=UCHAR_STRING_LIMIT) {
31302e5b6d6dSopenharmony_ci                break;
31312e5b6d6dSopenharmony_ci            } else if (p>=UCHAR_DOUBLE_LIMIT) {
31322e5b6d6dSopenharmony_ci                p = UCHAR_STRING_START - 1;
31332e5b6d6dSopenharmony_ci            } else if (p>=UCHAR_MASK_LIMIT) {
31342e5b6d6dSopenharmony_ci                p = UCHAR_DOUBLE_START - 1;
31352e5b6d6dSopenharmony_ci            } else if (p>=UCHAR_INT_LIMIT) {
31362e5b6d6dSopenharmony_ci                p = UCHAR_MASK_START - 1;
31372e5b6d6dSopenharmony_ci            } else if (p>=UCHAR_BINARY_LIMIT) {
31382e5b6d6dSopenharmony_ci                p = UCHAR_INT_START - 1;
31392e5b6d6dSopenharmony_ci            }
31402e5b6d6dSopenharmony_ci        }
31412e5b6d6dSopenharmony_ci    }
31422e5b6d6dSopenharmony_ci}
31432e5b6d6dSopenharmony_ci
31442e5b6d6dSopenharmony_ci/**
31452e5b6d6dSopenharmony_ci * Test the property values API.  See JB#2410.
31462e5b6d6dSopenharmony_ci */
31472e5b6d6dSopenharmony_cistatic void
31482e5b6d6dSopenharmony_ciTestPropertyValues(void) {
31492e5b6d6dSopenharmony_ci    int32_t i, p, min, max;
31502e5b6d6dSopenharmony_ci    UErrorCode ec;
31512e5b6d6dSopenharmony_ci
31522e5b6d6dSopenharmony_ci    /* Min should be 0 for everything. */
31532e5b6d6dSopenharmony_ci    /* Until JB#2478 is fixed, the one exception is UCHAR_BLOCK. */
31542e5b6d6dSopenharmony_ci    for (p=UCHAR_INT_START; p<UCHAR_INT_LIMIT; ++p) {
31552e5b6d6dSopenharmony_ci        UProperty propEnum = (UProperty)p;
31562e5b6d6dSopenharmony_ci        min = u_getIntPropertyMinValue(propEnum);
31572e5b6d6dSopenharmony_ci        if (min != 0) {
31582e5b6d6dSopenharmony_ci            if (p == UCHAR_BLOCK) {
31592e5b6d6dSopenharmony_ci                /* This is okay...for now.  See JB#2487.
31602e5b6d6dSopenharmony_ci                   TODO Update this for JB#2487. */
31612e5b6d6dSopenharmony_ci            } else {
31622e5b6d6dSopenharmony_ci                const char* name;
31632e5b6d6dSopenharmony_ci                name = u_getPropertyName(propEnum, U_LONG_PROPERTY_NAME);
31642e5b6d6dSopenharmony_ci                if (name == NULL)
31652e5b6d6dSopenharmony_ci                    name = "<ERROR>";
31662e5b6d6dSopenharmony_ci                log_err("FAIL: u_getIntPropertyMinValue(%s) = %d, exp. 0\n",
31672e5b6d6dSopenharmony_ci                        name, min);
31682e5b6d6dSopenharmony_ci            }
31692e5b6d6dSopenharmony_ci        }
31702e5b6d6dSopenharmony_ci    }
31712e5b6d6dSopenharmony_ci
31722e5b6d6dSopenharmony_ci    if( u_getIntPropertyMinValue(UCHAR_GENERAL_CATEGORY_MASK)!=0 ||
31732e5b6d6dSopenharmony_ci        u_getIntPropertyMaxValue(UCHAR_GENERAL_CATEGORY_MASK)!=-1) {
31742e5b6d6dSopenharmony_ci        log_err("error: u_getIntPropertyMin/MaxValue(UCHAR_GENERAL_CATEGORY_MASK) is wrong\n");
31752e5b6d6dSopenharmony_ci    }
31762e5b6d6dSopenharmony_ci
31772e5b6d6dSopenharmony_ci    /* Max should be -1 for invalid properties. */
31782e5b6d6dSopenharmony_ci    max = u_getIntPropertyMaxValue(UCHAR_INVALID_CODE);
31792e5b6d6dSopenharmony_ci    if (max != -1) {
31802e5b6d6dSopenharmony_ci        log_err("FAIL: u_getIntPropertyMaxValue(-1) = %d, exp. -1\n",
31812e5b6d6dSopenharmony_ci                max);
31822e5b6d6dSopenharmony_ci    }
31832e5b6d6dSopenharmony_ci
31842e5b6d6dSopenharmony_ci    /* Script should return USCRIPT_INVALID_CODE for an invalid code point. */
31852e5b6d6dSopenharmony_ci    for (i=0; i<2; ++i) {
31862e5b6d6dSopenharmony_ci        int32_t script;
31872e5b6d6dSopenharmony_ci        const char* desc;
31882e5b6d6dSopenharmony_ci        ec = U_ZERO_ERROR;
31892e5b6d6dSopenharmony_ci        switch (i) {
31902e5b6d6dSopenharmony_ci        case 0:
31912e5b6d6dSopenharmony_ci            script = uscript_getScript(-1, &ec);
31922e5b6d6dSopenharmony_ci            desc = "uscript_getScript(-1)";
31932e5b6d6dSopenharmony_ci            break;
31942e5b6d6dSopenharmony_ci        case 1:
31952e5b6d6dSopenharmony_ci            script = u_getIntPropertyValue(-1, UCHAR_SCRIPT);
31962e5b6d6dSopenharmony_ci            desc = "u_getIntPropertyValue(-1, UCHAR_SCRIPT)";
31972e5b6d6dSopenharmony_ci            break;
31982e5b6d6dSopenharmony_ci        default:
31992e5b6d6dSopenharmony_ci            log_err("Internal test error. Too many scripts\n");
32002e5b6d6dSopenharmony_ci            return;
32012e5b6d6dSopenharmony_ci        }
32022e5b6d6dSopenharmony_ci        /* We don't explicitly test ec.  It should be U_FAILURE but it
32032e5b6d6dSopenharmony_ci           isn't documented as such. */
32042e5b6d6dSopenharmony_ci        if (script != (int32_t)USCRIPT_INVALID_CODE) {
32052e5b6d6dSopenharmony_ci            log_err("FAIL: %s = %d, exp. 0\n",
32062e5b6d6dSopenharmony_ci                    desc, script);
32072e5b6d6dSopenharmony_ci        }
32082e5b6d6dSopenharmony_ci    }
32092e5b6d6dSopenharmony_ci}
32102e5b6d6dSopenharmony_ci
32112e5b6d6dSopenharmony_ci/* various tests for consistency of UCD data and API behavior */
32122e5b6d6dSopenharmony_cistatic void
32132e5b6d6dSopenharmony_ciTestConsistency() {
32142e5b6d6dSopenharmony_ci    char buffer[300];
32152e5b6d6dSopenharmony_ci    USet *set1, *set2, *set3, *set4;
32162e5b6d6dSopenharmony_ci    UErrorCode errorCode;
32172e5b6d6dSopenharmony_ci
32182e5b6d6dSopenharmony_ci    UChar32 start, end;
32192e5b6d6dSopenharmony_ci    int32_t i, length;
32202e5b6d6dSopenharmony_ci
32212e5b6d6dSopenharmony_ci    U_STRING_DECL(hyphenPattern, "[:Hyphen:]", 10);
32222e5b6d6dSopenharmony_ci    U_STRING_DECL(dashPattern, "[:Dash:]", 8);
32232e5b6d6dSopenharmony_ci    U_STRING_DECL(lowerPattern, "[:Lowercase:]", 13);
32242e5b6d6dSopenharmony_ci    U_STRING_DECL(formatPattern, "[:Cf:]", 6);
32252e5b6d6dSopenharmony_ci    U_STRING_DECL(alphaPattern, "[:Alphabetic:]", 14);
32262e5b6d6dSopenharmony_ci
32272e5b6d6dSopenharmony_ci    U_STRING_DECL(mathBlocksPattern,
32282e5b6d6dSopenharmony_ci        "[[:block=Mathematical Operators:][:block=Miscellaneous Mathematical Symbols-A:][:block=Miscellaneous Mathematical Symbols-B:][:block=Supplemental Mathematical Operators:][:block=Mathematical Alphanumeric Symbols:]]",
32292e5b6d6dSopenharmony_ci        214);
32302e5b6d6dSopenharmony_ci    U_STRING_DECL(mathPattern, "[:Math:]", 8);
32312e5b6d6dSopenharmony_ci    U_STRING_DECL(unassignedPattern, "[:Cn:]", 6);
32322e5b6d6dSopenharmony_ci    U_STRING_DECL(unknownPattern, "[:sc=Unknown:]", 14);
32332e5b6d6dSopenharmony_ci    U_STRING_DECL(reservedPattern, "[[:Cn:][:Co:][:Cs:]]", 20);
32342e5b6d6dSopenharmony_ci
32352e5b6d6dSopenharmony_ci    U_STRING_INIT(hyphenPattern, "[:Hyphen:]", 10);
32362e5b6d6dSopenharmony_ci    U_STRING_INIT(dashPattern, "[:Dash:]", 8);
32372e5b6d6dSopenharmony_ci    U_STRING_INIT(lowerPattern, "[:Lowercase:]", 13);
32382e5b6d6dSopenharmony_ci    U_STRING_INIT(formatPattern, "[:Cf:]", 6);
32392e5b6d6dSopenharmony_ci    U_STRING_INIT(alphaPattern, "[:Alphabetic:]", 14);
32402e5b6d6dSopenharmony_ci
32412e5b6d6dSopenharmony_ci    U_STRING_INIT(mathBlocksPattern,
32422e5b6d6dSopenharmony_ci        "[[:block=Mathematical Operators:][:block=Miscellaneous Mathematical Symbols-A:][:block=Miscellaneous Mathematical Symbols-B:][:block=Supplemental Mathematical Operators:][:block=Mathematical Alphanumeric Symbols:]]",
32432e5b6d6dSopenharmony_ci        214);
32442e5b6d6dSopenharmony_ci    U_STRING_INIT(mathPattern, "[:Math:]", 8);
32452e5b6d6dSopenharmony_ci    U_STRING_INIT(unassignedPattern, "[:Cn:]", 6);
32462e5b6d6dSopenharmony_ci    U_STRING_INIT(unknownPattern, "[:sc=Unknown:]", 14);
32472e5b6d6dSopenharmony_ci    U_STRING_INIT(reservedPattern, "[[:Cn:][:Co:][:Cs:]]", 20);
32482e5b6d6dSopenharmony_ci
32492e5b6d6dSopenharmony_ci    /*
32502e5b6d6dSopenharmony_ci     * It used to be that UCD.html and its precursors said
32512e5b6d6dSopenharmony_ci     * "Those dashes used to mark connections between pieces of words,
32522e5b6d6dSopenharmony_ci     *  plus the Katakana middle dot."
32532e5b6d6dSopenharmony_ci     *
32542e5b6d6dSopenharmony_ci     * Unicode 4 changed 00AD Soft Hyphen to Cf and removed it from Dash
32552e5b6d6dSopenharmony_ci     * but not from Hyphen.
32562e5b6d6dSopenharmony_ci     * UTC 94 (2003mar) decided to leave it that way and to change UCD.html.
32572e5b6d6dSopenharmony_ci     * Therefore, do not show errors when testing the Hyphen property.
32582e5b6d6dSopenharmony_ci     */
32592e5b6d6dSopenharmony_ci    log_verbose("Starting with Unicode 4, inconsistencies with [:Hyphen:] are\n"
32602e5b6d6dSopenharmony_ci                "known to the UTC and not considered errors.\n");
32612e5b6d6dSopenharmony_ci
32622e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
32632e5b6d6dSopenharmony_ci    set1=uset_openPattern(hyphenPattern, 10, &errorCode);
32642e5b6d6dSopenharmony_ci    set2=uset_openPattern(dashPattern, 8, &errorCode);
32652e5b6d6dSopenharmony_ci    if(U_SUCCESS(errorCode)) {
32662e5b6d6dSopenharmony_ci        /* remove the Katakana middle dot(s) from set1 */
32672e5b6d6dSopenharmony_ci        uset_remove(set1, 0x30fb);
32682e5b6d6dSopenharmony_ci        uset_remove(set1, 0xff65); /* halfwidth variant */
32692e5b6d6dSopenharmony_ci        showAMinusB(set1, set2, "[:Hyphen:]", "[:Dash:]", false);
32702e5b6d6dSopenharmony_ci    } else {
32712e5b6d6dSopenharmony_ci        log_data_err("error opening [:Hyphen:] or [:Dash:] - %s (Are you missing data?)\n", u_errorName(errorCode));
32722e5b6d6dSopenharmony_ci    }
32732e5b6d6dSopenharmony_ci
32742e5b6d6dSopenharmony_ci    /* check that Cf is neither Hyphen nor Dash nor Alphabetic */
32752e5b6d6dSopenharmony_ci    set3=uset_openPattern(formatPattern, 6, &errorCode);
32762e5b6d6dSopenharmony_ci    set4=uset_openPattern(alphaPattern, 14, &errorCode);
32772e5b6d6dSopenharmony_ci    if(U_SUCCESS(errorCode)) {
32782e5b6d6dSopenharmony_ci        showAIntersectB(set3, set1, "[:Cf:]", "[:Hyphen:]", false);
32792e5b6d6dSopenharmony_ci        showAIntersectB(set3, set2, "[:Cf:]", "[:Dash:]", true);
32802e5b6d6dSopenharmony_ci        showAIntersectB(set3, set4, "[:Cf:]", "[:Alphabetic:]", true);
32812e5b6d6dSopenharmony_ci    } else {
32822e5b6d6dSopenharmony_ci        log_data_err("error opening [:Cf:] or [:Alpbabetic:] - %s (Are you missing data?)\n", u_errorName(errorCode));
32832e5b6d6dSopenharmony_ci    }
32842e5b6d6dSopenharmony_ci
32852e5b6d6dSopenharmony_ci    uset_close(set1);
32862e5b6d6dSopenharmony_ci    uset_close(set2);
32872e5b6d6dSopenharmony_ci    uset_close(set3);
32882e5b6d6dSopenharmony_ci    uset_close(set4);
32892e5b6d6dSopenharmony_ci
32902e5b6d6dSopenharmony_ci    /*
32912e5b6d6dSopenharmony_ci     * Check that each lowercase character has "small" in its name
32922e5b6d6dSopenharmony_ci     * and not "capital".
32932e5b6d6dSopenharmony_ci     * There are some such characters, some of which seem odd.
32942e5b6d6dSopenharmony_ci     * Use the verbose flag to see these notices.
32952e5b6d6dSopenharmony_ci     */
32962e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
32972e5b6d6dSopenharmony_ci    set1=uset_openPattern(lowerPattern, 13, &errorCode);
32982e5b6d6dSopenharmony_ci    if(U_SUCCESS(errorCode)) {
32992e5b6d6dSopenharmony_ci        for(i=0;; ++i) {
33002e5b6d6dSopenharmony_ci            length=uset_getItem(set1, i, &start, &end, NULL, 0, &errorCode);
33012e5b6d6dSopenharmony_ci            if(errorCode==U_INDEX_OUTOFBOUNDS_ERROR) {
33022e5b6d6dSopenharmony_ci                break; /* done */
33032e5b6d6dSopenharmony_ci            }
33042e5b6d6dSopenharmony_ci            if(U_FAILURE(errorCode)) {
33052e5b6d6dSopenharmony_ci                log_err("error iterating over [:Lowercase:] at item %d: %s\n",
33062e5b6d6dSopenharmony_ci                        i, u_errorName(errorCode));
33072e5b6d6dSopenharmony_ci                break;
33082e5b6d6dSopenharmony_ci            }
33092e5b6d6dSopenharmony_ci            if(length!=0) {
33102e5b6d6dSopenharmony_ci                break; /* done with code points, got a string or -1 */
33112e5b6d6dSopenharmony_ci            }
33122e5b6d6dSopenharmony_ci
33132e5b6d6dSopenharmony_ci            while(start<=end) {
33142e5b6d6dSopenharmony_ci                length=u_charName(start, U_UNICODE_CHAR_NAME, buffer, sizeof(buffer), &errorCode);
33152e5b6d6dSopenharmony_ci                if(U_FAILURE(errorCode)) {
33162e5b6d6dSopenharmony_ci                    log_data_err("error getting the name of U+%04x - %s\n", start, u_errorName(errorCode));
33172e5b6d6dSopenharmony_ci                    errorCode=U_ZERO_ERROR;
33182e5b6d6dSopenharmony_ci                }
33192e5b6d6dSopenharmony_ci                if( (strstr(buffer, "SMALL")==NULL || strstr(buffer, "CAPITAL")!=NULL) &&
33202e5b6d6dSopenharmony_ci                    strstr(buffer, "SMALL CAPITAL")==NULL
33212e5b6d6dSopenharmony_ci                ) {
33222e5b6d6dSopenharmony_ci                    log_verbose("info: [:Lowercase:] contains U+%04x whose name does not suggest lowercase: %s\n", start, buffer);
33232e5b6d6dSopenharmony_ci                }
33242e5b6d6dSopenharmony_ci                ++start;
33252e5b6d6dSopenharmony_ci            }
33262e5b6d6dSopenharmony_ci        }
33272e5b6d6dSopenharmony_ci    } else {
33282e5b6d6dSopenharmony_ci        log_data_err("error opening [:Lowercase:] - %s (Are you missing data?)\n", u_errorName(errorCode));
33292e5b6d6dSopenharmony_ci    }
33302e5b6d6dSopenharmony_ci    uset_close(set1);
33312e5b6d6dSopenharmony_ci
33322e5b6d6dSopenharmony_ci    /* verify that all assigned characters in Math blocks are exactly Math characters */
33332e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
33342e5b6d6dSopenharmony_ci    set1=uset_openPattern(mathBlocksPattern, -1, &errorCode);
33352e5b6d6dSopenharmony_ci    set2=uset_openPattern(mathPattern, 8, &errorCode);
33362e5b6d6dSopenharmony_ci    set3=uset_openPattern(unassignedPattern, 6, &errorCode);
33372e5b6d6dSopenharmony_ci    if(U_SUCCESS(errorCode)) {
33382e5b6d6dSopenharmony_ci        uset_retainAll(set2, set1); /* [math blocks]&[:Math:] */
33392e5b6d6dSopenharmony_ci        uset_complement(set3);      /* assigned characters */
33402e5b6d6dSopenharmony_ci        uset_retainAll(set1, set3); /* [math blocks]&[assigned] */
33412e5b6d6dSopenharmony_ci        compareUSets(set1, set2,
33422e5b6d6dSopenharmony_ci                     "[assigned Math block chars]", "[math blocks]&[:Math:]",
33432e5b6d6dSopenharmony_ci                     true);
33442e5b6d6dSopenharmony_ci    } else {
33452e5b6d6dSopenharmony_ci        log_data_err("error opening [math blocks] or [:Math:] or [:Cn:] - %s (Are you missing data?)\n", u_errorName(errorCode));
33462e5b6d6dSopenharmony_ci    }
33472e5b6d6dSopenharmony_ci    uset_close(set1);
33482e5b6d6dSopenharmony_ci    uset_close(set2);
33492e5b6d6dSopenharmony_ci    uset_close(set3);
33502e5b6d6dSopenharmony_ci
33512e5b6d6dSopenharmony_ci    /* new in Unicode 5.0: exactly all unassigned+PUA+surrogate code points have script=Unknown */
33522e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
33532e5b6d6dSopenharmony_ci    set1=uset_openPattern(unknownPattern, 14, &errorCode);
33542e5b6d6dSopenharmony_ci    set2=uset_openPattern(reservedPattern, 20, &errorCode);
33552e5b6d6dSopenharmony_ci    if(U_SUCCESS(errorCode)) {
33562e5b6d6dSopenharmony_ci        compareUSets(set1, set2,
33572e5b6d6dSopenharmony_ci                     "[:sc=Unknown:]", "[[:Cn:][:Co:][:Cs:]]",
33582e5b6d6dSopenharmony_ci                     true);
33592e5b6d6dSopenharmony_ci    } else {
33602e5b6d6dSopenharmony_ci        log_data_err("error opening [:sc=Unknown:] or [[:Cn:][:Co:][:Cs:]] - %s (Are you missing data?)\n", u_errorName(errorCode));
33612e5b6d6dSopenharmony_ci    }
33622e5b6d6dSopenharmony_ci    uset_close(set1);
33632e5b6d6dSopenharmony_ci    uset_close(set2);
33642e5b6d6dSopenharmony_ci}
33652e5b6d6dSopenharmony_ci
33662e5b6d6dSopenharmony_ci/* test case folding, compare return values with CaseFolding.txt ------------ */
33672e5b6d6dSopenharmony_ci
33682e5b6d6dSopenharmony_ci/* bit set for which case foldings for a character have been tested already */
33692e5b6d6dSopenharmony_cienum {
33702e5b6d6dSopenharmony_ci    CF_SIMPLE=1,
33712e5b6d6dSopenharmony_ci    CF_FULL=2,
33722e5b6d6dSopenharmony_ci    CF_TURKIC=4,
33732e5b6d6dSopenharmony_ci    CF_ALL=7
33742e5b6d6dSopenharmony_ci};
33752e5b6d6dSopenharmony_ci
33762e5b6d6dSopenharmony_cistatic void
33772e5b6d6dSopenharmony_citestFold(UChar32 c, int which,
33782e5b6d6dSopenharmony_ci         UChar32 simple, UChar32 turkic,
33792e5b6d6dSopenharmony_ci         const UChar *full, int32_t fullLength,
33802e5b6d6dSopenharmony_ci         const UChar *turkicFull, int32_t turkicFullLength) {
33812e5b6d6dSopenharmony_ci    UChar s[2], t[32];
33822e5b6d6dSopenharmony_ci    UChar32 c2;
33832e5b6d6dSopenharmony_ci    int32_t length, length2;
33842e5b6d6dSopenharmony_ci
33852e5b6d6dSopenharmony_ci    UErrorCode errorCode=U_ZERO_ERROR;
33862e5b6d6dSopenharmony_ci
33872e5b6d6dSopenharmony_ci    length=0;
33882e5b6d6dSopenharmony_ci    U16_APPEND_UNSAFE(s, length, c);
33892e5b6d6dSopenharmony_ci
33902e5b6d6dSopenharmony_ci    if((which&CF_SIMPLE)!=0 && (c2=u_foldCase(c, 0))!=simple) {
33912e5b6d6dSopenharmony_ci        log_err("u_foldCase(U+%04lx, default)=U+%04lx != U+%04lx\n", (long)c, (long)c2, (long)simple);
33922e5b6d6dSopenharmony_ci    }
33932e5b6d6dSopenharmony_ci    if((which&CF_FULL)!=0) {
33942e5b6d6dSopenharmony_ci        length2=u_strFoldCase(t, UPRV_LENGTHOF(t), s, length, 0, &errorCode);
33952e5b6d6dSopenharmony_ci        if(length2!=fullLength || 0!=u_memcmp(t, full, fullLength)) {
33962e5b6d6dSopenharmony_ci            log_err("u_strFoldCase(U+%04lx, default) does not fold properly\n", (long)c);
33972e5b6d6dSopenharmony_ci        }
33982e5b6d6dSopenharmony_ci    }
33992e5b6d6dSopenharmony_ci    if((which&CF_TURKIC)!=0) {
34002e5b6d6dSopenharmony_ci        if((c2=u_foldCase(c, U_FOLD_CASE_EXCLUDE_SPECIAL_I))!=turkic) {
34012e5b6d6dSopenharmony_ci            log_err("u_foldCase(U+%04lx, turkic)=U+%04lx != U+%04lx\n", (long)c, (long)c2, (long)simple);
34022e5b6d6dSopenharmony_ci        }
34032e5b6d6dSopenharmony_ci
34042e5b6d6dSopenharmony_ci        length2=u_strFoldCase(t, UPRV_LENGTHOF(t), s, length, U_FOLD_CASE_EXCLUDE_SPECIAL_I, &errorCode);
34052e5b6d6dSopenharmony_ci        if(length2!=turkicFullLength || 0!=u_memcmp(t, turkicFull, length2)) {
34062e5b6d6dSopenharmony_ci            log_err("u_strFoldCase(U+%04lx, turkic) does not fold properly\n", (long)c);
34072e5b6d6dSopenharmony_ci        }
34082e5b6d6dSopenharmony_ci    }
34092e5b6d6dSopenharmony_ci}
34102e5b6d6dSopenharmony_ci
34112e5b6d6dSopenharmony_ci/* test that c case-folds to itself */
34122e5b6d6dSopenharmony_cistatic void
34132e5b6d6dSopenharmony_citestFoldToSelf(UChar32 c, int which) {
34142e5b6d6dSopenharmony_ci    UChar s[2];
34152e5b6d6dSopenharmony_ci    int32_t length;
34162e5b6d6dSopenharmony_ci
34172e5b6d6dSopenharmony_ci    length=0;
34182e5b6d6dSopenharmony_ci    U16_APPEND_UNSAFE(s, length, c);
34192e5b6d6dSopenharmony_ci    testFold(c, which, c, c, s, length, s, length);
34202e5b6d6dSopenharmony_ci}
34212e5b6d6dSopenharmony_ci
34222e5b6d6dSopenharmony_cistruct CaseFoldingData {
34232e5b6d6dSopenharmony_ci    USet *notSeen;
34242e5b6d6dSopenharmony_ci    UChar32 prev, prevSimple;
34252e5b6d6dSopenharmony_ci    UChar prevFull[32];
34262e5b6d6dSopenharmony_ci    int32_t prevFullLength;
34272e5b6d6dSopenharmony_ci    int which;
34282e5b6d6dSopenharmony_ci};
34292e5b6d6dSopenharmony_citypedef struct CaseFoldingData CaseFoldingData;
34302e5b6d6dSopenharmony_ci
34312e5b6d6dSopenharmony_cistatic void U_CALLCONV
34322e5b6d6dSopenharmony_cicaseFoldingLineFn(void *context,
34332e5b6d6dSopenharmony_ci                  char *fields[][2], int32_t fieldCount,
34342e5b6d6dSopenharmony_ci                  UErrorCode *pErrorCode) {
34352e5b6d6dSopenharmony_ci    (void)fieldCount; // suppress compiler warnings about unused variable
34362e5b6d6dSopenharmony_ci
34372e5b6d6dSopenharmony_ci    CaseFoldingData *pData=(CaseFoldingData *)context;
34382e5b6d6dSopenharmony_ci    char *end;
34392e5b6d6dSopenharmony_ci    UChar full[32];
34402e5b6d6dSopenharmony_ci    UChar32 c, prev, simple;
34412e5b6d6dSopenharmony_ci    int32_t count;
34422e5b6d6dSopenharmony_ci    int which;
34432e5b6d6dSopenharmony_ci    char status;
34442e5b6d6dSopenharmony_ci
34452e5b6d6dSopenharmony_ci    /* get code point */
34462e5b6d6dSopenharmony_ci    const char *s=u_skipWhitespace(fields[0][0]);
34472e5b6d6dSopenharmony_ci    if(0==strncmp(s, "0000..10FFFF", 12)) {
34482e5b6d6dSopenharmony_ci        /*
34492e5b6d6dSopenharmony_ci         * Ignore the line
34502e5b6d6dSopenharmony_ci         * # @missing: 0000..10FFFF; C; <code point>
34512e5b6d6dSopenharmony_ci         * because maps-to-self is already our default, and this line breaks this parser.
34522e5b6d6dSopenharmony_ci         */
34532e5b6d6dSopenharmony_ci        return;
34542e5b6d6dSopenharmony_ci    }
34552e5b6d6dSopenharmony_ci    c=(UChar32)strtoul(s, &end, 16);
34562e5b6d6dSopenharmony_ci    end=(char *)u_skipWhitespace(end);
34572e5b6d6dSopenharmony_ci    if(end<=fields[0][0] || end!=fields[0][1]) {
34582e5b6d6dSopenharmony_ci        log_err("syntax error in CaseFolding.txt field 0 at %s\n", fields[0][0]);
34592e5b6d6dSopenharmony_ci        *pErrorCode=U_PARSE_ERROR;
34602e5b6d6dSopenharmony_ci        return;
34612e5b6d6dSopenharmony_ci    }
34622e5b6d6dSopenharmony_ci
34632e5b6d6dSopenharmony_ci    /* get the status of this mapping */
34642e5b6d6dSopenharmony_ci    status=*u_skipWhitespace(fields[1][0]);
34652e5b6d6dSopenharmony_ci    if(status!='C' && status!='S' && status!='F' && status!='T') {
34662e5b6d6dSopenharmony_ci        log_err("unrecognized status field in CaseFolding.txt at %s\n", fields[0][0]);
34672e5b6d6dSopenharmony_ci        *pErrorCode=U_PARSE_ERROR;
34682e5b6d6dSopenharmony_ci        return;
34692e5b6d6dSopenharmony_ci    }
34702e5b6d6dSopenharmony_ci
34712e5b6d6dSopenharmony_ci    /* get the mapping */
34722e5b6d6dSopenharmony_ci    count=u_parseString(fields[2][0], full, 32, (uint32_t *)&simple, pErrorCode);
34732e5b6d6dSopenharmony_ci    if(U_FAILURE(*pErrorCode)) {
34742e5b6d6dSopenharmony_ci        log_err("error parsing CaseFolding.txt mapping at %s\n", fields[0][0]);
34752e5b6d6dSopenharmony_ci        return;
34762e5b6d6dSopenharmony_ci    }
34772e5b6d6dSopenharmony_ci
34782e5b6d6dSopenharmony_ci    /* there is a simple mapping only if there is exactly one code point (count is in UChars) */
34792e5b6d6dSopenharmony_ci    if(count==0 || count>2 || (count==2 && U16_IS_SINGLE(full[1]))) {
34802e5b6d6dSopenharmony_ci        simple=c;
34812e5b6d6dSopenharmony_ci    }
34822e5b6d6dSopenharmony_ci
34832e5b6d6dSopenharmony_ci    if(c!=(prev=pData->prev)) {
34842e5b6d6dSopenharmony_ci        /*
34852e5b6d6dSopenharmony_ci         * Test remaining mappings for the previous code point.
34862e5b6d6dSopenharmony_ci         * If a turkic folding was not mentioned, then it should fold the same
34872e5b6d6dSopenharmony_ci         * as the regular simple case folding.
34882e5b6d6dSopenharmony_ci         */
34892e5b6d6dSopenharmony_ci        UChar prevString[2];
34902e5b6d6dSopenharmony_ci        int32_t length;
34912e5b6d6dSopenharmony_ci
34922e5b6d6dSopenharmony_ci        length=0;
34932e5b6d6dSopenharmony_ci        U16_APPEND_UNSAFE(prevString, length, prev);
34942e5b6d6dSopenharmony_ci        testFold(prev, (~pData->which)&CF_ALL,
34952e5b6d6dSopenharmony_ci                 prev, pData->prevSimple,
34962e5b6d6dSopenharmony_ci                 prevString, length,
34972e5b6d6dSopenharmony_ci                 pData->prevFull, pData->prevFullLength);
34982e5b6d6dSopenharmony_ci        pData->prev=pData->prevSimple=c;
34992e5b6d6dSopenharmony_ci        length=0;
35002e5b6d6dSopenharmony_ci        U16_APPEND_UNSAFE(pData->prevFull, length, c);
35012e5b6d6dSopenharmony_ci        pData->prevFullLength=length;
35022e5b6d6dSopenharmony_ci        pData->which=0;
35032e5b6d6dSopenharmony_ci    }
35042e5b6d6dSopenharmony_ci
35052e5b6d6dSopenharmony_ci    /*
35062e5b6d6dSopenharmony_ci     * Turn the status into a bit set of case foldings to test.
35072e5b6d6dSopenharmony_ci     * Remember non-Turkic case foldings as defaults for Turkic mode.
35082e5b6d6dSopenharmony_ci     */
35092e5b6d6dSopenharmony_ci    switch(status) {
35102e5b6d6dSopenharmony_ci    case 'C':
35112e5b6d6dSopenharmony_ci        which=CF_SIMPLE|CF_FULL;
35122e5b6d6dSopenharmony_ci        pData->prevSimple=simple;
35132e5b6d6dSopenharmony_ci        u_memcpy(pData->prevFull, full, count);
35142e5b6d6dSopenharmony_ci        pData->prevFullLength=count;
35152e5b6d6dSopenharmony_ci        break;
35162e5b6d6dSopenharmony_ci    case 'S':
35172e5b6d6dSopenharmony_ci        which=CF_SIMPLE;
35182e5b6d6dSopenharmony_ci        pData->prevSimple=simple;
35192e5b6d6dSopenharmony_ci        break;
35202e5b6d6dSopenharmony_ci    case 'F':
35212e5b6d6dSopenharmony_ci        which=CF_FULL;
35222e5b6d6dSopenharmony_ci        u_memcpy(pData->prevFull, full, count);
35232e5b6d6dSopenharmony_ci        pData->prevFullLength=count;
35242e5b6d6dSopenharmony_ci        break;
35252e5b6d6dSopenharmony_ci    case 'T':
35262e5b6d6dSopenharmony_ci        which=CF_TURKIC;
35272e5b6d6dSopenharmony_ci        break;
35282e5b6d6dSopenharmony_ci    default:
35292e5b6d6dSopenharmony_ci        which=0;
35302e5b6d6dSopenharmony_ci        break; /* won't happen because of test above */
35312e5b6d6dSopenharmony_ci    }
35322e5b6d6dSopenharmony_ci
35332e5b6d6dSopenharmony_ci    testFold(c, which, simple, simple, full, count, full, count);
35342e5b6d6dSopenharmony_ci
35352e5b6d6dSopenharmony_ci    /* remember which case foldings of c have been tested */
35362e5b6d6dSopenharmony_ci    pData->which|=which;
35372e5b6d6dSopenharmony_ci
35382e5b6d6dSopenharmony_ci    /* remove c from the set of ones not mentioned in CaseFolding.txt */
35392e5b6d6dSopenharmony_ci    uset_remove(pData->notSeen, c);
35402e5b6d6dSopenharmony_ci}
35412e5b6d6dSopenharmony_ci
35422e5b6d6dSopenharmony_cistatic void
35432e5b6d6dSopenharmony_ciTestCaseFolding() {
35442e5b6d6dSopenharmony_ci    CaseFoldingData data={ NULL, 0, 0, {0}, 0, 0 };
35452e5b6d6dSopenharmony_ci    char *fields[3][2];
35462e5b6d6dSopenharmony_ci    UErrorCode errorCode;
35472e5b6d6dSopenharmony_ci
35482e5b6d6dSopenharmony_ci    static char *lastLine= (char *)"10FFFF; C; 10FFFF;";
35492e5b6d6dSopenharmony_ci
35502e5b6d6dSopenharmony_ci    errorCode=U_ZERO_ERROR;
35512e5b6d6dSopenharmony_ci    /* test BMP & plane 1 - nothing interesting above */
35522e5b6d6dSopenharmony_ci    data.notSeen=uset_open(0, 0x1ffff);
35532e5b6d6dSopenharmony_ci    data.prevFullLength=1; /* length of full case folding of U+0000 */
35542e5b6d6dSopenharmony_ci
35552e5b6d6dSopenharmony_ci    parseUCDFile("CaseFolding.txt", fields, 3, caseFoldingLineFn, &data, &errorCode);
35562e5b6d6dSopenharmony_ci    if(U_SUCCESS(errorCode)) {
35572e5b6d6dSopenharmony_ci        int32_t i, start, end;
35582e5b6d6dSopenharmony_ci
35592e5b6d6dSopenharmony_ci        /* add a pseudo-last line to finish testing of the actual last one */
35602e5b6d6dSopenharmony_ci        fields[0][0]=lastLine;
35612e5b6d6dSopenharmony_ci        fields[0][1]=lastLine+6;
35622e5b6d6dSopenharmony_ci        fields[1][0]=lastLine+7;
35632e5b6d6dSopenharmony_ci        fields[1][1]=lastLine+9;
35642e5b6d6dSopenharmony_ci        fields[2][0]=lastLine+10;
35652e5b6d6dSopenharmony_ci        fields[2][1]=lastLine+17;
35662e5b6d6dSopenharmony_ci        caseFoldingLineFn(&data, fields, 3, &errorCode);
35672e5b6d6dSopenharmony_ci
35682e5b6d6dSopenharmony_ci        /* verify that all code points that are not mentioned in CaseFolding.txt fold to themselves */
35692e5b6d6dSopenharmony_ci        for(i=0;
35702e5b6d6dSopenharmony_ci            0==uset_getItem(data.notSeen, i, &start, &end, NULL, 0, &errorCode) &&
35712e5b6d6dSopenharmony_ci                U_SUCCESS(errorCode);
35722e5b6d6dSopenharmony_ci            ++i
35732e5b6d6dSopenharmony_ci        ) {
35742e5b6d6dSopenharmony_ci            do {
35752e5b6d6dSopenharmony_ci                testFoldToSelf(start, CF_ALL);
35762e5b6d6dSopenharmony_ci            } while(++start<=end);
35772e5b6d6dSopenharmony_ci        }
35782e5b6d6dSopenharmony_ci    }
35792e5b6d6dSopenharmony_ci
35802e5b6d6dSopenharmony_ci    uset_close(data.notSeen);
35812e5b6d6dSopenharmony_ci}
35822e5b6d6dSopenharmony_ci
35832e5b6d6dSopenharmony_cistatic void TestBinaryCharacterPropertiesAPI() {
35842e5b6d6dSopenharmony_ci    // API test only. See intltest/ucdtest.cpp for functional test.
35852e5b6d6dSopenharmony_ci    UErrorCode errorCode = U_ZERO_ERROR;
35862e5b6d6dSopenharmony_ci    const USet *set = u_getBinaryPropertySet(-1, &errorCode);
35872e5b6d6dSopenharmony_ci    if (U_SUCCESS(errorCode)) {
35882e5b6d6dSopenharmony_ci        log_err("u_getBinaryPropertySet(-1) did not fail\n");
35892e5b6d6dSopenharmony_ci    }
35902e5b6d6dSopenharmony_ci    errorCode = U_ZERO_ERROR;
35912e5b6d6dSopenharmony_ci    set = u_getBinaryPropertySet(UCHAR_BINARY_LIMIT, &errorCode);
35922e5b6d6dSopenharmony_ci    if (U_SUCCESS(errorCode)) {
35932e5b6d6dSopenharmony_ci        log_err("u_getBinaryPropertySet(UCHAR_BINARY_LIMIT) did not fail\n");
35942e5b6d6dSopenharmony_ci    }
35952e5b6d6dSopenharmony_ci    errorCode = U_ZERO_ERROR;
35962e5b6d6dSopenharmony_ci    set = u_getBinaryPropertySet(UCHAR_WHITE_SPACE, &errorCode);
35972e5b6d6dSopenharmony_ci    if (!uset_contains(set, 0x20) || uset_contains(set, 0x61)) {
35982e5b6d6dSopenharmony_ci        log_err("u_getBinaryPropertySet(UCHAR_WHITE_SPACE) wrong contents\n");
35992e5b6d6dSopenharmony_ci    }
36002e5b6d6dSopenharmony_ci}
36012e5b6d6dSopenharmony_ci
36022e5b6d6dSopenharmony_cistatic void TestIntCharacterPropertiesAPI() {
36032e5b6d6dSopenharmony_ci    // API test only. See intltest/ucdtest.cpp for functional test.
36042e5b6d6dSopenharmony_ci    UErrorCode errorCode = U_ZERO_ERROR;
36052e5b6d6dSopenharmony_ci    const UCPMap *map = u_getIntPropertyMap(UCHAR_INT_START - 1, &errorCode);
36062e5b6d6dSopenharmony_ci    if (U_SUCCESS(errorCode)) {
36072e5b6d6dSopenharmony_ci        log_err("u_getIntPropertyMap(UCHAR_INT_START - 1) did not fail\n");
36082e5b6d6dSopenharmony_ci    }
36092e5b6d6dSopenharmony_ci    errorCode = U_ZERO_ERROR;
36102e5b6d6dSopenharmony_ci    map = u_getIntPropertyMap(UCHAR_INT_LIMIT, &errorCode);
36112e5b6d6dSopenharmony_ci    if (U_SUCCESS(errorCode)) {
36122e5b6d6dSopenharmony_ci        log_err("u_getIntPropertyMap(UCHAR_INT_LIMIT) did not fail\n");
36132e5b6d6dSopenharmony_ci    }
36142e5b6d6dSopenharmony_ci    errorCode = U_ZERO_ERROR;
36152e5b6d6dSopenharmony_ci    map = u_getIntPropertyMap(UCHAR_GENERAL_CATEGORY, &errorCode);
36162e5b6d6dSopenharmony_ci    if (ucpmap_get(map, 0x20) != U_SPACE_SEPARATOR || ucpmap_get(map, 0x23456) != U_OTHER_LETTER) {
36172e5b6d6dSopenharmony_ci        log_err("u_getIntPropertyMap(UCHAR_GENERAL_CATEGORY) wrong contents\n");
36182e5b6d6dSopenharmony_ci    }
36192e5b6d6dSopenharmony_ci}
3620