OLD | NEW |
1 /******************************************************************** | 1 /******************************************************************** |
2 * Copyright (c) 1997-2014, International Business Machines | 2 * Copyright (c) 1997-2014, International Business Machines |
3 * Corporation and others. All Rights Reserved. | 3 * Corporation and others. All Rights Reserved. |
4 ********************************************************************/ | 4 ********************************************************************/ |
5 /***************************************************************************** | 5 /***************************************************************************** |
6 * | 6 * |
7 * File CAPITEST.C | 7 * File CAPITEST.C |
8 * | 8 * |
9 * Modification History: | 9 * Modification History: |
10 * Name Description | 10 * Name Description |
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 if(strcmp(locale, testStruct[i].validLocale) != 0) { | 1439 if(strcmp(locale, testStruct[i].validLocale) != 0) { |
1440 log_err("[Coll %s]: Error in valid locale, expected %s, got %s\n", testStr
uct[i].requestedLocale, testStruct[i].validLocale, locale); | 1440 log_err("[Coll %s]: Error in valid locale, expected %s, got %s\n", testStr
uct[i].requestedLocale, testStruct[i].validLocale, locale); |
1441 } | 1441 } |
1442 locale = ucol_getLocaleByType(coll, ULOC_ACTUAL_LOCALE, &status); | 1442 locale = ucol_getLocaleByType(coll, ULOC_ACTUAL_LOCALE, &status); |
1443 if(strcmp(locale, testStruct[i].actualLocale) != 0) { | 1443 if(strcmp(locale, testStruct[i].actualLocale) != 0) { |
1444 log_err("[Coll %s]: Error in actual locale, expected %s, got %s\n", testSt
ruct[i].requestedLocale, testStruct[i].actualLocale, locale); | 1444 log_err("[Coll %s]: Error in actual locale, expected %s, got %s\n", testSt
ruct[i].requestedLocale, testStruct[i].actualLocale, locale); |
1445 } | 1445 } |
1446 ucol_close(coll); | 1446 ucol_close(coll); |
1447 } | 1447 } |
1448 | 1448 |
1449 /* completely non-existant locale for collator should get a default collator *
/ | 1449 /* completely non-existent locale for collator should get a root collator */ |
1450 { | 1450 { |
1451 UCollator *defaultColl = ucol_open(NULL, &status); | 1451 UCollator *defaultColl = ucol_open(NULL, &status); |
1452 coll = ucol_open("blahaha", &status); | 1452 coll = ucol_open("blahaha", &status); |
1453 if(U_SUCCESS(status)) { | 1453 if(U_SUCCESS(status)) { |
1454 /* See comment above about ticket #10477. | 1454 /* See comment above about ticket #10477. |
1455 if(strcmp(ucol_getLocaleByType(coll, ULOC_REQUESTED_LOCALE, &status), "bla
haha")) { | 1455 if(strcmp(ucol_getLocaleByType(coll, ULOC_REQUESTED_LOCALE, &status), "bla
haha")) { |
1456 log_err("Nonexisting locale didn't preserve the requested locale\n"); | 1456 log_err("Nonexisting locale didn't preserve the requested locale\n"); |
1457 } */ | 1457 } */ |
1458 if(strcmp(ucol_getLocaleByType(coll, ULOC_VALID_LOCALE, &status), | 1458 const char *name = ucol_getLocaleByType(coll, ULOC_VALID_LOCALE, &status); |
1459 ucol_getLocaleByType(defaultColl, ULOC_VALID_LOCALE, &status))) { | 1459 if(*name != 0 && strcmp(name, "root") != 0) { |
1460 log_err("Valid locale for nonexisting locale locale collator differs " | 1460 log_err("Valid locale for nonexisting-locale collator is \"%s\" not root
\n", name); |
1461 "from valid locale for default collator\n"); | |
1462 } | 1461 } |
1463 if(strcmp(ucol_getLocaleByType(coll, ULOC_ACTUAL_LOCALE, &status), | 1462 name = ucol_getLocaleByType(coll, ULOC_ACTUAL_LOCALE, &status); |
1464 ucol_getLocaleByType(defaultColl, ULOC_ACTUAL_LOCALE, &status))) { | 1463 if(*name != 0 && strcmp(name, "root") != 0) { |
1465 log_err("Actual locale for nonexisting locale locale collator differs " | 1464 log_err("Actual locale for nonexisting-locale collator is \"%s\" not roo
t\n", name); |
1466 "from actual locale for default collator\n"); | |
1467 } | 1465 } |
1468 ucol_close(coll); | 1466 ucol_close(coll); |
1469 ucol_close(defaultColl); | 1467 ucol_close(defaultColl); |
1470 } else { | 1468 } else { |
1471 log_data_err("Couldn't open collators\n"); | 1469 log_data_err("Couldn't open collators\n"); |
1472 } | 1470 } |
1473 } | 1471 } |
1474 | 1472 |
1475 | 1473 |
1476 | 1474 |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2417 { "zh__PINYIN", "pinyin", "stroke", "eor", "search", "standard",
NULL }, | 2415 { "zh__PINYIN", "pinyin", "stroke", "eor", "search", "standard",
NULL }, |
2418 { "es_ES", "standard", "search", "traditional", "eor", NULL
, NULL, NULL, NULL, NULL }, | 2416 { "es_ES", "standard", "search", "traditional", "eor", NULL
, NULL, NULL, NULL, NULL }, |
2419 { "es__TRADITIONAL","traditional", "search", "standard", "eor", NULL
, NULL, NULL, NULL, NULL }, | 2417 { "es__TRADITIONAL","traditional", "search", "standard", "eor", NULL
, NULL, NULL, NULL, NULL }, |
2420 { "und@collation=phonebook", "standard", "eor", "search", NULL, N
ULL, NULL, NULL, NULL, NULL }, | 2418 { "und@collation=phonebook", "standard", "eor", "search", NULL, N
ULL, NULL, NULL, NULL, NULL }, |
2421 { "de_DE@collation=pinyin", "standard", "phonebook", "search", "
eor", NULL, NULL, NULL, NULL, NULL }, | 2419 { "de_DE@collation=pinyin", "standard", "phonebook", "search", "
eor", NULL, NULL, NULL, NULL, NULL }, |
2422 { "zzz@collation=xxx", "standard", "eor", "search", NULL, N
ULL, NULL, NULL, NULL, NULL } | 2420 { "zzz@collation=xxx", "standard", "eor", "search", NULL, N
ULL, NULL, NULL, NULL, NULL } |
2423 }; | 2421 }; |
2424 | 2422 |
2425 UErrorCode status = U_ZERO_ERROR; | 2423 UErrorCode status = U_ZERO_ERROR; |
2426 UEnumeration *keywordValues = NULL; | 2424 UEnumeration *keywordValues = NULL; |
2427 int32_t i, n, size, valueLength; | 2425 int32_t i, n, size; |
2428 const char *locale = NULL, *value = NULL; | 2426 const char *locale = NULL, *value = NULL; |
2429 UBool errorOccurred = FALSE; | 2427 UBool errorOccurred = FALSE; |
2430 | 2428 |
2431 for (i = 0; i < UPRV_LENGTHOF(PREFERRED) && !errorOccurred; i++) { | 2429 for (i = 0; i < UPRV_LENGTHOF(PREFERRED) && !errorOccurred; i++) { |
2432 locale = PREFERRED[i][0]; | 2430 locale = PREFERRED[i][0]; |
2433 value = NULL; | 2431 value = NULL; |
2434 valueLength = 0; | |
2435 size = 0; | 2432 size = 0; |
2436 | 2433 |
2437 keywordValues = ucol_getKeywordValuesForLocale("collation", locale, TRUE
, &status); | 2434 keywordValues = ucol_getKeywordValuesForLocale("collation", locale, TRUE
, &status); |
2438 if (keywordValues == NULL || U_FAILURE(status)) { | 2435 if (keywordValues == NULL || U_FAILURE(status)) { |
2439 log_err_status(status, "Error getting keyword values: %s\n", u_error
Name(status)); | 2436 log_err_status(status, "Error getting keyword values: %s\n", u_error
Name(status)); |
2440 break; | 2437 break; |
2441 } | 2438 } |
2442 size = uenum_count(keywordValues, &status); | 2439 size = uenum_count(keywordValues, &status); |
| 2440 (void)size; |
2443 | 2441 |
2444 for (n = 0; (value = PREFERRED[i][n+1]) != NULL; n++) { | 2442 for (n = 0; (value = PREFERRED[i][n+1]) != NULL; n++) { |
2445 if (!uenum_contains(keywordValues, value, &status)) { | 2443 if (!uenum_contains(keywordValues, value, &status)) { |
2446 if (U_SUCCESS(status)) { | 2444 if (U_SUCCESS(status)) { |
2447 log_err("Keyword value \"%s\" missing for locale: %s\n", val
ue, locale); | 2445 log_err("Keyword value \"%s\" missing for locale: %s\n", val
ue, locale); |
2448 } else { | 2446 } else { |
2449 log_err("While getting keyword value from locale: %s got thi
s error: %s\n", locale, u_errorName(status)); | 2447 log_err("While getting keyword value from locale: %s got thi
s error: %s\n", locale, u_errorName(status)); |
2450 errorOccurred = TRUE; | 2448 errorOccurred = TRUE; |
2451 break; | 2449 break; |
2452 } | 2450 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 } | 2552 } |
2555 status = U_ZERO_ERROR; | 2553 status = U_ZERO_ERROR; |
2556 if (ucol_strcollUTF8(coll, NULL, 0, u8han, u8hanLen, &status) >= 0 || U_FAIL
URE(status)) { | 2554 if (ucol_strcollUTF8(coll, NULL, 0, u8han, u8hanLen, &status) >= 0 || U_FAIL
URE(status)) { |
2557 log_err("ERROR : ucol_strcollUTF8 NULL/0 and u8han/u8hanLen"); | 2555 log_err("ERROR : ucol_strcollUTF8 NULL/0 and u8han/u8hanLen"); |
2558 } | 2556 } |
2559 | 2557 |
2560 ucol_close(coll); | 2558 ucol_close(coll); |
2561 } | 2559 } |
2562 | 2560 |
2563 #endif /* #if !UCONFIG_NO_COLLATION */ | 2561 #endif /* #if !UCONFIG_NO_COLLATION */ |
OLD | NEW |