ICU-3811 add regression test for ucurr_getName
X-SVN-Rev: 15733
This commit is contained in:
parent
a1a1b97040
commit
638c585a53
@ -74,6 +74,8 @@ void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &n
|
|||||||
CASE(26,TestIllegalPatterns);
|
CASE(26,TestIllegalPatterns);
|
||||||
CASE(27,TestCases);
|
CASE(27,TestCases);
|
||||||
|
|
||||||
|
CASE(28,TestCurrencyNames);
|
||||||
|
|
||||||
default: name = ""; break;
|
default: name = ""; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1409,6 +1411,30 @@ void NumberFormatTest::TestRegCurrency(void) {
|
|||||||
status = U_ZERO_ERROR; // reset
|
status = U_ZERO_ERROR; // reset
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NumberFormatTest::TestCurrencyNames(void) {
|
||||||
|
// Do a basic check of getName()
|
||||||
|
// USD { "US$", "US Dollar" } // 04/04/1792-
|
||||||
|
UErrorCode ec = U_ZERO_ERROR;
|
||||||
|
static const UChar USD[] = {85, 83, 68, 0}; /*USD*/
|
||||||
|
UBool isChoiceFormat;
|
||||||
|
int32_t len;
|
||||||
|
// Warning: HARD-CODED LOCALE DATA in this test. If it fails, CHECK
|
||||||
|
// THE LOCALE DATA before diving into the code.
|
||||||
|
assertEquals("USD.getName(SYMBOL_NAME)",
|
||||||
|
UnicodeString("US$"),
|
||||||
|
UnicodeString(ucurr_getName(USD, "en",
|
||||||
|
UCURR_SYMBOL_NAME,
|
||||||
|
&isChoiceFormat, &len, &ec)));
|
||||||
|
assertEquals("USD.getName(LONG_NAME)",
|
||||||
|
UnicodeString("US Dollar"),
|
||||||
|
UnicodeString(ucurr_getName(USD, "en",
|
||||||
|
UCURR_LONG_NAME,
|
||||||
|
&isChoiceFormat, &len, &ec)));
|
||||||
|
assertSuccess("ucurr_getName", ec);
|
||||||
|
|
||||||
|
// TODO add more tests later
|
||||||
|
}
|
||||||
|
|
||||||
void NumberFormatTest::TestSymbolsWithBadLocale(void) {
|
void NumberFormatTest::TestSymbolsWithBadLocale(void) {
|
||||||
Locale locDefault;
|
Locale locDefault;
|
||||||
Locale locBad("x-crazy_ZZ_MY_SPECIAL_ADMINISTRATION_REGION_NEEDS_A_SPECIAL_VARIANT_WITH_A_REALLY_REALLY_REALLY_REALLY_REALLY_REALLY_REALLY_LONG_NAME");
|
Locale locBad("x-crazy_ZZ_MY_SPECIAL_ADMINISTRATION_REGION_NEEDS_A_SPECIAL_VARIANT_WITH_A_REALLY_REALLY_REALLY_REALLY_REALLY_REALLY_REALLY_LONG_NAME");
|
||||||
|
@ -100,6 +100,8 @@ class NumberFormatTest: public CalendarTimeZoneTest {
|
|||||||
*/
|
*/
|
||||||
void TestRegCurrency(void);
|
void TestRegCurrency(void);
|
||||||
|
|
||||||
|
void TestCurrencyNames(void);
|
||||||
|
|
||||||
void TestSymbolsWithBadLocale(void);
|
void TestSymbolsWithBadLocale(void);
|
||||||
|
|
||||||
void TestAdoptDecimalFormatSymbols(void);
|
void TestAdoptDecimalFormatSymbols(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user