ICU-12753 Add PatternDecimalPoint() test.

X-SVN-Rev: 41350
This commit is contained in:
Andy Heninger 2018-05-08 00:14:27 +00:00
parent 9be84eb03c
commit 5fe126b793
2 changed files with 16 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(Test12753_PatternDecimalPoint);
TESTCASE_AUTO_END;
}
@ -9466,4 +9467,18 @@ void NumberFormatTest::Test11649_DecFmtCurrencies() {
appendTo.remove();
assertEquals("", "US dollars 12.34", fmt2.format(12.34, appendTo));
}
void NumberFormatTest::Test12753_PatternDecimalPoint() {
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols symbols(Locale::getUS(), status);
symbols.setSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol, u"*", false);
DecimalFormat df(u"0.00", symbols, status);
if (!assertSuccess("", status)) return;
df.setDecimalPatternMatchRequired(true);
Formattable result;
df.parse(u"123",result, status);
assertEquals("Parsing integer succeeded even though setDecimalPatternMatchRequired was set",
U_INVALID_FORMAT_ERROR, status);
}
#endif /* #if !UCONFIG_NO_FORMATTING */

View file

@ -241,6 +241,7 @@ class NumberFormatTest: public CalendarTimeZoneTest {
void Test11025_CurrencyPadding();
void Test11648_ExpDecFormatMalPattern();
void Test11649_DecFmtCurrencies();
void Test12753_PatternDecimalPoint();
private:
UBool testFormattableAsUFormattable(const char *file, int line, Formattable &f);