ICU-868 Better testing of new API

X-SVN-Rev: 9282
This commit is contained in:
George Rhoten 2002-07-22 21:05:17 +00:00
parent 911da04bff
commit 85012434a2

View File

@ -101,7 +101,7 @@ static UBool doTestNames(const char *name, const char *standard, const char **ex
UErrorCode err = U_ZERO_ERROR; UErrorCode err = U_ZERO_ERROR;
UEnumeration *myEnum = ucnv_openStandardNames(name, standard, &err); UEnumeration *myEnum = ucnv_openStandardNames(name, standard, &err);
int32_t enumCount = uenum_count(myEnum, &err); int32_t enumCount = uenum_count(myEnum, &err);
int32_t idx; int32_t idx, repeatTimes = 3;
if (size != enumCount) { if (size != enumCount) {
log_err("FAIL: different size arrays. Got %d. Expected %d\n", enumCount, size); log_err("FAIL: different size arrays. Got %d. Expected %d\n", enumCount, size);
return 0; return 0;
@ -111,6 +111,7 @@ static UBool doTestNames(const char *name, const char *standard, const char **ex
return 0; return 0;
} }
log_verbose("\n%s %s\n", name, standard); log_verbose("\n%s %s\n", name, standard);
while (repeatTimes-- > 0) {
for (idx = 0; idx < enumCount; idx++) { for (idx = 0; idx < enumCount; idx++) {
const char *enumName = uenum_next(myEnum, NULL, &err); const char *enumName = uenum_next(myEnum, NULL, &err);
const char *testName = expected[idx]; const char *testName = expected[idx];
@ -121,6 +122,13 @@ static UBool doTestNames(const char *name, const char *standard, const char **ex
log_verbose("%s\n", enumName); log_verbose("%s\n", enumName);
err = U_ZERO_ERROR; err = U_ZERO_ERROR;
} }
uenum_reset(myEnum, &err);
if (U_FAILURE(err)) {
log_err("FAIL: uenum_reset() for %s{%s} failed with %s\n",
name, standard, u_errorName(err));
err = U_ZERO_ERROR;
}
}
uenum_close(myEnum); uenum_close(myEnum);
return 1; return 1;
} }