X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/249c4c5ea9376c24572daf9c2effa7484a282f14..3d1f044b704633e2e541231cd17ae9ecf9ad5c7a:/icuSources/test/testdata/numberformattestspecification.txt?ds=sidebyside diff --git a/icuSources/test/testdata/numberformattestspecification.txt b/icuSources/test/testdata/numberformattestspecification.txt index a26874e4..b48cc6c3 100644 --- a/icuSources/test/testdata/numberformattestspecification.txt +++ b/icuSources/test/testdata/numberformattestspecification.txt @@ -9,13 +9,12 @@ // per-test field names, and finally the test specific field values, 1 test // per line. // -// breaks field names: +// Field names: // H = ICU4J 58 (archive) // J = ICU4J (current) // K = JDK (ignored if not OpenJDK 1.8) // C = ICU4C (current) // P = Properties-based ICU4J (bypasses DecimalFormat wrapper) -// Q = ? (old, from ICU 61 tests, maybe the same as P? // // For more information on the format of this file, including all the available // field names, please see @@ -33,15 +32,16 @@ test basic patterns set locale fr_FR set format 1234.567 begin -pattern output -#,##0.## 1\u00a0234,57 +pattern output breaks +// K does not use \u202f narrow space +#,##0.## 1\u202f234,57 K 0.## 1234,57 0 1235 -#,##0.### 1\u00a0234,567 +#,##0.### 1\u202f234,567 K ###0.###### 1234,567 ###0.0000# 1234,5670 00000.0000 01234,5670 -#,##0.00 \u00a4 1\u00a0234,57 \u20ac +#,##0.00 \u00a4 1\u202f234,57 \u20ac K 'tick''bitten '0.00 tick'bitten 1234,57 'tick' 'bitten '0.00 tick bitten 1234,57 @@ -152,7 +152,7 @@ pattern format output breaks 4 10.0 8 K 2.70 99.0 99,90 K 2.73 272.0 273,00 K -#,#3.70 104.0 1\u00a003,60 K +#,#3.70 104.0 1\u202f03,60 K test significant digits set locale en @@ -204,6 +204,29 @@ pattern format output breaks #E0 52413 5,2413E4 K 0E0 52413 5E4 +test scientific infinite precision +// ICU-11511, ICU-7460, CLDR-10103 +set locale en +begin +pattern format output breaks +// From the spec: +// "0.##E0 means a max of 3 significant digits." +0.##E0 98760 9.88E4 +// "#.##E0 also means a max of 3 significant digits." +#.##E0 98760 9.88E4 +// "#.0#E0 means a max of 2 significant digits." +#.0#E0 98760 9.9E4 K +// "0E0 means a max of 1 significant digit." +0E0 98760 1E5 +// "#E0 means infinite precision." +#E0 98760 9.876E4 K +// "###E0 means engineering notation with infinite precision." +###E0 98760 98.76E3 K +// Additional tests: +##0.#E0 98760 99E3 K +###.#E0 98760 99E3 K +##0E0 98760 100E3 K + test percents set locale fr begin @@ -213,9 +236,9 @@ pattern format output breaks p%p0.0 0.573 p%p57,3 p'%'p0.0 0.573 p%p0,6 %@@@@ 0.0326 %3,260 K -%#,@@@ 15.43 %1\u00a0540 K +%#,@@@ 15.43 %1\u202f540 K // JDK does not support rounding increments -%#,##4.1 16.55 %1\u00a0656,4 K +%#,##4.1 16.55 %1\u202f656,4 K // JDK gives %16,255E3 %##0.00E0 162.55 %16,3E3 K @@ -228,8 +251,8 @@ pattern format output breaks p\u2030p0.0 0.573 p\u2030p573,0 p'\u2030'p0.0 0.573 p\u2030p0,6 \u2030@@@@ 0.0326 \u203032,60 K -\u2030#,@@@ 15.43 \u203015\u00a0400 K -\u2030#,##4.1 16.55 \u203016\u00a0551,7 K +\u2030#,@@@ 15.43 \u203015\u202f400 K +\u2030#,##4.1 16.55 \u203016\u202f551,7 K // JDK gives \u2030162,55E3 \u2030##0.00E0 162.55 \u2030163E3 K @@ -238,13 +261,13 @@ set locale fr_FR begin pattern format output breaks // JDK does not seem to support padding -$**####,##0 1234 $***1\u00a0234 K -*x$####,##0 1234 xxx$1\u00a0234 K -####,##0*x$ 1234 1\u00a0234xxx$ K -####,##0$*x 1234 1\u00a0234$xxx K +$**####,##0 1234 $***1\u202f234 K +*x$####,##0 1234 xxx$1\u202f234 K +####,##0*x$ 1234 1\u202f234xxx$ K +####,##0$*x 1234 1\u202f234$xxx K // JDK doesn't seem to handle suffixes correctly dropping the 'nx' entirely -####,##0$*x;ne#n -1234 ne1\u00a0234nx K -####,##0$*x;n#'*' -1234 n1\u00a0234*xx K +####,##0$*x;ne#n -1234 ne1\u202f234nx K +####,##0$*x;n#'*' -1234 n1\u202f234*xx K *y%4.2###### 4.33 yyyy%432,6 K // In J ICU adds padding as if 'EUR' is only 2 chars (2 * 0xa4) \u00a4\u00a4 **####0.00 433.0 EUR *433,00 HK @@ -267,10 +290,10 @@ set format 1234.567 begin pattern currency output breaks // JDK gives shows EUR instead of the euro symbol in this case -#,##0.00 \u00a4 EUR 1\u00a0234,57 \u20ac K +#,##0.00 \u00a4 EUR 1\u202f234,57 \u20ac K // JDK gives 1\u00A0234,57. JDK doesn't seem to correct rounding // based on currency. -#,##0.00 \u00a4 JPY 1\u00a0235 JPY K +#,##0.00 \u00a4 JPY 1\u202f235 JPY K test prefixes and suffixes set locale en @@ -327,8 +350,8 @@ minIntegerDigits maxIntegerDigits minFractionDigits maxFractionDigits output bre 1 1 0 0 3E8 // JDK gives E0 instead of allowing for unlimited precision 0 0 0 0 2.99792458E8 K -// JDK gives .299792E9; Q gives 2.99792E8 -0 1 0 5 2.9979E8 KQ +// J gives 2.9979E8 +0 1 0 5 2.99792E8 HK // JDK gives 300E6 0 3 0 0 299.792458E6 K // JDK gives 299.8E6 (maybe maxInt + maxFrac instead of minInt + maxFrac)? @@ -344,8 +367,8 @@ minIntegerDigits maxIntegerDigits minFractionDigits maxFractionDigits output bre 0 0 1 5 .29979E9 // JDK gives E0 0 0 1 0 2.99792458E8 K -// JDK and Q give .2998E9 -0 0 0 4 2.998E8 KQ +// J gives 2.998E8 +0 0 0 4 .29979E9 HK // According to the spec, if maxInt>minInt and minInt>1, then set // Context: #13289 2 8 1 6 2.9979246E8 K @@ -354,6 +377,15 @@ minIntegerDigits maxIntegerDigits minFractionDigits maxFractionDigits output bre // JDK fails here because it tries to use 9 + 6 = 15 sig digits. 2 9 1 6 29.979246E7 K +test ticket 20058 +set locale en +begin +pattern format output breaks +#00.0##E0 0 0.0E0 K +#00.0##E0 1.2 1.2E0 K +#00.0E0 0 0.0E0 K +#00.0E0 1.2 1.2E0 K + test significant digits scientific set locale en set pattern #E0 @@ -390,14 +422,14 @@ set pattern #,##0.### begin format maxIntegerDigits output breaks 123 1 3 -// (ICU 61 behavior) -0 0 0 -// Q ignores max integer if it is less than zero and prints "123" -123 -2147483648 0 Q +// C obeys maxIntegerDigits and prints after the decimal place +0 0 .0 HKP +// CJP ignore max integer if it is less than zero and prints "123" +123 -2147483648 0 CJP 12345 1 5 -12345 -2147483648 0 Q +12345 -2147483648 0 CJP 5.3 1 5.3 -5.3 -2147483648 .3 Q +5.3 -2147483648 .3 CJP test patterns with zero set locale en @@ -566,14 +598,13 @@ set locale en begin currency currencyUsage toPattern breaks // These work in J, but it prepends an extra hash sign to the pattern. -// C does not print the currency rounding information in the pattern. // K does not support this feature. -USD standard 0.00 CHK -CHF standard 0.00 CHK -CZK standard 0.00 CHK -USD cash 0.00 CHK -CHF cash 0.05 CHK -CZK cash 0 CHK +USD standard 0.00 HK +CHF standard 0.00 HK +CZK standard 0.00 HK +USD cash 0.00 HK +CHF cash 0.05 HK +CZK cash 0 HK test currency rounding set locale en @@ -657,8 +688,7 @@ Inf [\u221e] -Inf (\u221e) K // J does not print the affixes // K prints \uFFFD -// Q prints the affixes -NaN NaN HKQ +NaN [NaN] HK test nan and infinity with multiplication set locale en @@ -681,11 +711,10 @@ Inf beforeSuffix $$$\u221e $ K Inf afterSuffix $$$\u221e$ K // J does not print the affixes // K prints \uFFFD -// Q gets $$$NaN$ -NaN beforePrefix NaN HKQ -NaN afterPrefix NaN HKQ -NaN beforeSuffix NaN HKQ -NaN afterSuffix NaN HKQ +NaN beforePrefix $$$NaN$ HK +NaN afterPrefix $$$ NaN$ HK +NaN beforeSuffix $$$NaN $ HK +NaN afterSuffix $$$NaN$ HK test apply formerly localized patterns begin @@ -717,19 +746,19 @@ pattern toPattern breaks **0,000 **0,000 HK **##0,000 **##0,000 K **###0,000 **###0,000 K -**####0,000 **#,##0,000 JKP +**####0,000 **#,##0,000 CJKP ###,000. #,000. -0,000 #0,000 JP +0,000 #0,000 CJP .00 #.00 -000 #000 JP -000,000 #,000,000 JP +000 #000 CJP +000,000 #,000,000 CJP pp#,000 pp#,000 -00.## #00.## JP +00.## #00.## CJP #,#00.025 #,#00.025 // No secondary grouping in JDK #,##,###.02500 #,##,###.02500 K pp#,000;(#) pp#,000;(#,000) K -**####,##,##0.0##;(#) **#,##,##,##0.0##;**(##,##,##0.0##) JKP +**####,##,##0.0##;(#) **#,##,##,##0.0##;**(##,##,##0.0##) CJKP // No significant digits in JDK @@### @@### K @,@#,### @,@#,### K @@ -758,7 +787,7 @@ parse output breaks 5,347.25 5347.25 HK (5,347.25 -5347.25 H // S is successful at parsing this as -5347.25 in lenient mode --5,347.25 -5347.25 CHK +-5,347.25 -5347.25 HK +3.52E4 35200 (34.8E-3) -0.0348 // JDK stops parsing at the spaces. JDK doesn't see space as a grouping separator @@ -767,9 +796,9 @@ parse output breaks // Trailing grouping separators are not OK. // H fails; C/J/P stop at the offending separator. (34,,25,E-1) fail CJKP -(34,,25,E-1) -342.5 H +(34,,25,E-1) -3425 HK (34 25 E-1) -342.5 HK -(34,,25 E-1) -342.5 CHK +(34,,25 E-1) -342.5 HK // Spaces are not allowed after exponent symbol // C parses up to the E but H bails (34 25E -1) -3425 HK @@ -821,19 +850,17 @@ set locale en set pattern #,##0.0###+;#- begin parse output breaks -// C sees this as -3426, don't understand why. // J and K just bail. -3426 3426 CHK +3426 3426 HK 3426+ 3426 -// J bails; C and K see -34 -34 d1+ 34 CHK +// J bails; K sees -34 +34 d1+ 34 HK // JDK sees this as -1234 for some reason // H bails b/c of trailing separators -// C parses until trailing separators, but sees -1234 -1,234,,,+ 1234 CHK +1,234,,,+ 1234 HK 1,234- -1234 -// H and P bail because of trailing separators -1,234,- -1234 HJP +// H, C, and P bail because of trailing separators +1,234,- -1234 CHJP // J bails here too 1234 - -1234 H @@ -886,8 +913,8 @@ parse output breaks +1,234.5 1234.5 // Comma after decimal means parse to a comma +1,23,456.78,9 123456.78 -// C and H fail upon seeing the second decimal point -+1,23,456.78.9 123456.78 CH +// H fails upon seeing the second decimal point ++1,23,456.78.9 123456.78 H +79 79 +79 79 + 79 fail @@ -926,7 +953,7 @@ begin parse output breaks 35 35 // S accepts leading plus signs -+35 35 CHK ++35 35 HK -35 -35 2.63 2 -39.99 -39 @@ -1046,44 +1073,44 @@ begin parse output outputCurrency breaks 53.45 fail GBP £53.45 53.45 GBP -$53.45 fail USD J +$53.45 53.45 USD C 53.45 USD 53.45 USD 53.45 GBP 53.45 GBP USD 53.45 53.45 USD H -53.45USD 53.45 USD CH +53.45USD 53.45 USD H USD53.45 53.45 USD (7.92) USD -7.92 USD (7.92) GBP -7.92 GBP (7.926) USD -7.926 USD -(7.926 USD) -7.926 USD CH -(USD 7.926) -7.926 USD CH -USD (7.926) -7.926 USD CH -USD (7.92) -7.92 USD CH -(7.92)USD -7.92 USD CH -USD(7.92) -7.92 USD CH +(7.926 USD) -7.926 USD H +(USD 7.926) -7.926 USD H +USD (7.926) -7.926 USD H +USD (7.92) -7.92 USD H +(7.92)USD -7.92 USD H +USD(7.92) -7.92 USD H (8) USD -8 USD --8 USD -8 USD C +-8 USD -8 USD 67 USD 67 USD -53.45$ fail USD +53.45$ 53.45 USD CH US Dollars 53.45 53.45 USD H 53.45 US Dollars 53.45 USD US Dollar 53.45 53.45 USD H 53.45 US Dollar 53.45 USD US Dollars53.45 53.45 USD -53.45US Dollars 53.45 USD CH +53.45US Dollars 53.45 USD H US Dollar53.45 53.45 USD US Dollat53.45 fail USD -53.45US Dollar 53.45 USD CH -US Dollars (53.45) -53.45 USD CH +53.45US Dollar 53.45 USD H +US Dollars (53.45) -53.45 USD H (53.45) US Dollars -53.45 USD (53.45) Euros -53.45 EUR -US Dollar (53.45) -53.45 USD CH +US Dollar (53.45) -53.45 USD H (53.45) US Dollar -53.45 USD -US Dollars(53.45) -53.45 USD CH -(53.45)US Dollars -53.45 USD CH -US Dollar(53.45) -53.45 USD CH +US Dollars(53.45) -53.45 USD H +(53.45)US Dollars -53.45 USD H +US Dollar(53.45) -53.45 USD H US Dollat(53.45) fail USD -(53.45)US Dollar -53.45 USD CH +(53.45)US Dollar -53.45 USD H test parse currency ISO negative @@ -1093,18 +1120,18 @@ begin parse output outputCurrency breaks 53.45 fail GBP £53.45 53.45 GBP -$53.45 fail USD J +$53.45 53.45 USD C 53.45 USD 53.45 USD 53.45 GBP 53.45 GBP USD 53.45 53.45 USD H -53.45USD 53.45 USD CH +53.45USD 53.45 USD H USD53.45 53.45 USD -7.92 USD -7.92 USD -7.92 GBP -7.92 GBP -7.926 USD -7.926 USD -USD -7.926 -7.926 USD CH --7.92USD -7.92 USD CH -USD-7.92 -7.92 USD CH +USD -7.926 -7.926 USD H +-7.92USD -7.92 USD H +USD-7.92 -7.92 USD H -8 USD -8 USD 67 USD 67 USD 53.45$ 53.45 USD CH @@ -1113,10 +1140,10 @@ US Dollars 53.45 53.45 USD H US Dollar 53.45 53.45 USD H 53.45 US Dollar 53.45 USD US Dollars53.45 53.45 USD -53.45US Dollars 53.45 USD CH +53.45US Dollars 53.45 USD H US Dollar53.45 53.45 USD US Dollat53.45 fail USD -53.45US Dollar 53.45 USD CH +53.45US Dollar 53.45 USD H test parse currency long @@ -1127,23 +1154,23 @@ parse output outputCurrency breaks // H throws a NullPointerException on the first case 53.45 fail GBP £53.45 53.45 GBP -$53.45 fail USD J +$53.45 53.45 USD C 53.45 USD 53.45 USD 53.45 GBP 53.45 GBP USD 53.45 53.45 USD H -53.45USD 53.45 USD CH +53.45USD 53.45 USD H USD53.45 53.45 USD (7.92) USD -7.92 USD (7.92) GBP -7.92 GBP (7.926) USD -7.926 USD -(7.926 USD) -7.926 USD CH -(USD 7.926) -7.926 USD CH -USD (7.926) -7.926 USD CH -USD (7.92) -7.92 USD CH -(7.92)USD -7.92 USD CH -USD(7.92) -7.92 USD CH +(7.926 USD) -7.926 USD H +(USD 7.926) -7.926 USD H +USD (7.926) -7.926 USD H +USD (7.92) -7.92 USD H +(7.92)USD -7.92 USD H +USD(7.92) -7.92 USD H (8) USD -8 USD --8 USD -8 USD C +-8 USD -8 USD 67 USD 67 USD // H throws a NullPointerException on the next case 53.45$ 53.45 USD CH @@ -1152,10 +1179,10 @@ US Dollars 53.45 53.45 USD H US Dollar 53.45 53.45 USD H 53.45 US Dollar 53.45 USD US Dollars53.45 53.45 USD -53.45US Dollars 53.45 USD CH +53.45US Dollars 53.45 USD H US Dollar53.45 53.45 USD US Dollat53.45 fail USD -53.45US Dollar 53.45 USD CH +53.45US Dollar 53.45 USD H test parse currency short @@ -1165,23 +1192,23 @@ begin parse output outputCurrency breaks 53.45 fail GBP £53.45 53.45 GBP -$53.45 fail USD J +$53.45 53.45 USD C 53.45 USD 53.45 USD 53.45 GBP 53.45 GBP USD 53.45 53.45 USD H -53.45USD 53.45 USD CH +53.45USD 53.45 USD H USD53.45 53.45 USD (7.92) USD -7.92 USD (7.92) GBP -7.92 GBP (7.926) USD -7.926 USD -(7.926 USD) -7.926 USD CH -(USD 7.926) -7.926 USD CH -USD (7.926) -7.926 USD CH -USD (7.92) -7.92 USD CH -(7.92)USD -7.92 USD CH -USD(7.92) -7.92 USD CH +(7.926 USD) -7.926 USD H +(USD 7.926) -7.926 USD H +USD (7.926) -7.926 USD H +USD (7.92) -7.92 USD H +(7.92)USD -7.92 USD H +USD(7.92) -7.92 USD H (8) USD -8 USD --8 USD -8 USD C +-8 USD -8 USD 67 USD 67 USD 53.45$ 53.45 USD CH US Dollars 53.45 53.45 USD H @@ -1189,10 +1216,10 @@ US Dollars 53.45 53.45 USD H US Dollar 53.45 53.45 USD H 53.45 US Dollar 53.45 USD US Dollars53.45 53.45 USD -53.45US Dollars 53.45 USD CH +53.45US Dollars 53.45 USD H US Dollar53.45 53.45 USD US Dollat53.45 fail USD -53.45US Dollar 53.45 USD CH +53.45US Dollar 53.45 USD H test parse currency short prefix @@ -1202,11 +1229,11 @@ begin parse output outputCurrency breaks 53.45 fail GBP £53.45 53.45 GBP -$53.45 fail USD J -53.45 USD 53.45 USD C -53.45 GBP 53.45 GBP C +$53.45 53.45 USD C +53.45 USD 53.45 USD +53.45 GBP 53.45 GBP USD 53.45 53.45 USD H -53.45USD 53.45 USD CH +53.45USD 53.45 USD H USD53.45 53.45 USD // C and P fail these because '(' is an incomplete prefix. (7.92) USD -7.92 USD CHJP @@ -1219,17 +1246,17 @@ USD (7.92) -7.92 USD CHJP (7.92)USD -7.92 USD CHJP USD(7.92) -7.92 USD CHJP (8) USD -8 USD CHJP --8 USD -8 USD C -67 USD 67 USD C +-8 USD -8 USD +67 USD 67 USD 53.45$ 53.45 USD CH US Dollars 53.45 53.45 USD H 53.45 US Dollars 53.45 USD US Dollar 53.45 53.45 USD H 53.45 US Dollar 53.45 USD US Dollars53.45 53.45 USD -53.45US Dollars 53.45 USD CH +53.45US Dollars 53.45 USD H US Dollar53.45 53.45 USD -53.45US Dollar 53.45 USD CH +53.45US Dollar 53.45 USD H test format foreign currency set locale fa_IR @@ -1248,10 +1275,10 @@ parse output outputCurrency breaks \u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 1235 IRR IRR \u06F1\u06F2\u06F3\u06F5 1235 IRR // P fails here because this currency name is in the Trie only, but it has the same prefix as the non-Trie currency -\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR JP +\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR CJP IRR 1235 1235 IRR \u0631\u06cc\u0627\u0644 1235 1235 IRR -\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR JP +\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR CJP test parse foreign currency ISO set pattern \u00a4\u00a4 0.00;\u00a4\u00a4 -# @@ -1260,10 +1287,10 @@ begin parse output outputCurrency breaks \u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 1235 IRR IRR \u06F1\u06F2\u06F3\u06F5 1235 IRR -\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR JP +\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR CJP IRR 1235 1235 IRR \u0631\u06cc\u0627\u0644 1235 1235 IRR -\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR JP +\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR CJP test parse foreign currency full set pattern \u00a4\u00a4\u00a4 0.00;\u00a4\u00a4\u00a4 -# @@ -1272,10 +1299,10 @@ begin parse output outputCurrency breaks \u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 1235 IRR IRR \u06F1\u06F2\u06F3\u06F5 1235 IRR -\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR JP +\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR CJP IRR 1235 1235 IRR \u0631\u06cc\u0627\u0644 1235 1235 IRR -\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR JP +\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR CJP test parse currency with foreign symbols symbol english set pattern \u00a4 0.00;\u00a4 (#) @@ -1329,11 +1356,11 @@ set locale en_US set lenient 0 begin parse output outputCurrency breaks -$53.45 53.45 USD JP +$53.45 53.45 USD CJP 53.45 USD 53.45 USD USD 53.45 fail USD 53.45USD fail USD -USD53.45 53.45 USD JP +USD53.45 53.45 USD CJP (7.92) USD -7.92 USD (7.92) EUR -7.92 EUR (7.926) USD -7.926 USD @@ -1351,9 +1378,9 @@ US Dollars 53.45 fail USD 53.45 US Dollars 53.45 USD US Dollar 53.45 fail USD 53.45 US Dollar 53.45 USD -US Dollars53.45 53.45 USD JP +US Dollars53.45 53.45 USD CJP 53.45US Dollars fail USD -US Dollar53.45 53.45 USD JP +US Dollar53.45 53.45 USD CJP US Dollat53.45 fail USD 53.45US Dollar fail USD US Dollars (53.45) fail USD @@ -1382,14 +1409,14 @@ begin pattern parse output breaks // K doesn't support this feature. 0 123 123 -0 123. fail CHK -0 1.23 fail CHK +0 123. fail HK +0 1.23 fail HK 0 -513 -513 -0 -513. fail CHK -0 -5.13 fail CHK +0 -513. fail HK +0 -5.13 fail HK 0.0 123 fail K -0.0 123. 123 C -0.0 1.23 1.23 C +0.0 123. 123 +0.0 1.23 1.23 0.0 -513 fail K 0.0 -513. -513 0.0 -5.13 -5.13 @@ -1419,17 +1446,17 @@ Aa1.23 0 1.23 AA1.23 1 fail // H and K do not support case-insensitive parsing for prefix/suffix. // H supports it for the exponent separator, but not K. -AA1.23 0 1.23 CHK +AA1.23 0 1.23 HK aa1.23 1 fail -aa1.23 0 1.23 CHK +aa1.23 0 1.23 HK Aa1.23E3 1 1230 Aa1.23E3 0 1230 -Aa1.23e3 1 1.23 CH +Aa1.23e3 1 1.23 H Aa1.23e3 0 1230 K NaN 1 NaN K NaN 0 NaN K nan 1 fail -nan 0 NaN CHK +nan 0 NaN HK test parse infinity and scientific notation overflow set locale en @@ -1479,13 +1506,13 @@ begin pattern lenient parse output breaks // Groups after the first group need 2 digits to be accepted. // JDK does not see space as grouping and parses most of these as 9. -#,##0 1 9 9 9 CH +#,##0 1 9 9 9 H #,##0 1 9 99 999 K #,##0 1 9 999 9999 K -#,##0 1 9 9 9 9 CH +#,##0 1 9 9 9 9 H #,##0 1 ,9 9 #,##0 1 99,.0 99 -#,##0 1 9 9. 9 CH +#,##0 1 9 9. 9 H #,##0 1 9 99. 999 K 0 1 9 9 9 0 1 9 99 9 @@ -1552,13 +1579,13 @@ y gh56 -56 HK y g h56 -56 HK // S stops parsing after the 'i' for these and returns -56 // C stops before the 'i' and gets 56 -56ijk -56 CHK -56i jk -56 CHK -56ij k -56 CHK -56i‎j‎k -56 CHK -56ijk -56 CHK -56i j‎k -56 CHK -56‎i jk -56 CHK +56ijk -56 HK +56i jk -56 HK +56ij k -56 HK +56i‎j‎k -56 HK +56ijk -56 HK +56i j‎k -56 HK +56‎i jk -56 HK // S and C get 56 (accepts ' ' gs grouping); H and K get null 5 6 fail CJP 5‎6 5 HK @@ -1571,7 +1598,7 @@ set locale en set pattern #,##0 begin parse output breaks -1 2 1 CH +1 2 1 H 1 23 123 K // K gets 1 here; doesn't pick up the grouping separator 1 234 1234 K @@ -1626,8 +1653,8 @@ begin pattern format output breaks 0 -15 -15 0; -15 -15 -// C, H and K still prepend a '-' even though the pattern says otherwise -0;0 -15 15 CHK +// H and K still prepend a '-' even though the pattern says otherwise +0;0 -15 15 HK test percentage multiplier parsing // This test is for #13129 @@ -1643,9 +1670,9 @@ set pattern 0 set signAlwaysShown 1 begin format output breaks -// C, H and K do not support this feature -42 +42 CHK -0 +0 CHK +// H and K do not support this feature +42 +42 HK +0 +0 HK -42 -42 test parse strict with plus sign @@ -1656,14 +1683,14 @@ begin lenient parse output breaks 1 42 42 1 -42 -42 -1 +42 42 CHK +1 +42 42 HK 1 0 0 -1 +0 0 CHK -0 42 fail CHK +1 +0 0 HK +0 42 fail HK 0 -42 -42 -0 +42 42 CHK -0 0 fail CHK -0 +0 0 CHK +0 +42 42 HK +0 0 fail HK +0 +0 0 HK test parse with scientific-separator-affix overlap set locale en @@ -1674,7 +1701,32 @@ pattern lenient parse output breaks 0E0'.'x 1 5E3.x 5000 0E0'.'x 0 5E3.x 5000 -test parse lowercase currency +test parse() lowercase currency +set locale en +set pattern ¤¤0 +set currency USD +begin +parse output breaks +USD123 123 +USD 123 123 HK +usd123 123 K +usd 123 123 HK +Usd123 123 K +Usd 123 123 HK +// US$ is not used for US dollars in en-US +US$123 fail H +us$123 fail +Us$123 fail +123 US dollars 123 K +123 US DOLLARS 123 K +123 us dollars 123 K +// Foreign currencies are not accepted in .parse() +GBP123 fail +gbp123 fail +British pounds 123 fail +british POUNDS 123 fail + +test parseCurrency() lowercase currency set locale en set pattern ¤¤0 set currency USD @@ -1682,17 +1734,20 @@ begin parse output outputCurrency breaks USD123 123 USD USD 123 123 USD H -// C does not currently accept case-insensitive ISO codes -usd123 123 USD C -usd 123 123 USD CH -Usd123 123 USD C -Usd 123 123 USD CH +usd123 123 USD +usd 123 123 USD H +Usd123 123 USD +Usd 123 123 USD H US$123 123 USD C us$123 fail fail Us$123 fail fail 123 US dollars 123 USD 123 US DOLLARS 123 USD 123 us dollars 123 USD +GBP123 123 GBP +gbp123 123 GBP C +British pounds 123 123 GBP H +british POUNDS 123 123 GBP H