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);
}
}
/*
*******************************************************************************
- * Copyright (C) 2007-2014, International Business Machines Corporation and
+ * Copyright (C) 2007-2015, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
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);
+ }
}