X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/729e4ab9bc6618bc3d8a898e575df7f4019e29ca..b331163bffd790ced0e88b73f44f86d49ccc48a5:/icuSources/test/intltest/usettest.cpp diff --git a/icuSources/test/intltest/usettest.cpp b/icuSources/test/intltest/usettest.cpp index 682e3a03..3f1713d3 100644 --- a/icuSources/test/intltest/usettest.cpp +++ b/icuSources/test/intltest/usettest.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 1999-2010 International Business Machines Corporation and +* Copyright (C) 1999-2014 International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************** * Date Name Description @@ -24,8 +24,6 @@ #include "unicode/uversion.h" #include "hash.h" -#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) - #define TEST_ASSERT_SUCCESS(status) {if (U_FAILURE(status)) { \ dataerrln("fail in file \"%s\", line %d: \"%s\"", __FILE__, __LINE__, \ u_errorName(status));}} @@ -1049,12 +1047,12 @@ void UnicodeSetTest::TestPropertySet() { // Script_Extensions, new in Unicode 6.0 "[:scx=Arab:]", "\\u061E\\u061F\\u0620\\u0621\\u063F\\u0640\\u0650\\u065E\\uFDF1\\uFDF2\\uFDF3", - "\\u061D\\u065F\\uFDEF\\uFDFE", + "\\u061D\\uFDEF\\uFDFE", // U+FDF2 has Script=Arabic and also Arab in its Script_Extensions, // so scx-sc is missing U+FDF2. "[[:Script_Extensions=Arabic:]-[:Arab:]]", - "\\u0640\\u064B\\u0650\\u0655\\uFDFD", + "\\u0640\\u064B\\u0650\\u0655", "\\uFDF2" }; @@ -1388,7 +1386,7 @@ void UnicodeSetTest::TestEscapePattern() { const char exp[] = "[\\u200A-\\u200E\\uFEFF\\U0001D173-\\U0001D17A\\U000F0000-\\U000FFFFD]"; // We test this with two passes; in the second pass we - // pre-unescape the pattern. Since U+200E is rule whitespace, + // pre-unescape the pattern. Since U+200E is Pattern_White_Space, // this fails -- which is what we expect. for (int32_t pass=1; pass<=2; ++pass) { UErrorCode ec = U_ZERO_ERROR; @@ -1488,6 +1486,7 @@ void UnicodeSetTest::TestInvalidCodePoint() { b = set.contains(start, end); b = set.containsNone(start, end); b = set.containsSome(start, end); + (void)b; // Suppress set but not used warning. /*int32_t index = set.indexOf(start);*/ @@ -1573,7 +1572,7 @@ public: Hashtable contents; TokenSymbolTable(UErrorCode& ec) : contents(FALSE, ec) { - contents.setValueDeleter(uhash_deleteUnicodeString); + contents.setValueDeleter(uprv_deleteUObject); } ~TokenSymbolTable() {} @@ -2321,7 +2320,7 @@ public: const UnicodeString *s; char *s8=utf8; int32_t length8, utf8Count=0; - while(iter.nextRange() && stringsLengthLENGTHOF(limits)) { + if(limitsCount>UPRV_LENGTHOF(limits)) { errln("FAIL: %s[0x%lx].%s.%s span count=%ld > %ld capacity - too many spans", - testName, (long)index, setNames[i], typeName, (long)limitsCount, (long)LENGTHOF(limits)); + testName, (long)index, setNames[i], typeName, (long)limitsCount, (long)UPRV_LENGTHOF(limits)); return; } memcpy(expectLimits, limits, limitsCount*4); @@ -3300,7 +3278,7 @@ void UnicodeSetTest::testSpanContents(const UnicodeSetWithStrings *sets[4], uint UChar32 c, first; for(first=c=0;; c=nextCodePoint(c)) { - if(c>0x10ffff || length>(LENGTHOF(s)-U16_MAX_LENGTH)) { + if(c>0x10ffff || length>(UPRV_LENGTHOF(s)-U16_MAX_LENGTH)) { localWhichSpans=whichSpans; if(stringContainsUnpairedSurrogate(s, length) && inconsistentSurrogates) { localWhichSpans&=~SPAN_UTF8; @@ -3336,7 +3314,7 @@ void UnicodeSetTest::testSpanUTF16String(const UnicodeSetWithStrings *sets[4], u return; } testSpan(sets, s, -1, TRUE, (whichSpans&~SPAN_UTF8), testName, 0); - testSpan(sets, s, LENGTHOF(s)-1, TRUE, (whichSpans&~SPAN_UTF8), testName, 1); + testSpan(sets, s, UPRV_LENGTHOF(s)-1, TRUE, (whichSpans&~SPAN_UTF8), testName, 1); } void UnicodeSetTest::testSpanUTF8String(const UnicodeSetWithStrings *sets[4], uint32_t whichSpans, const char *testName) { @@ -3433,7 +3411,7 @@ void UnicodeSetTest::testSpanUTF8String(const UnicodeSetWithStrings *sets[4], ui return; } testSpan(sets, s, -1, FALSE, (whichSpans&~SPAN_UTF16), testName, 0); - testSpan(sets, s, LENGTHOF(s)-1, FALSE, (whichSpans&~SPAN_UTF16), testName, 1); + testSpan(sets, s, UPRV_LENGTHOF(s)-1, FALSE, (whichSpans&~SPAN_UTF16), testName, 1); } // Take a set of span options and multiply them so that @@ -3635,7 +3613,7 @@ void UnicodeSetTest::TestSpan() { char *testNameLimit=testName; int32_t i, j; - for(i=0; i