ICU-5410 Improve code coverage.

X-SVN-Rev: 21729
This commit is contained in:
George Rhoten 2007-06-14 01:30:51 +00:00
parent fc532c8ac1
commit cf3401426a
2 changed files with 22 additions and 7 deletions

View file

@ -1,7 +1,7 @@
/*
******************************************************************************
* *
* Copyright (C) 2003-2005, International Business Machines *
* Copyright (C) 2003-2007, International Business Machines *
* Corporation and others. All Rights Reserved. *
* *
******************************************************************************
@ -89,7 +89,7 @@ U_CAPI USet* U_EXPORT2
ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn,
uint32_t options, ULocaleDataExemplarSetType extype, UErrorCode *status){
const char* exemplarSetTypes[] = { "ExemplarCharacters", "AuxExemplarCharacters" };
static const char* const exemplarSetTypes[] = { "ExemplarCharacters", "AuxExemplarCharacters" };
const UChar *exemplarChars = NULL;
int32_t len = 0;
UErrorCode localStatus = U_ZERO_ERROR;
@ -124,11 +124,12 @@ U_CAPI int32_t U_EXPORT2
ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type,
UChar *result, int32_t resultLength, UErrorCode *status){
const char* delimiterKeys[] = { "quotationStart",
"quotationEnd",
"alternateQuotationStart",
"alternateQuotationEnd" };
static const char* const delimiterKeys[] = {
"quotationStart",
"quotationEnd",
"alternateQuotationStart",
"alternateQuotationEnd"
};
UResourceBundle *delimiterBundle;
int32_t len = 0;

View file

@ -38,6 +38,7 @@
static void TestNullDefault(void);
static void TestNonexistentLanguageExemplars(void);
static void TestLocDataErrorCodeChaining(void);
static void TestLanguageExemplarsFallbacks(void);
void PrintDataTable();
@ -219,6 +220,7 @@ void addLocaleTest(TestNode** root)
TESTCASE(TestGetLocale);
TESTCASE(TestDisplayNameWarning);
TESTCASE(TestNonexistentLanguageExemplars);
TESTCASE(TestLocDataErrorCodeChaining);
TESTCASE(TestLanguageExemplarsFallbacks);
TESTCASE(TestCalendar);
TESTCASE(TestDateFormat);
@ -2271,6 +2273,18 @@ static void TestNonexistentLanguageExemplars(void) {
ulocdata_close(uld);
}
static void TestLocDataErrorCodeChaining(void) {
UErrorCode ec = U_USELESS_COLLATOR_ERROR;
ulocdata_open(NULL, &ec);
ulocdata_getExemplarSet(NULL, NULL, 0, ULOCDATA_ES_STANDARD, &ec);
ulocdata_getDelimiter(NULL, ULOCDATA_ES_STANDARD, NULL, -1, &ec);
ulocdata_getMeasurementSystem(NULL, &ec);
ulocdata_getPaperSize(NULL, NULL, NULL, &ec);
if (ec != U_USELESS_COLLATOR_ERROR) {
log_err("ulocdata API changed the error code to %s\n", u_errorName(ec));
}
}
static void TestLanguageExemplarsFallbacks(void) {
/* Test that en_US fallsback, but en doesn't fallback. */
UErrorCode ec = U_ZERO_ERROR;