]> granicus.if.org Git - icu/commitdiff
ICU-21005 Fix exhaustive test failure in IntlTestNumberFormat.
authorShane F. Carr <shane@unicode.org>
Thu, 26 Mar 2020 01:24:08 +0000 (20:24 -0500)
committerShane F. Carr <shane@unicode.org>
Thu, 26 Mar 2020 05:09:31 +0000 (00:09 -0500)
icu4c/source/data/curr/su.txt
icu4j/main/shared/data/icudata.jar
icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/IntlTestNumberFormat.java

index 02f5cdfcd2c2d4c4ade7b91dfa4cfb159bf6eb5a..17a010fbf3f069f87c83d0363779373bd7519ef7 100644 (file)
@@ -40,7 +40,7 @@ su{
         }
         XXX{
             "ยค",
-            "-",
+            "XXX",
         }
     }
     Currencies%narrow{
@@ -83,7 +83,7 @@ su{
             other{"dolar A.S."}
         }
         XXX{
-            other{"-"}
+            other{"XXX"}
         }
     }
     CurrencyUnitPatterns{
index 68dd388dd549baed0721e1fa09f96a2ab98785fe..fa364e07b9612f3d015a5e4d337da04bcf8faa9d 100644 (file)
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:11d8383eaff95db943d886a25e5c9d5a251e7c905868a72ed1dad5db51531fe4
-size 13149629
+oid sha256:d9d191cce367af280b3f9abfba02153754ea1339df538e4b0954e383478ac48e
+size 13149615
index 2f7dcb10c1fca751f0ff721a6ddd00ebaa418cd3..59624df005311a43067a33466ff7fa83c74cde37 100644 (file)
@@ -13,6 +13,7 @@
  **/
 
 package com.ibm.icu.dev.test.format;
+
 import java.util.Locale;
 import java.util.Random;
 
@@ -23,6 +24,7 @@ import org.junit.runners.JUnit4;
 import com.ibm.icu.dev.test.TestFmwk;
 import com.ibm.icu.text.DecimalFormat;
 import com.ibm.icu.text.NumberFormat;
+import com.ibm.icu.util.ULocale;
 
 /**
  * This test does round-trip testing (format -> parse -> format -> parse -> etc.) of
@@ -167,6 +169,8 @@ public class IntlTestNumberFormat extends TestFmwk {
         boolean dump = false;
         int i;
 
+        String message = "Locale: " + fNumberFormat.getLocale(ULocale.VALID_LOCALE);
+
         for (i = 0; i < DEPTH; i++) {
             if (i == 0) {
                 number[i] = aNumber;
@@ -174,7 +178,7 @@ public class IntlTestNumberFormat extends TestFmwk {
                 try {
                     number[i - 1] = fNumberFormat.parse(string[i - 1]).doubleValue();
                 } catch(java.text.ParseException pe) {
-                    errln("**** FAIL: Parse of " + string[i-1] + " failed.");
+                    errln("**** FAIL: Parse of " + string[i-1] + " failed: " + message);
                     dump = true;
                     break;
                 }
@@ -187,7 +191,7 @@ public class IntlTestNumberFormat extends TestFmwk {
                     numberMatch = i;
                 else if (numberMatch > 0 && number[i] != number[i-1])
                 {
-                    errln("**** FAIL: Numeric mismatch after match.");
+                    errln("**** FAIL: Numeric mismatch after match: " + message);
                     dump = true;
                     break;
                 }
@@ -195,7 +199,7 @@ public class IntlTestNumberFormat extends TestFmwk {
                     stringMatch = i;
                 else if (stringMatch > 0 && string[i] != string[i-1])
                 {
-                    errln("**** FAIL: String mismatch after match.");
+                    errln("**** FAIL: String mismatch after match: " + message);
                     dump = true;
                     break;
                 }
@@ -208,7 +212,7 @@ public class IntlTestNumberFormat extends TestFmwk {
 
         if (stringMatch > 2 || numberMatch > 2)
         {
-            errln("**** FAIL: No string and/or number match within 2 iterations.");
+            errln("**** FAIL: No string and/or number match within 2 iterations: " + message);
             dump = true;
         }
 
@@ -229,16 +233,19 @@ public class IntlTestNumberFormat extends TestFmwk {
     public void tryIt(int aNumber) {
         long number;
 
+        String message = "Locale: " + fNumberFormat.getLocale(ULocale.VALID_LOCALE);
+
         String stringNum = fNumberFormat.format(aNumber);
         try {
             number = fNumberFormat.parse(stringNum).longValue();
         } catch (java.text.ParseException pe) {
-            errln("**** FAIL: Parse of " + stringNum + " failed.");
+            errln("**** FAIL: Parse of " + stringNum + " failed: " + message);
             return;
         }
 
         if (number != aNumber) {
-            errln("**** FAIL: Parse of " + stringNum + " failed. Got:" + number
+            errln("**** FAIL: Parse of " + stringNum + " failed: " + message
+                + " Got:" + number
                 + " Expected:" + aNumber);
         }
 
@@ -279,9 +286,9 @@ public class IntlTestNumberFormat extends TestFmwk {
         count = locales.length;
         if (count != 0)
         {
-            if (TestFmwk.getExhaustiveness() < 10 && count > 6) {
-                count = 6;
-                locales = new Locale[6];
+            if (TestFmwk.getExhaustiveness() < 10 && count > 7) {
+                count = 7;
+                locales = new Locale[count];
                 locales[0] = allLocales[0];
                 locales[1] = allLocales[1];
                 locales[2] = allLocales[2];
@@ -291,6 +298,7 @@ public class IntlTestNumberFormat extends TestFmwk {
                 locales[3] = new Locale("ar", "AE", "");
                 locales[4] = new Locale("cs", "CZ", "");
                 locales[5] = new Locale("en", "IN", "");
+                locales[6] = new Locale("su", "", "");
             }
             for (int i=0; i<count; ++i)
             {