X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b331163bffd790ced0e88b73f44f86d49ccc48a5..HEAD:/icuSources/test/cintltst/callcoll.c diff --git a/icuSources/test/cintltst/callcoll.c b/icuSources/test/cintltst/callcoll.c index 8e7f9a57..3df50f74 100644 --- a/icuSources/test/cintltst/callcoll.c +++ b/icuSources/test/cintltst/callcoll.c @@ -1,3 +1,5 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /******************************************************************** * COPYRIGHT: * Copyright (c) 1997-2014, International Business Machines Corporation and @@ -91,6 +93,8 @@ static void TestFCDCrash(void); static void TestJ5298(void); +static void TestBadKey(void); + const UCollationResult results[] = { UCOL_LESS, UCOL_LESS, /*UCOL_GREATER,*/ @@ -208,13 +212,14 @@ void addAllCollTest(TestNode** root) addTest(root, &TestJitterbug1098, "tscoll/callcoll/TestJitterbug1098"); addTest(root, &TestFCDCrash, "tscoll/callcoll/TestFCDCrash"); addTest(root, &TestJ5298, "tscoll/callcoll/TestJ5298"); + addTest(root, &TestBadKey, "tscoll/callcoll/TestBadKey"); } UBool hasCollationElements(const char *locName) { UErrorCode status = U_ZERO_ERROR; - UResourceBundle *loc = ures_open(U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "coll", locName, &status);; + UResourceBundle *loc = ures_open(U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "coll", locName, &status); if(U_SUCCESS(status)) { status = U_ZERO_ERROR; @@ -411,7 +416,7 @@ static void doTestVariant(UCollator* myCollation, const UChar source[], const UC ucol_getSortKey(myCollation, target, -1, sortKey2a, sortklen2+1); /* Check that sort key generated with null terminated string is identical */ - /* to that generted with a length specified. */ + /* to that generated with a length specified. */ if (uprv_strcmp((const char *)sortKey1, (const char *)sortKey1a) != 0 || uprv_strcmp((const char *)sortKey2, (const char *)sortKey2a) != 0 ) { log_err("Sort Keys from null terminated and explicit length strings differ.\n"); @@ -419,8 +424,8 @@ static void doTestVariant(UCollator* myCollation, const UChar source[], const UC /*memcmp(sortKey1, sortKey2,sortklenmax);*/ temp= uprv_strcmp((const char *)sortKey1, (const char *)sortKey2); - gSortklen1 = uprv_strlen((const char *)sortKey1)+1; - gSortklen2 = uprv_strlen((const char *)sortKey2)+1; + gSortklen1 = (int)uprv_strlen((const char *)sortKey1)+1; + gSortklen2 = (int)uprv_strlen((const char *)sortKey2)+1; if(sortklen1 != gSortklen1){ log_err("SortKey length does not match Expected: %i Got: %i\n",sortklen1, gSortklen1); log_verbose("Generated sortkey: %s\n", sortKeyToString(myCollation, sortKey1, buffer, &len)); @@ -740,7 +745,7 @@ static void TestTertiary() UErrorCode status=U_ZERO_ERROR; static const char str[]="& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 "; UChar rules[sizeof(str)]; - len = strlen(str); + len = (int32_t)strlen(str); u_uastrcpy(rules, str); myCollation=ucol_openRules(rules, len, UCOL_OFF, UCOL_DEFAULT_STRENGTH, NULL, &status); @@ -765,7 +770,7 @@ static void TestPrimary( ) UErrorCode status=U_ZERO_ERROR; static const char str[]="& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 "; UChar rules[sizeof(str)]; - len = strlen(str); + len = (int32_t)strlen(str); u_uastrcpy(rules, str); myCollation=ucol_openRules(rules, len, UCOL_OFF, UCOL_DEFAULT_STRENGTH,NULL, &status); @@ -792,7 +797,7 @@ static void TestSecondary() UErrorCode status=U_ZERO_ERROR; static const char str[]="& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 "; UChar rules[sizeof(str)]; - len = strlen(str); + len = (int32_t)strlen(str); u_uastrcpy(rules, str); myCollation=ucol_openRules(rules, len, UCOL_OFF, UCOL_DEFAULT_STRENGTH,NULL, &status); @@ -817,7 +822,7 @@ static void TestIdentical() UErrorCode status=U_ZERO_ERROR; static const char str[]="& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 "; UChar rules[sizeof(str)]; - len = strlen(str); + len = (int32_t)strlen(str); u_uastrcpy(rules, str); myCollation=ucol_openRules(rules, len, UCOL_OFF, UCOL_IDENTICAL, NULL,&status); @@ -841,7 +846,7 @@ static void TestExtra() UErrorCode status = U_ZERO_ERROR; static const char str[]="& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 "; UChar rules[sizeof(str)]; - len = strlen(str); + len = (int32_t)strlen(str); u_uastrcpy(rules, str); myCollation=ucol_openRules(rules, len, UCOL_OFF, UCOL_DEFAULT_STRENGTH,NULL, &status); @@ -1097,7 +1102,7 @@ static void TestSurrogates(void) { static const char str[] = "&z<'\\uD800\\uDC00'<'\\uD800\\uDC0A\\u0308'