]> granicus.if.org Git - icu/commitdiff
ICU-11897 Fixing testNumberingSystem in C and J.
authorShane Carr <shane@unicode.org>
Wed, 16 May 2018 21:48:35 +0000 (21:48 +0000)
committerShane Carr <shane@unicode.org>
Wed, 16 May 2018 21:48:35 +0000 (21:48 +0000)
X-SVN-Rev: 41387

icu4c/source/test/intltest/tsdcfmsy.cpp
icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/IntlTestDecimalFormatSymbols.java

index 3dcc68d4a6d96935b219343fc35c3b2b758d59fb..18a1ae863c1927afbe9e7f15e38bf2398ce2a6e0 100644 (file)
@@ -354,16 +354,18 @@ void IntlTestDecimalFormatSymbols::testNumberingSystem() {
         const char16_t* expected1; // Expected number format string
         const char16_t* expected2; // Expected pattern separator
     };
-    static const testcase cases[9] = {
-            {"en", "latn", u"1,234.56", u";"},
-            {"en", "arab", u"١٬٢٣٤٫٥٦", u"؛"},
-            {"en", "mathsanb", u"𝟭,𝟮𝟯𝟰.𝟱𝟲", u";"},
-            {"en", "mymr", u"၁,၂၃၄.၅၆", u";"},
-            {"my", "latn", u"1,234.56", u";"},
-            {"my", "arab", u"١٬٢٣٤٫٥٦", u"؛"},
-            {"my", "mathsanb", u"𝟭,𝟮𝟯𝟰.𝟱𝟲", u";"},
-            {"my", "mymr", u"၁,၂၃၄.၅၆", u"၊"},
-            {"en@numbers=thai", "mymr", u"၁,၂၃၄.၅၆", u";"}, // conflicting numbering system
+    static const testcase cases[] = {
+            {"en", "latn", u"1,234.56", u"%"},
+            {"en", "arab", u"١٬٢٣٤٫٥٦", u"٪\u061C"},
+            {"en", "mathsanb", u"𝟭,𝟮𝟯𝟰.𝟱𝟲", u"%"},
+            {"en", "mymr", u"၁,၂၃၄.၅၆", u"%"},
+            {"my", "latn", u"1,234.56", u"%"},
+            {"my", "arab", u"١٬٢٣٤٫٥٦", u"٪\u061C"},
+            {"my", "mathsanb", u"𝟭,𝟮𝟯𝟰.𝟱𝟲", u"%"},
+            {"my", "mymr", u"၁,၂၃၄.၅၆", u"%"},
+            {"ar", "latn", u"1,234.56", u"\u200E%\u200E"},
+            {"ar", "arab", u"١٬٢٣٤٫٥٦", u"٪\u061C"},
+            {"en@numbers=thai", "mymr", u"၁,၂၃၄.၅၆", u"%"}, // conflicting numbering system
     };
 
     for (int i=0; i<8; i++) {
@@ -380,12 +382,11 @@ void IntlTestDecimalFormatSymbols::testNumberingSystem() {
             return;
         }
         Verify(1234.56, "#,##0.##", dfs, expected1);
-        // The pattern separator is something that differs by numbering system in my@numbers=mymr.
-        UnicodeString actual2 = dfs.getSymbol(DecimalFormatSymbols::kPatternSeparatorSymbol);
-        if (expected2 != actual2) {
-            errln((UnicodeString)"ERROR: DecimalFormatSymbols returned pattern separator " + actual2
-                + " but we expected " + expected2);
-        }
+        // The percent sign differs by numbering system.
+        UnicodeString actual2 = dfs.getSymbol(DecimalFormatSymbols::kPercentSymbol);
+        assertEquals((UnicodeString) "Percent sign with " + cas.locid + " and " + cas.nsname,
+            expected2,
+            actual2);
     }
 }
 
index 0d6f7d0b1f5b126065cea14ef27d6e05f93e619c..1042d3f82989bec3ed9b50becdd8a6a096599de1 100644 (file)
@@ -365,32 +365,35 @@ public class IntlTestDecimalFormatSymbols extends TestFmwk
     @Test
     public void testNumberingSystem() {
         Object[][] cases = {
-                {"en", "latn", "1,234.56", ';'},
-                {"en", "arab", "١٬٢٣٤٫٥٦", '؛'},
-                {"en", "mathsanb", "𝟭,𝟮𝟯𝟰.𝟱𝟲", ';'},
-                {"en", "mymr", "၁,၂၃၄.၅၆", ';'},
-                {"my", "latn", "1,234.56", ';'},
-                {"my", "arab", "١٬٢٣٤٫٥٦", '؛'},
-                {"my", "mathsanb", "𝟭,𝟮𝟯𝟰.𝟱𝟲", ';'},
-                {"my", "mymr", "၁,၂၃၄.၅၆", '၊'},
-                {"en@numbers=thai", "mymr", "၁,၂၃၄.၅၆", ';'}, // conflicting numbering system
+                {"en", "latn", "1,234.56", '%'},
+                {"en", "arab", "١٬٢٣٤٫٥٦", "٪\u061C"},
+                {"en", "mathsanb", "𝟭,𝟮𝟯𝟰.𝟱𝟲", '%'},
+                {"en", "mymr", "၁,၂၃၄.၅၆", '%'},
+                {"my", "latn", "1,234.56", '%'},
+                {"my", "arab", "١٬٢٣٤٫٥٦", "٪\u061C"},
+                {"my", "mathsanb", "𝟭,𝟮𝟯𝟰.𝟱𝟲", '%'},
+                {"my", "mymr", "၁,၂၃၄.၅၆", '%'},
+                {"ar", "latn", "1,234.56", "\u200E%\u200E"},
+                {"ar", "arab", "١٬٢٣٤٫٥٦", "٪\u061C"},
+                {"en@numbers=thai", "mymr", "၁,၂၃၄.၅၆", '%'}, // conflicting numbering system
         };
 
         for (Object[] cas : cases) {
             ULocale loc = new ULocale((String) cas[0]);
             NumberingSystem ns = NumberingSystem.getInstanceByName((String) cas[1]);
             String expectedFormattedNumberString = (String) cas[2];
-            char expectedPatternSeparator = (Character) cas[3];
+            String expectedPercentSign = String.valueOf(cas[3]);
 
             DecimalFormatSymbols dfs = DecimalFormatSymbols.forNumberingSystem(loc, ns);
             DecimalFormat df = new DecimalFormat("#,##0.##", dfs);
             String actual1 = df.format(1234.56);
             assertEquals("1234.56 with " + loc + " and " + ns.getName(),
                     expectedFormattedNumberString, actual1);
-            // The pattern separator is something that differs by numbering system in my@numbers=mymr.
-            char actual2 = dfs.getPatternSeparator();
-            assertEquals("Pattern separator with " + loc + " and " + ns.getName(),
-                    expectedPatternSeparator, actual2);
+
+            // The percent sign differs by numbering system.
+            String actual2 = dfs.getPercentString();
+            assertEquals("Percent sign with " + loc + " and " + ns.getName(),
+                    expectedPercentSign, actual2);
 
             // Coverage for JDK Locale overload
             DecimalFormatSymbols dfs2 = DecimalFormatSymbols.forNumberingSystem(loc.toLocale(), ns);