public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* FYI: New tests for DecimalFormat
@ 2006-08-21 18:42 Mario Torre
  0 siblings, 0 replies; only message in thread
From: Mario Torre @ 2006-08-21 18:42 UTC (permalink / raw)
  To: mauve-patches


[-- Attachment #1.1: Type: text/plain, Size: 686 bytes --]

Hi have added a couple of test for DecimalFormat, these are some special
cases, like, for example decimals that can be formatted with integers
(i.e. 1.0) or that start without the integer portion (like .5).

Changelog:

2006-08-18  Mario Torre  <neugens@limasoftware.net>

	* gnu/testlet/java/text/DecimalFormat/parse.java (test): 
	added new tests.
	* gnu/testlet/java/text/DecimalFormat/applyPattern.java (test):
	fixed checkpoint for "grouping" test.

-- 
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: mauve_decimal_format.patch --]
[-- Type: text/x-patch, Size: 2995 bytes --]

### Eclipse Workspace Patch 1.0
#P mauve
Index: gnu/testlet/java/text/DecimalFormat/parse.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/text/DecimalFormat/parse.java,v
retrieving revision 1.9
diff -u -r1.9 parse.java
--- gnu/testlet/java/text/DecimalFormat/parse.java	1 Mar 2005 14:59:47 -0000	1.9
+++ gnu/testlet/java/text/DecimalFormat/parse.java	21 Aug 2006 18:29:27 -0000
@@ -118,15 +118,50 @@
       harness.check (num instanceof Long);
       harness.check (num.longValue (), -303);
 
+      num = parseIt (df, "1.", pp);
+      harness.check (num instanceof Long);
+      harness.check (num.longValue (), 1);
+      
+      num = parseIt (df, "1.0", pp);
+      harness.check (num instanceof Long);
+      harness.check (num.longValue (), 1);
+      
+      num = parseIt (df, ".01", pp);
+      harness.check (num instanceof Double);
+      harness.check (num.longValue (), 0);
+      
       num = parseIt (df, "9223372036854775808-", pp);
       harness.check (num instanceof Long);
       harness.check (num.longValue(), Long.MIN_VALUE);
 
+      apply (harness, df, "0.###;0.###-");
+      num = parseIt (df, ".01", pp);
+      harness.check (num instanceof Double);
+      harness.check (num.doubleValue(), 0.01);
+      
+      num = parseIt (df, ".05", pp);
+      harness.check (num instanceof Double);
+      harness.check (num.doubleValue(), 0.05);
+      
+      num = parseIt (df, ".5", pp);
+      harness.check (num instanceof Double);
+      harness.check (num.doubleValue(), 0.5);
+      
       apply (harness, df, "#,##0.00");
       num = parseIt (df, "3,110.00", pp);
       harness.check (num instanceof Long);
       harness.check (num.longValue(), 3110);
 
+      apply (harness, df, "#,##0.00");
+      num = parseIt (df, "31,10.00", pp);
+      harness.check (num instanceof Long);
+      harness.check (num.longValue(), 3110);
+      
+      apply (harness, df, "#,##0.00");
+      num = parseIt (df, "3110", pp);
+      harness.check (num instanceof Long);
+      harness.check (num.longValue(), 3110);
+      
       apply (harness, df, "#,##0X");
       num = parseIt (df, "3,110X", pp);
       harness.check (num instanceof Long);
Index: gnu/testlet/java/text/DecimalFormat/applyPattern.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/text/DecimalFormat/applyPattern.java,v
retrieving revision 1.1
diff -u -r1.1 applyPattern.java
--- gnu/testlet/java/text/DecimalFormat/applyPattern.java	13 Mar 2005 20:42:07 -0000	1.1
+++ gnu/testlet/java/text/DecimalFormat/applyPattern.java	21 Aug 2006 18:29:27 -0000
@@ -67,6 +67,7 @@
     harness.check(f1.getMinimumFractionDigits(), 2);
     
     // grouping
+    harness.checkPoint("grouping");
     f1.applyPattern("0.00");
     harness.check(f1.getGroupingSize(), 0);
     f1.applyPattern("#0.00");

[-- Attachment #2: Questa è una parte del messaggio firmata digitalmente --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

only message in thread, other threads:[~2006-08-21 18:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-21 18:42 FYI: New tests for DecimalFormat 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).