mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-11020 Test11020(), port from Java. Rounding in Scientific Format.
X-SVN-Rev: 41372
This commit is contained in:
parent
a6da272f2d
commit
b2c77dc391
2 changed files with 12 additions and 0 deletions
|
@ -682,6 +682,7 @@ void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &n
|
|||
TESTCASE_AUTO(Test12753_PatternDecimalPoint);
|
||||
TESTCASE_AUTO(Test11647_PatternCurrencySymbols);
|
||||
TESTCASE_AUTO(Test11913_BigDecimal);
|
||||
TESTCASE_AUTO(Test11020_RoundingInScientificNotation);
|
||||
TESTCASE_AUTO_END;
|
||||
}
|
||||
|
||||
|
@ -9526,4 +9527,14 @@ void NumberFormatTest::Test11913_BigDecimal() {
|
|||
assertEquals("Should format more than 309 digits", u"12,345,678", UnicodeString(result, 0, 10));
|
||||
assertEquals("Should format more than 309 digits", 534, result.length());
|
||||
}
|
||||
|
||||
void NumberFormatTest::Test11020_RoundingInScientificNotation() {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
DecimalFormatSymbols sym(Locale::getFrance(), status);
|
||||
DecimalFormat fmt(u"0.05E0", sym, status);
|
||||
assertSuccess("", status);
|
||||
UnicodeString result;
|
||||
fmt.format(12301.2, result);
|
||||
assertEquals("Rounding increment should be applied after magnitude scaling", u"1,25E4", result);
|
||||
}
|
||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||
|
|
|
@ -245,6 +245,7 @@ class NumberFormatTest: public CalendarTimeZoneTest {
|
|||
void Test12753_PatternDecimalPoint();
|
||||
void Test11647_PatternCurrencySymbols();
|
||||
void Test11913_BigDecimal();
|
||||
void Test11020_RoundingInScientificNotation();
|
||||
|
||||
private:
|
||||
UBool testFormattableAsUFormattable(const char *file, int line, Formattable &f);
|
||||
|
|
Loading…
Add table
Reference in a new issue