diff options
author | Narayan Kamath <narayan@google.com> | 2015-02-17 11:54:28 +0000 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2015-02-17 16:42:55 +0000 |
commit | c10ba1bf470b9ae0d9904e28105de5e679840cb9 (patch) | |
tree | 2fb6e858299c3ea8e85c4c9bc26ac6ab6cc79564 /harmony-tests/src/test | |
parent | db4499e1983c9649c8de7697d10825028fd8094d (diff) | |
download | libcore-c10ba1bf470b9ae0d9904e28105de5e679840cb9.zip libcore-c10ba1bf470b9ae0d9904e28105de5e679840cb9.tar.gz libcore-c10ba1bf470b9ae0d9904e28105de5e679840cb9.tar.bz2 |
Handle infinities correctly in ChoiceFormat.
We'd like ChoiceFormat.toPattern to emit a pattern that's parseable
by ChoiceFormat - which means we need an infinity that's parseable by
NumberFormat.parse().
Also, implement the nextDouble / previousDouble public API <sadface/>
in terms of Math.nextAfter and Math.nextUp.
bug: 19149384
Change-Id: Ieb13ee70c212d188ff9fde09463ced8d632f47ab
Diffstat (limited to 'harmony-tests/src/test')
-rw-r--r-- | harmony-tests/src/test/java/org/apache/harmony/tests/java/text/ChoiceFormatTest.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/ChoiceFormatTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/ChoiceFormatTest.java index e4d6bd8..63232ae 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/ChoiceFormatTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/ChoiceFormatTest.java @@ -466,4 +466,12 @@ public class ChoiceFormatTest extends TestCase { assertEquals("GREATER_THAN_ONE", fmt.format(999999999D)); assertEquals("GREATER_THAN_ONE", fmt.format(Double.POSITIVE_INFINITY)); } + + // http://b/19149384 + public void testToPatternWithInfinities() { + final ChoiceFormat fmt = new ChoiceFormat( + "-\u221E<are negative|0<are fractions|1#is one|1.0<is 1+|\u221E<are many."); + assertEquals("-\u221E<are negative|0.0<are fractions|1.0#is one|1.0<is 1+|\u221E<are many.", + fmt.toPattern()); + } } |