ICU-13148 Add test for parsing grouping separators

X-SVN-Rev: 41353
This commit is contained in:
Craig Cornelius 2018-05-08 01:21:56 +00:00
parent d71db01650
commit 01c86126de
2 changed files with 17 additions and 0 deletions

View File

@ -677,6 +677,7 @@ void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &n
TESTCASE_AUTO(Test11025_CurrencyPadding);
TESTCASE_AUTO(Test11648_ExpDecFormatMalPattern);
TESTCASE_AUTO(Test11649_DecFmtCurrencies);
TESTCASE_AUTO(Test13148_ParseGroupingSeparators);
TESTCASE_AUTO(Test12753_PatternDecimalPoint);
TESTCASE_AUTO_END;
}
@ -9468,6 +9469,21 @@ void NumberFormatTest::Test11649_DecFmtCurrencies() {
assertEquals("", "US dollars 12.34", fmt2.format(12.34, appendTo));
}
void NumberFormatTest::Test13148_ParseGroupingSeparators() {
IcuTestErrorCode status(*this, "Test13148");
LocalPointer<DecimalFormat> fmt(
(DecimalFormat*)NumberFormat::createInstance("en-ZA", status));
DecimalFormatSymbols symbols = *fmt->getDecimalFormatSymbols();
symbols.setSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol, u'.');
symbols.setSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol, u',');
fmt->setDecimalFormatSymbols(symbols);
Formattable number;
fmt->parse(u"300,000", number, status);
assertEquals("Should parse as 300000", 300000LL, number.getInt64(status));
}
void NumberFormatTest::Test12753_PatternDecimalPoint() {
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols symbols(Locale::getUS(), status);

View File

@ -241,6 +241,7 @@ class NumberFormatTest: public CalendarTimeZoneTest {
void Test11025_CurrencyPadding();
void Test11648_ExpDecFormatMalPattern();
void Test11649_DecFmtCurrencies();
void Test13148_ParseGroupingSeparators();
void Test12753_PatternDecimalPoint();
private: