This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: New DecimalFormat tests
Il giorno mer, 11/10/2006 alle 00.20 +0200, Mario Torre ha scritto:
> There are a couple of new tests here.
Ooops sorry, here follows the correct Changelog and patch (the PR23996
has a file of its own):
2006-10-11 Mario Torre <neugens@limasoftware.net>
* gnu/testlet/java/text/DecimalFormat/PR23996.java:
Test for PR23996.
* gnu/testlet/java/text/DecimalFormat/format.java
(testGeneral): new test.
* gnu/testlet/java/text/DecimalFormat/applyPattern.java (test):
test added.
Mario
--
Lima Software, SO.PR.IND. s.r.l.
http://www.limasoftware.net/
pgp key: http://subkeys.pgp.net/
Proud GNU Classpath developer: http://www.classpath.org/
Read About us at: http://planet.classpath.org
Please, support open standards:
http://opendocumentfellowship.org/petition/
http://www.nosoftwarepatents.com/
### 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.13
diff -u -r1.13 format.java
--- gnu/testlet/java/text/DecimalFormat/format.java 29 Aug 2006 17:35:41 -0000 1.13
+++ gnu/testlet/java/text/DecimalFormat/format.java 10 Oct 2006 22:33:43 -0000
@@ -151,6 +151,7 @@
apply(harness, df, "'positive'#;'negative' -");
harness.check(df.format(-1234.567), "negative -1235");
+ harness.check(df.format(1234.567), "positive1235");
// grouping size of zero might cause a failure - see bug parade 4088503
harness.checkPoint("regression tests for setGroupingSize");
Index: gnu/testlet/java/text/DecimalFormat/applyPattern.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/text/DecimalFormat/applyPattern.java,v
retrieving revision 1.2
diff -u -r1.2 applyPattern.java
--- gnu/testlet/java/text/DecimalFormat/applyPattern.java 21 Aug 2006 18:42:32 -0000 1.2
+++ gnu/testlet/java/text/DecimalFormat/applyPattern.java 10 Oct 2006 22:33:43 -0000
@@ -78,6 +78,11 @@
harness.check(f1.getGroupingSize(), 3);
f1.applyPattern("#,#,##0.00");
+ harness.checkPoint("null pattern");
+ f1.applyPattern("");
+ harness.check(f1.format(123456789.123456789), "123.456.789,12345679");
+
+ harness.checkPoint("invalid pattern");
// try null argument
boolean pass = false;
try
Index: gnu/testlet/java/text/DecimalFormat/PR23996.java
===================================================================
RCS file: gnu/testlet/java/text/DecimalFormat/PR23996.java
diff -N gnu/testlet/java/text/DecimalFormat/PR23996.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/text/DecimalFormat/PR23996.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,61 @@
+/* PR23996.java -- test for bug PR23996
+ Copyright (C) 2006 Mario Torre
+This file is part of Mauve.
+
+Mauve is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+Mauve is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Mauve; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+*/
+
+// Tags: JDK1.4
+
+package gnu.testlet.java.text.DecimalFormat;
+
+import java.text.DecimalFormat;
+import java.util.Locale;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+/**
+ * This is based on PR23996: DecimalFormat.format() is giving
+ * different values in Java and DOTNet.
+ *
+ * @author Mario Torre <neugens@limasoftware.net>
+ */
+public class PR23996 implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ Locale orig = Locale.getDefault();
+ Locale.setDefault(Locale.US);
+
+ harness.checkPoint("PR23996");
+
+ DecimalFormat df = new DecimalFormat("S#.12345");
+ harness.check(df.format(Float.MAX_VALUE),
+ "S340282346638528860000000000000000000000.12345");
+
+ DecimalFormat df1 = new DecimalFormat("S#.00");
+ harness.check(df1.format(Float.MAX_VALUE),
+ "S340282346638528860000000000000000000000.00");
+
+ DecimalFormat df2 = new DecimalFormat("0.7547895");
+ harness.check(df2.format(Float.MAX_VALUE),
+ "340282346638528860000000000000000000000.7547895");
+
+ Locale.setDefault(orig);
+ }
+}