mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-11898 fixed assertion and added test.
X-SVN-Rev: 37983
This commit is contained in:
parent
f57dc2ac03
commit
72e1610789
2 changed files with 8 additions and 2 deletions
|
@ -557,7 +557,7 @@ public class PluralFormat extends UFormat {
|
|||
private final class PluralSelectorAdapter implements PluralSelector {
|
||||
public String select(Object context, double number) {
|
||||
FixedDecimal dec = (FixedDecimal) context;
|
||||
assert dec.source == number;
|
||||
assert dec.source == (dec.isNegative ? -number : number);
|
||||
return pluralRules.select(dec);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2007-2014, International Business Machines Corporation and
|
||||
* Copyright (C) 2007-2015, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -368,4 +368,10 @@ public class PluralFormatUnitTest extends TestFmwk {
|
|||
assertEquals("offset-decimals format(2)", "another 1.0 meters", pf2.format(2));
|
||||
assertEquals("offset-decimals format(2.5)", "another 1.5 meters", pf2.format(2.5));
|
||||
}
|
||||
|
||||
public void TestNegative() {
|
||||
PluralFormat pluralFormat = new PluralFormat(ULocale.ENGLISH, "one{# foot}other{# feet}");
|
||||
String actual = pluralFormat.format(-3);
|
||||
assertEquals(pluralFormat.toString(), "-3 feet", actual);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue