This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: New tests for DecimalFormat


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/
### 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: signature.asc
Description: Questa =?ISO-8859-1?Q?=E8?= una parte del messaggiofirmata digitalmente


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]