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 DecimalFormat tests


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/
### 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: 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]