public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* FYI: test for DecimalFormat.format(BigInteger)
@ 2006-07-23 21:35 Casey Marshall
  0 siblings, 0 replies; only message in thread
From: Casey Marshall @ 2006-07-23 21:35 UTC (permalink / raw)
  To: Mauve-patches

[-- Attachment #1: Type: text/plain, Size: 1659 bytes --]

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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 478 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-07-23 21:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-23 21:35 FYI: test for DecimalFormat.format(BigInteger) Casey Marshall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).