From c10ba1bf470b9ae0d9904e28105de5e679840cb9 Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Tue, 17 Feb 2015 11:54:28 +0000 Subject: 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 in terms of Math.nextAfter and Math.nextUp. bug: 19149384 Change-Id: Ieb13ee70c212d188ff9fde09463ced8d632f47ab --- .../java/org/apache/harmony/tests/java/text/ChoiceFormatTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'harmony-tests/src/test') 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