From 66eb21ec588cf40cf7347322ac37fe167eafaeb8 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Mon, 26 Feb 2018 23:32:05 +0000 Subject: [PATCH] ICU-13567 make Arabic number formatting tests work with both native & ASCII digits X-SVN-Rev: 40988 --- icu4c/source/test/cintltst/cnumtst.c | 2 +- .../test/intltest/compactdecimalformattest.cpp | 2 +- icu4c/source/test/intltest/dtfmttst.cpp | 8 ++++---- icu4c/source/test/intltest/numbertest_api.cpp | 4 ++-- .../test/testdata/numberformattestspecification.txt | 2 +- .../dev/test/format/CompactDecimalFormatTest.java | 12 ++++++------ .../com/ibm/icu/dev/test/format/DateFormatTest.java | 4 ++-- .../icu/dev/test/format/NumberFormatTestCases.txt | 2 +- .../icu/dev/test/number/NumberFormatterApiTest.java | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/icu4c/source/test/cintltst/cnumtst.c b/icu4c/source/test/cintltst/cnumtst.c index e2cd68abae1..d11cca78b3e 100644 --- a/icu4c/source/test/cintltst/cnumtst.c +++ b/icu4c/source/test/cintltst/cnumtst.c @@ -2372,7 +2372,7 @@ static const NumSysTestItem numSysTestItems[] = { { "en", "latn", 10, FALSE, latnDesc }, { "en@numbers=roman", "roman", 10, TRUE, romanDesc }, { "en@numbers=finance", "latn", 10, FALSE, latnDesc }, - { "ar", "arab", 10, FALSE, arabDesc }, + { "ar-EG", "arab", 10, FALSE, arabDesc }, { "fa", "arabext", 10, FALSE, arabextDesc }, { "zh_Hans@numbers=hanidec", "hanidec", 10, FALSE, hanidecDesc }, { "zh_Hant@numbers=traditional", "hant", 10, TRUE, hantDesc }, diff --git a/icu4c/source/test/intltest/compactdecimalformattest.cpp b/icu4c/source/test/intltest/compactdecimalformattest.cpp index 5ced1513b36..9bdaaad6636 100644 --- a/icu4c/source/test/intltest/compactdecimalformattest.cpp +++ b/icu4c/source/test/intltest/compactdecimalformattest.cpp @@ -279,7 +279,7 @@ void CompactDecimalFormatTest::TestSwahiliShortNegative() { } void CompactDecimalFormatTest::TestArabicLong() { - CheckLocale("ar", UNUM_LONG, kArabicLong, UPRV_LENGTHOF(kArabicLong)); + CheckLocale("ar-EG", UNUM_LONG, kArabicLong, UPRV_LENGTHOF(kArabicLong)); } void CompactDecimalFormatTest::TestSignificantDigits() { diff --git a/icu4c/source/test/intltest/dtfmttst.cpp b/icu4c/source/test/intltest/dtfmttst.cpp index fd3a9f1faf0..35870f780f5 100644 --- a/icu4c/source/test/intltest/dtfmttst.cpp +++ b/icu4c/source/test/intltest/dtfmttst.cpp @@ -1355,18 +1355,18 @@ DateFormatTest::TestLocaleDateFormat() // Bug 495 void DateFormatTest::TestFormattingLocaleTimeSeparator() { - // This test not as useful is it once was, since timeSeparator - // in the Arabic is changed back to ":" in CLDR 28. + // This test not as useful as it once was, since timeSeparator + // in the Arabic locale is changed back to ":" in CLDR 28. const UDate testDate = 874266720000.; // Sun Sep 14 21:52:00 CET 1997 logln((UnicodeString)"Date set to : " + dateToString(testDate)); const LocalPointer tz(TimeZone::createTimeZone("CET")); const LocalPointer dfArab(DateFormat::createTimeInstance( - DateFormat::SHORT, Locale("ar"))); + DateFormat::SHORT, Locale("ar", "EG"))); const LocalPointer dfLatn(DateFormat::createTimeInstance( - DateFormat::SHORT, Locale("ar", NULL, NULL, "numbers=latn"))); + DateFormat::SHORT, Locale("ar", "EG", NULL, "numbers=latn"))); if (dfLatn.isNull() || dfArab.isNull()) { dataerrln("Error calling DateFormat::createTimeInstance()"); diff --git a/icu4c/source/test/intltest/numbertest_api.cpp b/icu4c/source/test/intltest/numbertest_api.cpp index 783bb00e2f6..64656c81758 100644 --- a/icu4c/source/test/intltest/numbertest_api.cpp +++ b/icu4c/source/test/intltest/numbertest_api.cpp @@ -1486,9 +1486,9 @@ void NumberFormatterApiTest::symbols() { u"US$ 12,345.67"); assertFormatSingle( - u"Currency symbol should follow number in ar with NS arab", + u"Currency symbol should follow number in ar-EG with NS arab", NumberFormatter::with().unit(USD), - Locale("ar"), + Locale("ar-EG"), 12345.67, u"١٢٬٣٤٥٫٦٧ US$"); diff --git a/icu4c/source/test/testdata/numberformattestspecification.txt b/icu4c/source/test/testdata/numberformattestspecification.txt index afddf315698..1f11f8da7c1 100644 --- a/icu4c/source/test/testdata/numberformattestspecification.txt +++ b/icu4c/source/test/testdata/numberformattestspecification.txt @@ -13,7 +13,7 @@ // https://docs.google.com/document/d/1T2P0p953_Lh1pRwo-5CuPVrHlIBa_wcXElG-Hhg_WHM/edit?usp=sharing test plus sign -set locale ar +set locale ar-EG set pattern +0;-# begin format output breaks diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/CompactDecimalFormatTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/CompactDecimalFormatTest.java index d62d160187b..244ab5214da 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/CompactDecimalFormatTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/CompactDecimalFormatTest.java @@ -393,7 +393,7 @@ public class CompactDecimalFormatTest extends TestFmwk { @Test public void TestArabicLongStyle() { NumberFormat cdf = - CompactDecimalFormat.getInstance(new Locale("ar"), CompactStyle.LONG); + CompactDecimalFormat.getInstance(new Locale("ar-EG"), CompactStyle.LONG); assertEquals("Arabic Long", "\u061C-\u0665\u066B\u0663 \u0623\u0644\u0641", cdf.format(-5300)); } @@ -690,17 +690,17 @@ public class CompactDecimalFormatTest extends TestFmwk { assertEquals("CDF should correctly format 43000 in 'ar'", "٤٣ ألف", result); // Bug #12449 - cdf = CompactDecimalFormat.getInstance(new ULocale("ar"), CompactDecimalFormat.CompactStyle.SHORT); + cdf = CompactDecimalFormat.getInstance(new ULocale("ar-EG"), CompactDecimalFormat.CompactStyle.SHORT); cdf.setMaximumSignificantDigits(3); result = cdf.format(1234); - assertEquals("CDF should correctly format 1234 with 3 significant digits in 'ar'", "١٫٢٣ ألف", result); + assertEquals("CDF should correctly format 1234 with 3 significant digits in 'ar-EG'", "١٫٢٣ ألف", result); // Check currency formatting as well - cdf = CompactDecimalFormat.getInstance(new ULocale("ar"), CompactDecimalFormat.CompactStyle.SHORT); + cdf = CompactDecimalFormat.getInstance(new ULocale("ar-EG"), CompactDecimalFormat.CompactStyle.SHORT); result = cdf.format(new CurrencyAmount(43000f, Currency.getInstance("USD"))); - assertEquals("CDF should correctly format 43000 with currency in 'ar'", "US$ ٤٣ ألف", result); + assertEquals("CDF should correctly format 43000 with currency in 'ar-EG'", "US$ ٤٣ ألف", result); result = cdf.format(new CurrencyAmount(-43000f, Currency.getInstance("USD"))); - assertEquals("CDF should correctly format -43000 with currency in 'ar'", "؜-US$ ٤٣ ألف", result); + assertEquals("CDF should correctly format -43000 with currency in 'ar-EG'", "؜-US$ ٤٣ ألف", result); // Extra locale with different positive/negative formats cdf = CompactDecimalFormat.getInstance(new ULocale("fi"), CompactDecimalFormat.CompactStyle.SHORT); diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java index 110a881e861..205fe4e4cf9 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java @@ -2067,8 +2067,8 @@ public class DateFormatTest extends TestFmwk { Date date = new Date(874266720000L); // Sun Sep 14 21:52:00 CET 1997 TimeZone tz = TimeZone.getTimeZone("CET"); - DateFormat dfArab = DateFormat.getTimeInstance(DateFormat.SHORT, new ULocale("ar")); - DateFormat dfLatn = DateFormat.getTimeInstance(DateFormat.SHORT, new ULocale("ar-u-nu-latn")); + DateFormat dfArab = DateFormat.getTimeInstance(DateFormat.SHORT, new ULocale("ar-EG")); + DateFormat dfLatn = DateFormat.getTimeInstance(DateFormat.SHORT, new ULocale("ar-EG-u-nu-latn")); dfArab.setTimeZone(tz); dfLatn.setTimeZone(tz); diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatTestCases.txt b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatTestCases.txt index 14b52190170..18cb765a128 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatTestCases.txt +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatTestCases.txt @@ -109,7 +109,7 @@ p: - "1 234,56" 1234.56 p: - "1,234,56" 1.234 p: - "1。234、56" 1234.56 -loc= "ar" +loc= "ar-EG" p: - "1234٫56" 1234.56 p: - "1234،56" 1234.56 p: - "1234،56" 1234.56 diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/number/NumberFormatterApiTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/number/NumberFormatterApiTest.java index fe01e1e3ec9..ec4ff7e0fc7 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/number/NumberFormatterApiTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/number/NumberFormatterApiTest.java @@ -1579,10 +1579,10 @@ public class NumberFormatterApiTest { "US$ 12,345.67"); assertFormatSingle( - "Currency symbol should follow number in ar with NS arab", + "Currency symbol should follow number in ar-EG with NS arab", "", NumberFormatter.with().unit(USD), - new ULocale("ar"), + new ULocale("ar-EG"), 12345.67, "١٢٬٣٤٥٫٦٧ US$"); -- 2.40.0