This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: test for DecimalFormat.format(BigInteger)
- From: Casey Marshall <casey dot s dot marshall at gmail dot com>
- To: Mauve-patches <mauve-patches at sources dot redhat dot com>
- Date: Sun, 23 Jul 2006 14:35:07 -0700
- Subject: FYI: test for DecimalFormat.format(BigInteger)
Hi. This adds a test for whether or not DecimalFormat formats
BigInteger properly (see PR 28462).
2006-07-23 Casey Marshall <csm@gnu.org>
* gnu/testlet/java/text/DecimalFormat/format.java (test): call
`testBigInteger' too.
(testBigInteger): new method.
### Eclipse Workspace Patch 1.0
#P mauve
Index: gnu/testlet/java/text/DecimalFormat/format.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/text/DecimalFormat/
format.java,v
retrieving revision 1.9
diff -u -r1.9 format.java
--- gnu/testlet/java/text/DecimalFormat/format.java 7 Dec 2005
14:44:36 -0000 1.9
+++ gnu/testlet/java/text/DecimalFormat/format.java 23 Jul 2006
21:24:20 -0000
@@ -27,6 +27,7 @@
import gnu.testlet.TestHarness;
import gnu.testlet.Testlet;
+import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.Locale;
@@ -37,6 +38,7 @@
testGeneral(harness);
testRounding(harness);
testMiscellaneous(harness);
+ testBigInteger(harness);
}
public void apply (TestHarness harness, DecimalFormat df, String
pattern)
@@ -210,4 +212,20 @@
Locale.setDefault(original);
}
+
+ /**
+ * See PR 28462.
+ */
+ private void testBigInteger(TestHarness harness)
+ {
+ Locale orig = Locale.getDefault();
+ Locale.setDefault(Locale.US);
+ harness.checkPoint("BigInteger format");
+ String expect = "123,456,789,012,345,678,901,234,567,890";
+ BigInteger bi = new BigInteger("123456789012345678901234567890",
10);
+
+ DecimalFormat df = new DecimalFormat();
+ harness.check(df.format(bi), expect);
+ Locale.setDefault(orig);
+ }
}
Attachment:
PGP.sig
Description: This is a digitally signed message part