/********************************************************************
* COPYRIGHT:
- * Copyright (c) 2000-2003, International Business Machines Corporation and
+ * Copyright (c) 2000-2006, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*
/*dotestname("cp1252", "MIME", "windows-1252") &&*/
dotestname("ascii", "MIME", "US-ASCII") &&
dotestname("csiso2022jp2", "MIME", "ISO-2022-JP-2") &&
- dotestname("Iso20-22__cN", "MIME", "ISO-2022-CN") &&
+ dotestname("Iso20-22__cN", "IANA", "ISO-2022-CN") &&
dotestname("ascii", "IANA", "ANSI_X3.4-1968") &&
dotestname("cp850", "IANA", "IBM850") &&
dotestname("crazy", "MIME", NULL) &&
if (tag && !expected) {
log_err("FAIL: Unexpectedly found %s canonical name for %s, got %s\n", standard, name, tag);
res = 0;
- } else if (!tag && expected) {
+ }
+ else if (!tag && expected) {
log_err("FAIL: could not find %s canonical name for %s\n", (standard ? "\"\"" : standard), name);
res = 0;
- } else if (expected && (name == tag || uprv_strcmp(expected, tag)) && error == U_ZERO_ERROR) {
+ }
+ else if (expected && (name == tag || uprv_strcmp(expected, tag) != 0)) {
log_err("FAIL: expected %s for %s canonical name for %s, got %s\n", expected, standard, name, tag);
res = 0;
}
+ else {
+ log_verbose("PASS: (\"%s\", \"%s\") -> %s == %s \n", name, standard, tag, expected);
+ }
return res;
}
dotestconv("ibm-5305", "IANA", NULL) && /* mapping does not exist */
dotestconv("cp1208", "", "UTF-8") && /* default name due to ordering */
dotestconv("UTF16_BigEndian", "", "UTF-16BE") && /* non-default name due to ordering */
- dotestconv("ISO-2022-CN", "MIME", "ISO_2022,locale=zh,version=0") &&/* default name */
- dotestconv("Shift_JIS", "MIME", "ibm-943_P14A-1999") &&/* ambiguous alias */
+ dotestconv("ISO-2022-CN", "IANA", "ISO_2022,locale=zh,version=0") &&/* default name */
+ dotestconv("Shift_JIS", "MIME", "ibm-943_P15A-2003") &&/* ambiguous alias */
dotestconv("Shift_JIS", "", "ibm-943_P130-1999") &&/* ambiguous alias */
- dotestconv("ibm-943", "", "ibm-943_P14A-1999") &&/* ambiguous alias */
+ dotestconv("ibm-943", "", "ibm-943_P15A-2003") &&/* ambiguous alias */
dotestconv("ibm-943", "IBM", "ibm-943_P130-1999") &&/* ambiguous alias */
dotestconv("ibm-1363", "", "ibm-1363_P11B-1998") &&/* ambiguous alias */
dotestconv("ibm-1363", "IBM", "ibm-1363_P110-1997") &&/* ambiguous alias */
static UBool doTestNames(const char *name, const char *standard, const char **expected, int32_t size) {
UErrorCode err = U_ZERO_ERROR;
UEnumeration *myEnum = ucnv_openStandardNames(name, standard, &err);
+ const char *enumName, *testName;
int32_t enumCount = uenum_count(myEnum, &err);
- int32_t idx, repeatTimes = 3;
+ int32_t idx, len, repeatTimes = 3;
if (size != enumCount) {
log_err("FAIL: different size arrays. Got %d. Expected %d\n", enumCount, size);
return 0;
log_verbose("\n%s %s\n", name, standard);
while (repeatTimes-- > 0) {
for (idx = 0; idx < enumCount; idx++) {
- int32_t len;
- const char *enumName = uenum_next(myEnum, &len, &err);
- const char *testName = expected[idx];
+ enumName = uenum_next(myEnum, &len, &err);
+ testName = expected[idx];
if (uprv_strcmp(enumName, testName) != 0 || U_FAILURE(err)
|| len != (int32_t)uprv_strlen(expected[idx]))
{
log_verbose("%s\n", enumName);
err = U_ZERO_ERROR;
}
+ if (enumCount >= 0) {
+ /* one past the list of all names must return NULL */
+ enumName = uenum_next(myEnum, &len, &err);
+ if (enumName != NULL || len != 0 || U_FAILURE(err)) {
+ log_err("FAIL: uenum_next(past the list) did not return NULL[0] with U_SUCCESS(). name=%s standard=%s len=%d err=%s\n", name, standard, len, u_errorName(err));
+ }
+ }
log_verbose("\n reset\n");
uenum_reset(myEnum, &err);
if (U_FAILURE(err)) {