mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 14:31:31 +00:00
ICU-20186 Adding test for semicolon behavior and spacing in DecimalFormat.
This commit is contained in:
parent
e291a39c0d
commit
1e4a8d3c29
3 changed files with 33 additions and 0 deletions
|
@ -94,6 +94,7 @@ void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &n
|
|||
TESTCASE_AUTO(TestQuotes);
|
||||
TESTCASE_AUTO(TestExponential);
|
||||
TESTCASE_AUTO(TestPatterns);
|
||||
TESTCASE_AUTO(Test20186_SpacesAroundSemicolon);
|
||||
|
||||
// Upgrade to alphaWorks - liu 5/99
|
||||
TESTCASE_AUTO(TestExponent);
|
||||
|
@ -397,6 +398,21 @@ NumberFormatTest::TestPatterns(void)
|
|||
}
|
||||
}
|
||||
|
||||
void NumberFormatTest::Test20186_SpacesAroundSemicolon() {
|
||||
IcuTestErrorCode status(*this, "Test20186_SpacesAroundSemicolon");
|
||||
DecimalFormat df(u"0.00 ; -0.00", {"en-us", status}, status);
|
||||
expect2(df, 1, u"1.00 ");
|
||||
expect2(df, -1, u" -1.00");
|
||||
|
||||
df = DecimalFormat(u"0.00;", {"en-us", status}, status);
|
||||
expect2(df, 1, u"1.00");
|
||||
expect2(df, -1, u"-1.00");
|
||||
|
||||
df = DecimalFormat(u"0.00;0.00", {"en-us", status}, status);
|
||||
expect2(df, 1, u"1.00");
|
||||
expect(df, -1, u"1.00"); // parses as 1, not -1
|
||||
}
|
||||
|
||||
/*
|
||||
icu_2_4::DigitList::operator== 0 0 2 icuuc24d.dll digitlst.cpp Doug
|
||||
icu_2_4::DigitList::append 0 0 4 icuin24d.dll digitlst.h Doug
|
||||
|
|
|
@ -98,6 +98,8 @@ class NumberFormatTest: public CalendarTimeZoneTest {
|
|||
**/
|
||||
//void TestDigitList(void);
|
||||
|
||||
void Test20186_SpacesAroundSemicolon(void);
|
||||
|
||||
/**
|
||||
* Test localized currency patterns.
|
||||
*/
|
||||
|
|
|
@ -257,6 +257,21 @@ public class NumberFormatTest extends TestFmwk {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void Test20186_SpacesAroundSemicolon() {
|
||||
DecimalFormat df = new DecimalFormat("0.00 ; -0.00");
|
||||
expect2(df, 1, "1.00 ");
|
||||
expect2(df, -1, " -1.00");
|
||||
|
||||
df = new DecimalFormat("0.00;");
|
||||
expect2(df, 1, "1.00");
|
||||
expect2(df, -1, "-1.00");
|
||||
|
||||
df = new DecimalFormat("0.00;0.00");
|
||||
expect2(df, 1, "1.00");
|
||||
expect(df, -1, "1.00"); // parses as 1, not -1
|
||||
}
|
||||
|
||||
// Test exponential pattern
|
||||
@Test
|
||||
public void TestExponential() {
|
||||
|
|
Loading…
Add table
Reference in a new issue