From: Mario Torre <neugens@limasoftware.net>
To: mauve-patches <mauve-patches@sources.redhat.com>
Subject: FYI: new DecimalFormat tests
Date: Fri, 01 Dec 2006 23:00:00 -0000 [thread overview]
Message-ID: <1165014031.3091.42.camel@nirvana.limasoftware.net> (raw)
[-- 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 --]
next reply other threads:[~2006-12-01 23:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-01 23:00 Mario Torre [this message]
-- 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1165014031.3091.42.camel@nirvana.limasoftware.net \
--to=neugens@limasoftware.net \
--cc=mauve-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).