From 27a10413220d7ecc23e8f228a955d7ad3afd2a9f Mon Sep 17 00:00:00 2001 From: Alan Liu Date: Wed, 31 Jul 2002 19:37:06 +0000 Subject: [PATCH] ICU-1884 fix currency patterns: need min==max fraction digits; EURO must use 2 fraction digits X-SVN-Rev: 9469 --- .../icu/dev/test/format/NumberFormatTest.java | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/icu4j/src/com/ibm/icu/dev/test/format/NumberFormatTest.java b/icu4j/src/com/ibm/icu/dev/test/format/NumberFormatTest.java index fd61ffab64..834b96bdef 100755 --- a/icu4j/src/com/ibm/icu/dev/test/format/NumberFormatTest.java +++ b/icu4j/src/com/ibm/icu/dev/test/format/NumberFormatTest.java @@ -4,8 +4,8 @@ * others. All Rights Reserved. * ******************************************************************************* * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/format/NumberFormatTest.java,v $ - * $Date: 2002/05/08 23:58:25 $ - * $Revision: 1.5 $ + * $Date: 2002/07/31 19:37:06 $ + * $Revision: 1.6 $ * ***************************************************************************************** */ @@ -295,6 +295,40 @@ public class NumberFormatTest extends com.ibm.icu.dev.test.TestFmwk { } } + public void TestCurrencyPatterns() { + int i; + Locale[] locs = NumberFormat.getAvailableLocales(); + for (i=0; i " + a + + "; x 1.125 => " + b); + } + + // Make sure EURO currency formats have exactly 2 fraction digits + if (nf instanceof DecimalFormat) { + DecimalFormat df = (DecimalFormat) nf; + if ("EUR".equals(df.getCurrency().getCurrencyCode())) { + if (min != 2 || max != 2) { + String a = nf.format(1.0); + errln("FAIL: " + locs[i] + + " is a EURO format but it does not have 2 fraction digits; "+ + "x 1.0 => " + + a); + } + } + } + } + } + /** * Do rudimentary testing of parsing. */