* FYI: new DecimalFormat tests
@ 2006-12-01 23:00 Mario Torre
0 siblings, 0 replies; 2+ messages in thread
From: Mario Torre @ 2006-12-01 23:00 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1.1: Type: text/plain, Size: 640 bytes --]
These added tests are needed to check our Locale handling.
I've discovered that this is pretty broken atm, I'll try to figure out
if it is only a problem of the locale bundles of there are problems also
in the class code.
2006-12-01 Mario Torre <neugens@limasoftware.net>
* gnu/testlet/java/text/DecimalFormat/format.java (testGeneral):
(testLocale): new tests.
(test): enable new tests.
Ciao,
Mario
--
Lima Software, SO.PR.IND. s.r.l.
http://www.limasoftware.net/
pgp key: http://subkeys.pgp.net/
Please, support open standards:
http://opendocumentfellowship.org/petition/
http://www.nosoftwarepatents.com/
[-- Attachment #1.2: 2006-12-01-mauve.patch --]
[-- Type: text/x-patch, Size: 2694 bytes --]
### 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.14
diff -u -r1.14 format.java
--- gnu/testlet/java/text/DecimalFormat/format.java 10 Oct 2006 22:36:48 -0000 1.14
+++ gnu/testlet/java/text/DecimalFormat/format.java 1 Dec 2006 22:57:04 -0000
@@ -43,6 +43,7 @@
testNaN(harness);
testInfinity(harness);
testMaximumDigits(harness);
+ testLocale(harness);
}
public void apply(TestHarness harness, DecimalFormat df, String pattern)
@@ -79,6 +80,9 @@
harness.check(df.format(- 1234.56), "-1,234.56");
harness.check(df.format(1234.56), "1,234.56");
+ apply(harness, df, "#,##0.###");
+ harness.check(df.format(Double.valueOf(80).doubleValue()), "80");
+
apply(harness, df, "00,000.000;-00,000.000");
harness.check(df.format(- 1234.56), "-01,234.560");
harness.check(df.format(1234.56), "01,234.560");
@@ -153,6 +157,15 @@
harness.check(df.format(-1234.567), "negative -1235");
harness.check(df.format(1234.567), "positive1235");
+ apply(harness, df, "#,##0%");
+ harness.check(df.format(10000000.1234d), "1,000,000,012%");
+
+ apply(harness, df, "\u00A4#,##0.00;(\u00A4#,##0.00)");
+ harness.check(df.format(10000), "$10,000.00");
+
+ apply(harness, df, "$#,##0.00;($#,##0.00)");
+ harness.check(df.format(10000), "$10,000.00");
+
// grouping size of zero might cause a failure - see bug parade 4088503
harness.checkPoint("regression tests for setGroupingSize");
df = new DecimalFormat();
@@ -359,4 +372,29 @@
Locale.setDefault(orig);
}
+
+ private void testLocale(TestHarness harness)
+ {
+ // just two tests, other are in gnu.testlet.locales.LocaleTest
+
+ harness.checkPoint("locale: GERMANY");
+
+ // by default, calls DecimalFormat
+ java.text.NumberFormat nf
+ = java.text.NumberFormat.getCurrencyInstance(Locale.GERMANY);
+
+ harness.check(nf.format(5000.25), "5.000,25 €");
+
+ harness.checkPoint("locale: ITALY");
+
+ nf = java.text.NumberFormat.getCurrencyInstance(Locale.ITALY);
+ harness.check(nf.format(5000.25), "€ 5.000,25");
+
+ java.text.DecimalFormatSymbols symbols
+ = ((DecimalFormat)nf).getDecimalFormatSymbols();
+
+ harness.check(',', symbols.getDecimalSeparator());
+ harness.check(',', symbols.getMonetaryDecimalSeparator());
+ harness.check('.', symbols.getGroupingSeparator());
+ }
}
[-- Attachment #2: Questa è una parte del messaggio firmata digitalmente --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* FYI: New DecimalFormat tests
2006-10-10 22:12 New " Mario Torre
@ 2006-10-10 22:35 ` Mario Torre
0 siblings, 0 replies; 2+ messages in thread
From: Mario Torre @ 2006-10-10 22:35 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1: Type: text/plain, Size: 807 bytes --]
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/
[-- Attachment #2: mauve-decimalformat-2006-10-11.patch --]
[-- Type: text/x-patch, Size: 3919 bytes --]
### 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);
+ }
+}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-12-01 23:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-01 23:00 FYI: new DecimalFormat tests Mario Torre
-- strict thread matches above, loose matches on Subject: below --
2006-10-10 22:12 New " Mario Torre
2006-10-10 22:35 ` FYI: " Mario Torre
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).