ICU-21005 Fix exhaustive test failure in IntlTestNumberFormat.
This commit is contained in:
parent
b03feb6338
commit
0d26f83f83
@ -40,7 +40,7 @@ su{
|
||||
}
|
||||
XXX{
|
||||
"¤",
|
||||
"-",
|
||||
"XXX",
|
||||
}
|
||||
}
|
||||
Currencies%narrow{
|
||||
@ -83,7 +83,7 @@ su{
|
||||
other{"dolar A.S."}
|
||||
}
|
||||
XXX{
|
||||
other{"-"}
|
||||
other{"XXX"}
|
||||
}
|
||||
}
|
||||
CurrencyUnitPatterns{
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:11d8383eaff95db943d886a25e5c9d5a251e7c905868a72ed1dad5db51531fe4
|
||||
size 13149629
|
||||
oid sha256:d9d191cce367af280b3f9abfba02153754ea1339df538e4b0954e383478ac48e
|
||||
size 13149615
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user