1// Copyright (C) 2016 and later: Unicode, Inc. and others. 2// License & terms of use: http://www.unicode.org/copyright.html 3// Copyright (C) 2015-2016, International Business Machines 4// Corporation and others. All Rights Reserved. 5// 6// This file is divided into test suites separated by whitespace. Each test 7// suite starts with the name of the test followed by global field settings 8// for that test suite. After the global settings, comes "begin", the 9// per-test field names, and finally the test specific field values, 1 test 10// per line. 11// For more information on the format of this file, including all the available 12// field names, please see 13// https://docs.google.com/document/d/1T2P0p953_Lh1pRwo-5CuPVrHlIBa_wcXElG-Hhg_WHM/edit?usp=sharing 14 15test plus sign 16set locale ar 17set pattern +0;-# 18begin 19format output breaks 206 \u061C+\u0666 JK 21-6 \u061C-\u0666 K 22 23test basic patterns 24set locale fr_FR 25set format 1234.567 26begin 27pattern output 28#,##0.## 1\u00a0234,57 290.## 1234,57 300 1235 31#,##0.### 1\u00a0234,567 32###0.###### 1234,567 33###0.0000# 1234,5670 3400000.0000 01234,5670 35#,##0.00 \u00a4 1\u00a0234,57 \u20ac 36'tick''bitten '0.00 tick'bitten 1234,57 37'tick' 'bitten '0.00 tick bitten 1234,57 38 39 40test minimum and maximum fraction digits 41set locale en 42set minIntegerDigits 2 43set maxIntegerDigits 4 44set minFractionDigits 3 45set maxFractionDigits 5 46begin 47format output 486 06.000 496.000005 06.000 506.000006 06.00001 511002003004005 4005.000 52-1002003004005 -4005.000 5312 12.000 5412345 2345.000 5572.1234 72.1234 56 57test patterns with no '0' symbols 58set locale en_US 59begin 60pattern format output breaks 61# 514.23 514 62# 0.23 0 63# 0 0 64# 1 1 65##.# 514.23 514.2 66##.# 0.23 0.2 67##.# 0 0 68##.# 1 1 69#.# 514.23 514.2 70#.# 0.23 0.2 71#.# 0 0 72#.# 1 1 73.# 514.23 514.2 74.# 0.23 .2 75.# 0 .0 76.# 1 1.0 77#. 514.23 514. 78#. 0.23 0. 79#. 0 0. 80#. 1 1. 81. 514.23 514. 82. 0.23 0. 83. 0 0. 84. 1 1. 85 86test behavior on numbers approaching zero 87set locale en 88begin 89pattern format output breaks 90#.## 0.01 0.01 91#.## 0.001 0 92#.## 0 0 93#.00 0.01 .01 94#.00 0.001 .00 95#.00 0 .00 960.00 0.01 0.01 970.00 0.001 0.00 980.00 0 0.00 99 100// Not in official spec, but needed for backwards compatibility 101test patterns with leading grouping separator 102set locale en_US 103begin 104pattern format output breaks 105,##0 1234.56 1,235 106'#',## 3456 #34,56 107 108test patterns with valid and invalid quote marks 109set locale et 110begin 111pattern format output breaks 112'# 1 fail 113''# 1 '1 114'''# 1 fail 115''''# 1 ''1 116'''''# 1 fail 117'-''-'# 1 -'-1 118// K doesn't know the locale symbol for et 119-'-'# 1 −-1 K 120'#'# 1 #1 121''#'' 1 '1' 122''#- 1 '1− K 123'-'#- 1 -1− K 124-#'-' 1 −1- K 125 126test int64 127set locale en 128begin 129format output 1301002003004005 1002003004005 131-1002003004005 -1002003004005 132 133test rounding 134set locale fr 135begin 136pattern format output breaks 1370.5 1.25 1,0 K 1380.5 1.75 2,0 K 1390.5 -1.25 -1,0 K 14000.5 -1.75 -02,0 K 1414 2.0 0 K 1424 6.0 8 K 1434 10.0 8 K 1442.70 99.0 99,90 K 1452.73 272.0 273,00 K 146#,#3.70 104.0 1\u00a003,60 K 147 148test significant digits 149set locale en 150set pattern #,#@,@### 151begin 152format output breaks 1537 7.0 K 15423 23 K 155100 100 K 1561000 1000 K 15710000 1,0000 K 15810001 1,0001 K 15910001.5 1,0002 K 1601234567 1,23,4600 K 161-1234567 -1,23,4600 K 1623.14159 3.1416 K 163 164test scientific notation 165set locale fr 166begin 167pattern format output breaks 1680.00E0 12345 1,23E4 169000.00E0 12300 123,00E2 170000.0#E0 12300 123,0E2 171000.0#E0 12300.1 123,0E2 172000.0#E0 12301.0 123,01E2 173// JDK does not support exponent signs 174000.0#E+00 12301.0 123,01E+02 K 175// JDK gives 12,345E3. JDK seems to include the hashes in significant digits 176##0.00E0 12345 12,3E3 K 177// JDK gives 12,3001E3 178##0.0000E0 12300.1 12,300E3 K 179// JDK gives 12,3001E3 180##0.000#E0 12300.1 12,30E3 K 181##0.000#E0 12301 12,301E3 1820.05E0 12301.2 1,25E4 JK 183##0.000#E0 0.17 170,0E-3 184// JDK doesn't support significant digits in exponents 185@@@E0 6.235 6,24E0 K 186@@@E0 6235 6,24E3 K 187@@@#E0 6200 6,20E3 K 188@@@#E0 6201 6,201E3 K 189@@@#E0 6201.7 6,202E3 K 190@@@#E00 6201.7 6,202E03 K 191@@@#E+00 6201.7 6,202E+03 K 192// If no zeros are specified, significant digits is fraction length plus 1 193#.##E0 52413 5,24E4 194###.##E0 52413 52,4E3 K 195#E0 52413 5,2413E4 K 1960E0 52413 5E4 197 198test percents 199set locale fr 200begin 201pattern format output breaks 2020.0% 0.573 57,3% 203%0.0 0.573 %57,3 204p%p0.0 0.573 p%p57,3 205p'%'p0.0 0.573 p%p0,6 206%@@@@ 0.0326 %3,260 K 207%#,@@@ 15.43 %1\u00a0540 K 208// JDK does not support rounding increments 209%#,##4.1 16.55 %1\u00a0656,4 K 210// JDK gives %16,255E3 211%##0.00E0 162.55 %16,3E3 K 212 213test permille 214set locale fr 215begin 216pattern format output breaks 2170.0\u2030 0.573 573,0‰ 218\u20300.0 0.573 \u2030573,0 219p\u2030p0.0 0.573 p\u2030p573,0 220p'\u2030'p0.0 0.573 p\u2030p0,6 221\u2030@@@@ 0.0326 \u203032,60 K 222\u2030#,@@@ 15.43 \u203015\u00a0400 K 223\u2030#,##4.1 16.55 \u203016\u00a0551,7 K 224// JDK gives \u2030162,55E3 225\u2030##0.00E0 162.55 \u2030163E3 K 226 227test padding 228set locale fr_FR 229begin 230pattern format output breaks 231// JDK does not seem to support padding 232$**####,##0 1234 $***1\u00a0234 K 233*x$####,##0 1234 xxx$1\u00a0234 K 234####,##0*x$ 1234 1\u00a0234xxx$ K 235####,##0$*x 1234 1\u00a0234$xxx K 236// JDK doesn't seem to handle suffixes correctly dropping the 'nx' entirely 237####,##0$*x;ne#n -1234 ne1\u00a0234nx K 238####,##0$*x;n#'*' -1234 n1\u00a0234*xx K 239*y%4.2###### 4.33 yyyy%432,6 K 240// In J ICU adds padding as if 'EUR' is only 2 chars (2 * 0xa4) 241\u00a4\u00a4 **####0.00 433.0 EUR *433,00 JK 242// In J ICU adds padding as if 'EUR' is only 2 chars (2 * 0xa4) 243// Q fails this one because the test code bypasses CurrencyUsage 244\u00a4\u00a4 **#######0 433.0 EUR *433,00 JKQ 245 246test padding and currencies 247begin 248locale currency pattern format output breaks 249// In J, JPY is considered 2 char (2 * 0xa4) even though padding is done 250// after prefix. In C this test works. 251fr JPY \u00a4\u00a4 **#######0 433.22 JPY ****433 JK 252// JDK doesn't correct rounding for currency, shows USD (433 253en USD \u00a4\u00a4 **#######0;\u00a4\u00a4 (#) -433.22 USD (433.22) K 254 255test currencies 256set locale fr 257set format 1234.567 258begin 259pattern currency output breaks 260// JDK gives shows EUR instead of the euro symbol in this case 261#,##0.00 \u00a4 EUR 1\u00a0234,57 \u20ac K 262// JDK gives 1\u00A0234,57. JDK doesn't seem to correct rounding 263// based on currency. 264#,##0.00 \u00a4 JPY 1\u00a0235 JPY K 265 266test prefixes and suffixes 267set locale en 268set pattern 0.00+;(#) 269begin 270format output breaks 2717 7.00+ 272// JDK does not support negative suffixes 273-3.5 (3.50) K 274 275test minimum grouping digits 276set locale en 277set pattern #,##0 278set minGroupingDigits 2 279begin 280format output breaks 281// min grouping digits not supported in any existing implementation 282// but could be easily added to the new DecimalFormat C code. 2831000 1000 JK 28410000 10,000 285100000 100,000 2861000000 1,000,000 287 288test min max fraction digits 289set locale en 290set pattern #,##0.### 291set format 1234.567 292begin 293minFractionDigits maxFractionDigits output 2940 0 1,235 2950 2 1,234.57 2964 5 1,234.5670 297 298test min max integer digits 299set locale en 300set pattern #,##0.### 301set format 1234.567 302begin 303minIntegerDigits maxIntegerDigits output 3040 0 .567 3050 3 234.567 3065 5 01,234.567 307 308test min max fraction digits scientific 309set locale en 310set pattern #E0 311set format 299792458.0 312begin 313minIntegerDigits maxIntegerDigits minFractionDigits maxFractionDigits output breaks 314// JDK gives 2.99792458E8 (maxInt + maxFrac instead of minInt + maxFrac) 3151 99 0 5 2.99792E8 K 316// JDK gives .3E9 instead of unlimited precision. 3170 1 0 0 2.99792458E8 K 3181 1 0 0 3E8 319// JDK gives E0 instead of allowing for unlimited precision 3200 0 0 0 2.99792458E8 K 321// JDK gives .299792E9; Q gives 2.99792E8 3220 1 0 5 2.9979E8 KQ 323// JDK gives 300E6 3240 3 0 0 299.792458E6 K 325// JDK gives 299.8E6 (maybe maxInt + maxFrac instead of minInt + maxFrac)? 3260 3 0 1 300E6 K 327// JDK gives 299.7925E6 3282 3 0 4 299.792E6 K 329// JDK gives 299.79246E6 3302 3 0 5 299.7925E6 K 3313 3 0 5 299.79246E6 3323 3 0 4 299.7925E6 3332 2 0 3 29.979E7 3344 4 0 0 2998E5 3350 0 1 5 .29979E9 336// JDK gives E0 3370 0 1 0 2.99792458E8 K 338// JDK and Q give .2998E9 3390 0 0 4 2.998E8 KQ 340// According to the spec, if maxInt>minInt and minInt>1, then set 341// Context: #13289 3422 8 1 6 2.9979246E8 K 343// Treat max int digits > 8 as being the same as min int digits. 344// This behavior is not spelled out in the specification. 345// JDK fails here because it tries to use 9 + 6 = 15 sig digits. 3462 9 1 6 29.979246E7 K 347 348test significant digits scientific 349set locale en 350set pattern #E0 351set format 290000000.0 352begin 353minSigDigits maxSigDigits output breaks 3540 1 3E8 K 3550 2 2.9E8 K 3560 3 2.9E8 K 3571 1 3E8 K 3581 2 2.9E8 K 3591 3 2.9E8 K 3602 2 2.9E8 K 3612 3 2.9E8 K 3623 3 2.90E8 K 3633 4 2.90E8 K 364 365test min max fraction digits scientific 2 366set locale en 367set pattern #E0 368set format 29979245.0 369begin 370minIntegerDigits maxIntegerDigits minFractionDigits maxFractionDigits output breaks 371// JDK gives E0 3720 0 0 0 2.9979245E7 K 373// JDK gives .3E8 3740 1 0 0 2.9979245E7 K 375// JDK gives 2998E4. 3760 4 0 0 2997.9245E4 K 377 378test ticket 11524 379set locale en 380set pattern #,##0.### 381begin 382format maxIntegerDigits output breaks 383123 1 3 3840 0 0 385// Q ignores max integer if it is less than zero and prints "123" 386123 -2147483648 0 Q 38712345 1 5 38812345 -2147483648 0 Q 3895.3 1 5.3 3905.3 -2147483648 .3 Q 391 392test patterns with zero 393set locale en 394set format 0 395begin 396pattern output breaks 397#.# 0 398#. 0. 399.# .0 400# 0 401#,##0.00 0.00 402#,###.00 .00 40300.000E00 00.000E00 4040.####E0 0E0 405##0.######E000 0E000 406 407test significant digits manually set 408set locale en_US 409set pattern 0.0 410set useSigDigits 1 411set minSigDigits 3 412set maxSigDigits 5 413begin 414format output breaks 4150.0012 0.00120 K 4160.00123 0.00123 K 4170.001234 0.001234 K 4180.0012345 0.0012345 K 4190.00123456 0.0012346 K 420-43 -43.0 421-43.7 -43.7 422-43.76 -43.76 K 423-43.762 -43.762 K 424-43.7626 -43.763 K 425 426test grouping used setters 427set locale en_US 428set pattern #,##0 429set format 12345 430begin 431output useGrouping 43212,345 43312,345 1 43412345 0 435 436test grouping used setters in parsing 437set pattern #,##0 438begin 439locale useGrouping parse output breaks 440en_US 1 123,456 123456 441en_US 0 123,456 123 442en_US 1 123.456 123.456 443en_US 0 123.456 123.456 444fr_FR 1 123,456 123.456 445fr_FR 0 123,456 123.456 446// JDK returns 123 here; not sure why. 447fr_FR 1 123.456 123456 K 448fr_FR 0 123.456 123 449 450test no grouping in pattern with parsing 451set pattern 0 452begin 453locale parse output breaks 454en_US 123,456 123 455en_US 123.456 123.456 456fr_FR 123,456 123.456 457fr_FR 123.456 123 458 459test grouping setters 460set locale en_US 461set pattern 0 462set format 123456789 463set useGrouping 1 464begin 465output grouping breaks grouping2 minGroupingDigits 4661,2345,6789 4 4671,23,45,6789 4 K 2 4681,23,45,6789 4 K 2 2 469// Q only supports minGrouping<=2 470123,456789 6 6 3 471123456789 6 JKQ 6 4 472 473test multiplier setters 474set locale en_US 475begin 476format multiplier output breaks 47723 -12 -276 47823 -1 -23 479// ICU4J throws exception on zero multiplier. 480// ICU4C prints 23. 481// Q multiplies by zero and prints 0. 48223 0 0 CJ 48323 1 23 48423 12 276 485-23 12 -276 486-23 -12 276 487 488test rounding setters 489set locale en_US 490set pattern 0.0# 491set roundingIncrement 0.25 492begin 493format output breaks 494-0.35 -0.25 K 4950.35 0.25 K 496// Q doesn't support mixing minFrac with roundingIncrement (prints 0.50). 4970.39 0.5 KQ 4980.62 0.5 KQ 4990.63 0.75 K 500 501test padding setters 502set locale en_US 503set pattern bill0 504set format 1357 505begin 506padCharacter formatWidth output breaks 507* 8 bill1357 508* 9 *bill1357 K 509^ 10 ^^bill1357 K 510 511test use scientific setter 512set locale en_US 513set pattern 0.00 514set format 186283 515begin 516output breaks useScientific 517186283.00 5181.86E5 K 1 519186283.00 0 520 521test rounding mode setters 522set locale en_US 523set pattern 0.5 524begin 525format roundingMode output breaks 5261.24 halfUp 1.0 K 5271.25 halfUp 1.5 5281.25 halfDown 1.0 K 5291.26 halfDown 1.5 5301.25 halfEven 1.0 K 531-1.01 up -1.5 532-1.49 down -1.0 K 5331.01 up 1.5 5341.49 down 1.0 K 535-1.01 ceiling -1.0 K 536-1.49 floor -1.5 537 538test currency usage setters 539set locale CH 540set pattern \u00a4\u00a4 0 541begin 542format currency currencyUsage output breaks 5430.37 CHF standard CHF 0.37 K 5440.37 CHF cash CHF 0.35 K 5451.234 CZK standard CZK 1.23 K 5461.234 CZK cash CZK 1 547 548test currency usage to pattern 549set locale en 550begin 551currency currencyUsage toPattern breaks 552// These work in J, but it prepends an extra hash sign to the pattern. 553// C does not print the currency rounding information in the pattern. 554// K does not support this feature. 555USD standard 0.00 CJK 556CHF standard 0.00 CJK 557CZK standard 0.00 CJK 558USD cash 0.00 CJK 559CHF cash 0.05 CJK 560CZK cash 0 CJK 561 562test currency rounding 563set locale en 564set currency USD 565begin 566pattern format output breaks 567# 123 123 Q 568// Currency rounding should always override the pattern. 569// K prints the currency in ISO format for some reason. 570\u00a4# 123 $123.00 K 571\u00a4#.000 123 $123.00 K 572\u00a4#.## 123 $123.00 K 573 574test exponent parameter setters 575set locale en_US 576set pattern 0.##E0 577set format 299792458 578begin 579decimalSeparatorAlwaysShown exponentSignAlwaysShown minimumExponentDigits output breaks 5800 0 2 3E08 K 5810 1 3 3E+008 K 582// decimalSeparatorAlwaysShown K=JDK; C=ICU4C; J=ICU4J 583// See ticket 11621 5841 0 2 3.E08 K 5851 1 3 3.E+008 K 5861 0 1 3.E8 5870 0 1 3E8 588 589test exponent decimalSeparatorAlwaysShown default 590set locale en_US 591set pattern 0.##E0 592begin 593format output breaks decimalSeparatorAlwaysShown 594// decimalSeparatorAlwaysShown off by default 595299792458 3E8 596299000000 2.99E8 597299792458 3.E8 1 598 599test pad position setters 600set locale en_US 601set pattern **[#####0.##];((#)) 602begin 603format padPosition output breaks 60412.34 beforePrefix ****[12.34] K 60512.34 afterPrefix [****12.34] K 60612.34 beforeSuffix [12.34****] K 60712.34 afterSuffix [12.34]**** K 608-12.34 beforePrefix **((12.34)) K 609-12.34 afterPrefix ((**12.34)) K 610-12.34 beforeSuffix ((12.34**)) K 611-12.34 afterSuffix ((12.34))** K 612 613test affix setters 614set locale fr_FR 615set currency EUR 616set pattern 0.00 617begin 618format positivePrefix positiveSuffix negativePrefix negativeSuffix output 61912.34 % %12,34 62012.34 \u00a4\u00a4 12,34\u00a4\u00a4 62112.34 - + 12,34 622-12.34 - + -12,34+ 623-12.34 \u00a4 \u00a412,34 62412.34 \u00a4 12,34 625-12.34 % 12,34% 62612.34 % 12,34 627 628test more affix setters 629set locale fr_FR 630set pattern %0.00 631begin 632format positivePrefix negativePrefix output 6330.648 booya cooya booya64,80 634 635test nan and infinity 636set locale en_US 637set pattern [0.00];(#) 638begin 639format output breaks 640Inf [\u221e] 641-Inf (\u221e) K 642// Q prints the affixes 643NaN NaN KQ 644 645test nan and infinity with multiplication 646set locale en 647set multiplier 100 648begin 649format output breaks 650Inf \u221e 651-Inf -\u221e 652NaN NaN K 653 654test nan and infinity with padding 655set locale en_US 656set pattern $$$0.00$ 657set formatWidth 7 658begin 659format padPosition output breaks 660Inf beforePrefix $$$\u221e$ K 661Inf afterPrefix $$$ \u221e$ K 662Inf beforeSuffix $$$\u221e $ K 663Inf afterSuffix $$$\u221e$ K 664// Q gets $$$NaN$ 665NaN beforePrefix NaN KQ 666NaN afterPrefix NaN KQ 667NaN beforeSuffix NaN KQ 668NaN afterSuffix NaN KQ 669 670test apply formerly localized patterns 671begin 672// documentation says localizedPattern is not supported, change to pattern 673locale pattern format output breaks 674en #0% 0.4376 44% 675// This next test breaks JDK. JDK doesn't multiply by 100. 676fa \u0025\u00a0\u0023\u0030 0.4376 \u066a\u00a0\u06f4\u06f4 K 677 678test localized pattern basic symbol coverage 679begin 680locale localizedPattern toPattern breaks 681it #.##0,00 #,##0.00 682// JDK either doesn't know sl uses this character for minus sign 683// or doesn't support minus sign in localized pattern 684sl #.##0;#.##0− #,##0;#,##0- K 685// JDK does not have data for "×10^" in this locale 686en_SE 0,00×10^0;0,00×10^0- 0.00E0;0.00E0- K 687// JDK does not seem to transform the digits in localized patterns 688ar_SA #\u066C##\u0660\u066B\u0660\u0660\u061Ba# #,##0.00;a#,##0.00 K 689 690test toPattern 691set locale en 692begin 693pattern toPattern breaks 694// All of the "S" failures in this section are because of functionally equivalent patterns 695// JDK doesn't support any patterns with padding or both negative prefix and suffix 696// Breaks ICU4J See ticket 11671 697**0,000 **0,000 JK 698**##0,000 **##0,000 K 699**###0,000 **###0,000 K 700**####0,000 **#,##0,000 KS 701###,000. #,000. 7020,000 #0,000 S 703.00 #.00 704000 #000 S 705000,000 #,000,000 S 706pp#,000 pp#,000 70700.## #00.## S 708#,#00.025 #,#00.025 709// No secondary grouping in JDK 710#,##,###.02500 #,##,###.02500 K 711pp#,000;(#) pp#,000;(#,000) K 712**####,##,##0.0##;(#) **#,##,##,##0.0##;**(##,##,##0.0##) KS 713// No significant digits in JDK 714@@### @@### K 715@,@#,### @,@#,### K 7160.00E0 0.00E0 717// The following one works in JDK, probably because 718// it just returns the same string 719@@@##E0 @@@##E0 720###0.00#E0 ###0.00#E0 721##00.00#E0 ##00.00#E0 7220.00E+00 0.00E+00 K 723000.00E00 000.00E00 724###0.00#E00 ###0.00#E00 725 726test parse 727set locale en 728set pattern +#,##0.0###;(#) 729begin 730parse output breaks 731+5,347.25 5347.25 732+5,347,.25 5347.25 733+5,347, 5347 734+5347,,, 5347 735+5347,,,d8 5347 736(5,347.25) -5347.25 737// J requires prefix and suffix for lenient parsing, but C doesn't 7385,347.25 5347.25 JK 739(5,347.25 -5347.25 J 740// S is successful at parsing this as -5347.25 in lenient mode 741-5,347.25 -5347.25 CJK 742+3.52E4 35200 743(34.8E-3) -0.0348 744// JDK stops parsing at the spaces. JDK doesn't see space as a grouping separator 745(34 25E-1) -342.5 K 746(34,,25E-1) -342.5 747// J doesn't allow trailing separators before E but C does 748(34,,25,E-1) -342.5 J 749(34 25 E-1) -342.5 JK 750(34,,25 E-1) -342.5 CJK 751// Spaces are not allowed after exponent symbol 752// C parses up to the E but J bails 753(34 25E -1) -3425 JK 754+3.52EE4 3.52 755+1,234,567.8901 1234567.8901 756+1,23,4567.8901 1234567.8901 757+1,23,4567.89,01 1234567.89 758+1,23,456.78.9 123456.78 759+12.34,56 12.34 760+79,,20,3 79203 761+79 20 3 79203 K 762// Parsing stops at comma as it is different from other separators 763+79 20,3 7920 K 764+79,,20 3 7920 765+ 79 79 K 766+,79,,20,3 79203 767+7920d3 7920 768// Whitespace immediately after prefix doesn't count as digit separator 769// in C but is does in J 770+ ,79,,20,3 79203 JK 771( 19 45) -1945 K 772// C allows trailing separators when there is a prefix and suffix. 773// J allows trailing separators only when there is just a prefix. 774// In this case, J just bails 775( 19 45 ) -1945 JK 776(,,19,45) -1945 777// C parses to the space, but J bails 778(,,19 45) -19 J 779// J bails b/c comma different separator than space. C doesn't treat leading spaces 780// as a separator. 781( 19,45) -1945 JK 782// J bails. Doesn't allow trailing separators when there is prefix and suffix. 783(,,19,45,) -1945 J 784// J bails on next 4 because J doesn't allow letters inside prefix and suffix. 785// C will parse up to the letter. 786(,,19,45,d1) -1945 J 787(,,19,45d1) -1945 J 788( 19 45 d1) -1945 JK 789( 19 45d1) -1945 JK 790// J does allow trailing separator before a decimal point 791(19,45,.25) -1945.25 792// 2nd decimal points are ignored 793+4.12.926 4.12 794 795test parse suffix 796set locale en 797set pattern #,##0.0###+;#- 798begin 799parse output breaks 800// C sees this as -3426, don't understand why. 801// J and K just bail. 8023426 3426 JKC 8033426+ 3426 804// J bails; C and K see -34 80534 d1+ 34 JKC 806// JDK sees this as -1234 for some reason 807// J bails b/c of trailing separators 808// C parses until trailing separators, but sees -1234 8091,234,,,+ 1234 JKC 8101,234- -1234 811// J bails because of trailing separators 8121,234,- -1234 J 813// J bails here too 8141234 - -1234 J 815 816 817 818test parse strict 819set locale en 820set pattern +#,##,##0.0###;(#) 821set lenient 0 822set minGroupingDigits 2 823begin 824parse output breaks 825+123d5 123 826+5347.25 5347.25 827// separators in wrong place cause failure, no separators ok. 828+65,347.25 65347.25 829(65347.25) -65347.25 830(65,347.25) -65347.25 831// JDK does allow separators in the wrong place and parses as -5347.25 832(53,47.25) fail K 833// strict requires prefix or suffix, except in C 83465,347.25 fail 835+3.52E4 35200 836(34.8E-3) -0.0348 837(3425E-1) -342.5 838// Strict doesn't allow separators in sci notation. 839(63,425) -63425 840// JDK and S allow separators in sci notation and parses as -342.5 841// C passes 842(63,425E-1) fail CKS 843// Both prefix and suffix needed for strict. 844// JDK accepts this and parses as -342.5 845(3425E-1 fail K 846+3.52EE4 3.52 847+12,34,567.8901 1234567.8901 848// With strict digit separators don't have to be the right type 849// JDK doesn't acknowledge space as a separator 850+12 34 567.8901 1234567.8901 K 851// In general the grouping separators have to match their expected 852// location exactly. The only exception is when string being parsed 853// have no separators at all. 854+12,345.67 12345.67 855// JDK doesn't require separators to be in the right place. 856+1,23,4567.8901 fail K 857+1,234,567.8901 fail K 858+1234,567.8901 fail K 859+1,234567.8901 fail K 860+1234567.8901 1234567.8901 861// Minimum grouping is not satisfied below, but that's ok 862// because minimum grouping is optional. 863+1,234.5 1234.5 864// Comma after decimal means parse to a comma 865+1,23,456.78,9 123456.78 866// C and J fail upon seeing the second decimal point 867+1,23,456.78.9 123456.78 CJ 868+79 79 869+79 79 870+ 79 fail 871// JDK parses as -1945 872(1,945d1) fail K 873 874test parse strict scientific 875set locale en 876set pattern #E0 877set lenient 0 878begin 879parse output breaks 880123 fail CJK 881123E1 1230 882123E0 123 883123E fail CJK 884 885test parse strict without prefix/suffix 886set locale en 887set pattern # 888set lenient 0 889begin 890parse output breaks 89112.34 12.34 892-12.34 -12.34 893// The following case passes only when setSignAlwaysShown is enabled 894+12.34 fail 895$12.34 fail 896 897test parse integer only 898set locale en 899set pattern 0.00 900set parseIntegerOnly 1 901begin 902parse output breaks 90335 35 904// S accepts leading plus signs 905+35 35 CJK 906-35 -35 9072.63 2 908-39.99 -39 909 910test parse no exponent flag 911set pattern 0 912set locale en 913begin 914parseNoExponent parse output breaks 915// JDK doesn't allow lowercase exponent but ICU4J and ICU4C do. 9160 5e2 500 K 9170 5.3E2 530 918// See ticket 11725 9191 5e2 5 J 9201 5.3E2 5.3 JK 921 922test parse currency fail 923set pattern 0 924set locale en 925begin 926parse output outputCurrency breaks 927// Fixed in ticket 11735 92853.45 fail USD 929 930test parse strange prefix 931set locale en 932set positivePrefix dd 933set negativePrefix ddd 934begin 935parse output 936dd4582 4582 937ddd4582 -4582 938 939test parse strange suffix 940set locale en 941set positiveSuffix dd 942set negativePrefix 943set negativeSuffix ddd 944begin 945parse output 9464582dd 4582 9474582ddd -4582 948 949test really strange suffix 950set locale en 951set positiveSuffix 9K 952set negativePrefix 953set negativeSuffix 9N 954begin 955parse output breaks 956// S is the only implementation that passes these cases. 957// C consumes the '9' as a digit and assumes number is negative 958// J and JDK bail 9596549K 654 CJK 960// C consumes the '9' as a digit and assumes number is negative 961// J and JDK bail 9626549N -654 CJK 963 964test really strange prefix 965set locale en 966set positivePrefix 82 967set negativePrefix 28 968begin 969parse output 9708245 45 9712845 -45 972 973test parse pattern with quotes 974set locale en 975set pattern '-'#y 976begin 977parse output 978-45y 45 979 980test parse with locale symbols 981// The grouping separator in it_CH is an apostrophe 982set locale it_CH 983set pattern #,##0 984begin 985parse output breaks 986१३ 13 987१३.३१ 13.31 988123'456 123456 989524'1.3 5241.3 990३'१ 31 991 992test parse with European-style comma/period 993set locale pt 994set pattern #,##0 995begin 996parse output breaks 997123.456 123456 998123,456 123.456 999987,654.321 987.654 1000987,654 321 987.654 1001987.654,321 987654.321 1002 1003test select 1004set locale sr 1005begin 1006format pattern plural 1007Inf 0 other 1008-Inf 0 other 1009NaN 0 other 1010Inf 0.0 other 1011-Inf 0.0 other 1012NaN 0.0 other 10131 0 one 10141 0.0 other 10152 0 few 10162 0.0 other 10172 0E0 other 10185.1 0.0 one 10195.09 0.0 one 1020 1021test parse currency ISO 1022set pattern 0.00 \u00a4\u00a4;(#) \u00a4\u00a4 1023set locale en_GB 1024begin 1025parse output outputCurrency breaks 102653.45 fail GBP 1027£53.45 53.45 GBP 1028$53.45 fail USD J 102953.45 USD 53.45 USD 103053.45 GBP 53.45 GBP 1031USD 53.45 53.45 USD J 103253.45USD 53.45 USD CJ 1033USD53.45 53.45 USD 1034(7.92) USD -7.92 USD 1035(7.92) GBP -7.92 GBP 1036(7.926) USD -7.926 USD 1037(7.926 USD) -7.926 USD CJ 1038(USD 7.926) -7.926 USD CJ 1039USD (7.926) -7.926 USD CJ 1040USD (7.92) -7.92 USD CJ 1041(7.92)USD -7.92 USD CJ 1042USD(7.92) -7.92 USD CJ 1043(8) USD -8 USD 1044-8 USD -8 USD C 104567 USD 67 USD 104653.45$ fail USD 1047US Dollars 53.45 53.45 USD J 104853.45 US Dollars 53.45 USD 1049US Dollar 53.45 53.45 USD J 105053.45 US Dollar 53.45 USD 1051US Dollars53.45 53.45 USD 105253.45US Dollars 53.45 USD CJ 1053US Dollar53.45 53.45 USD 1054US Dollat53.45 fail USD 105553.45US Dollar 53.45 USD CJ 1056US Dollars (53.45) -53.45 USD CJ 1057(53.45) US Dollars -53.45 USD 1058(53.45) Euros -53.45 EUR 1059US Dollar (53.45) -53.45 USD CJ 1060(53.45) US Dollar -53.45 USD 1061US Dollars(53.45) -53.45 USD CJ 1062(53.45)US Dollars -53.45 USD CJ 1063US Dollar(53.45) -53.45 USD CJ 1064US Dollat(53.45) fail USD 1065(53.45)US Dollar -53.45 USD CJ 1066 1067 1068test parse currency ISO negative 1069set pattern 0.00 \u00a4\u00a4;-# \u00a4\u00a4 1070set locale en_GB 1071begin 1072parse output outputCurrency breaks 107353.45 fail GBP 1074£53.45 53.45 GBP 1075$53.45 fail USD J 107653.45 USD 53.45 USD 107753.45 GBP 53.45 GBP 1078USD 53.45 53.45 USD J 107953.45USD 53.45 USD CJ 1080USD53.45 53.45 USD 1081-7.92 USD -7.92 USD 1082-7.92 GBP -7.92 GBP 1083-7.926 USD -7.926 USD 1084USD -7.926 -7.926 USD CJ 1085-7.92USD -7.92 USD CJ 1086USD-7.92 -7.92 USD CJ 1087-8 USD -8 USD 108867 USD 67 USD 108953.45$ fail USD 1090US Dollars 53.45 53.45 USD J 109153.45 US Dollars 53.45 USD 1092US Dollar 53.45 53.45 USD J 109353.45 US Dollar 53.45 USD 1094US Dollars53.45 53.45 USD 109553.45US Dollars 53.45 USD CJ 1096US Dollar53.45 53.45 USD 1097US Dollat53.45 fail USD 109853.45US Dollar 53.45 USD CJ 1099 1100 1101test parse currency long 1102set pattern 0.00 \u00a4\u00a4\u00a4;(#) \u00a4\u00a4\u00a4 1103set locale en_GB 1104begin 1105parse output outputCurrency breaks 1106// J throws a NullPointerException on the first case 110753.45 fail GBP 1108£53.45 53.45 GBP 1109$53.45 fail USD J 111053.45 USD 53.45 USD 111153.45 GBP 53.45 GBP 1112USD 53.45 53.45 USD J 111353.45USD 53.45 USD CJ 1114USD53.45 53.45 USD 1115(7.92) USD -7.92 USD 1116(7.92) GBP -7.92 GBP 1117(7.926) USD -7.926 USD 1118(7.926 USD) -7.926 USD CJ 1119(USD 7.926) -7.926 USD CJ 1120USD (7.926) -7.926 USD CJ 1121USD (7.92) -7.92 USD CJ 1122(7.92)USD -7.92 USD CJ 1123USD(7.92) -7.92 USD CJ 1124(8) USD -8 USD 1125-8 USD -8 USD C 112667 USD 67 USD 1127// J throws a NullPointerException on the next case 112853.45$ fail USD 1129US Dollars 53.45 53.45 USD J 113053.45 US Dollars 53.45 USD 1131US Dollar 53.45 53.45 USD J 113253.45 US Dollar 53.45 USD 1133US Dollars53.45 53.45 USD 113453.45US Dollars 53.45 USD CJ 1135US Dollar53.45 53.45 USD 1136US Dollat53.45 fail USD 113753.45US Dollar 53.45 USD CJ 1138 1139 1140test parse currency short 1141set pattern 0.00 \u00a4;(#) \u00a4 1142set locale en_GB 1143begin 1144parse output outputCurrency breaks 114553.45 fail GBP 1146£53.45 53.45 GBP 1147$53.45 fail USD J 114853.45 USD 53.45 USD 114953.45 GBP 53.45 GBP 1150USD 53.45 53.45 USD J 115153.45USD 53.45 USD CJ 1152USD53.45 53.45 USD 1153(7.92) USD -7.92 USD 1154(7.92) GBP -7.92 GBP 1155(7.926) USD -7.926 USD 1156(7.926 USD) -7.926 USD CJ 1157(USD 7.926) -7.926 USD CJ 1158USD (7.926) -7.926 USD CJ 1159USD (7.92) -7.92 USD CJ 1160(7.92)USD -7.92 USD CJ 1161USD(7.92) -7.92 USD CJ 1162(8) USD -8 USD 1163-8 USD -8 USD C 116467 USD 67 USD 116553.45$ fail USD 1166US Dollars 53.45 53.45 USD J 116753.45 US Dollars 53.45 USD 1168US Dollar 53.45 53.45 USD J 116953.45 US Dollar 53.45 USD 1170US Dollars53.45 53.45 USD 117153.45US Dollars 53.45 USD CJ 1172US Dollar53.45 53.45 USD 1173US Dollat53.45 fail USD 117453.45US Dollar 53.45 USD CJ 1175 1176 1177test parse currency short prefix 1178set pattern \u00a40.00;(\u00a4#) 1179set locale en_GB 1180begin 1181parse output outputCurrency breaks 118253.45 fail GBP 1183£53.45 53.45 GBP 1184$53.45 fail USD J 118553.45 USD 53.45 USD C 118653.45 GBP 53.45 GBP C 1187USD 53.45 53.45 USD J 118853.45USD 53.45 USD CJ 1189USD53.45 53.45 USD 1190// S fails these because '(' is an incomplete prefix. 1191(7.92) USD -7.92 USD CJS 1192(7.92) GBP -7.92 GBP CJS 1193(7.926) USD -7.926 USD CJS 1194(7.926 USD) -7.926 USD CJS 1195(USD 7.926) -7.926 USD J 1196USD (7.926) -7.926 USD CJS 1197USD (7.92) -7.92 USD CJS 1198(7.92)USD -7.92 USD CJS 1199USD(7.92) -7.92 USD CJS 1200(8) USD -8 USD CJS 1201-8 USD -8 USD C 120267 USD 67 USD C 120353.45$ fail USD 1204US Dollars 53.45 53.45 USD J 120553.45 US Dollars 53.45 USD 1206US Dollar 53.45 53.45 USD J 120753.45 US Dollar 53.45 USD 1208US Dollars53.45 53.45 USD 120953.45US Dollars 53.45 USD CJ 1210US Dollar53.45 53.45 USD 121153.45US Dollar 53.45 USD CJ 1212 1213test format foreign currency 1214set locale fa_IR 1215set currency IRR 1216begin 1217pattern format output breaks 1218\u00a4\u00a4\u00a4 0.00;\u00a4\u00a4\u00a4 # 1235 \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 K 1219\u00a4\u00a4 0.00;\u00a4\u00a4 -# 1235 IRR \u06F1\u06F2\u06F3\u06F5 K 1220\u00a4 0.00;\u00a4 -# 1235 \u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 K 1221 1222test parse foreign currency symbol 1223set pattern \u00a4 0.00;\u00a4 -# 1224set locale fa_IR 1225begin 1226parse output outputCurrency 1227\u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 1235 IRR 1228IRR \u06F1\u06F2\u06F3\u06F5 1235 IRR 1229\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR 1230IRR 1235 1235 IRR 1231\u0631\u06cc\u0627\u0644 1235 1235 IRR 1232\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR 1233 1234test parse foreign currency ISO 1235set pattern \u00a4\u00a4 0.00;\u00a4\u00a4 -# 1236set locale fa_IR 1237begin 1238parse output outputCurrency 1239\u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 1235 IRR 1240IRR \u06F1\u06F2\u06F3\u06F5 1235 IRR 1241\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR 1242IRR 1235 1235 IRR 1243\u0631\u06cc\u0627\u0644 1235 1235 IRR 1244\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR 1245 1246test parse foreign currency full 1247set pattern \u00a4\u00a4\u00a4 0.00;\u00a4\u00a4\u00a4 -# 1248set locale fa_IR 1249begin 1250parse output outputCurrency 1251\u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 1235 IRR 1252IRR \u06F1\u06F2\u06F3\u06F5 1235 IRR 1253\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR 1254IRR 1235 1235 IRR 1255\u0631\u06cc\u0627\u0644 1235 1235 IRR 1256\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR 1257 1258test parse currency with foreign symbols symbol english 1259set pattern \u00a4 0.00;\u00a4 (#) 1260set locale en_US 1261begin 1262parse output outputCurrency 1263EUR 7.82 7.82 EUR 1264\u20ac 7.82 7.82 EUR 1265Euro 7.82 7.82 EUR 1266Euros 7.82 7.82 EUR 1267 1268test parse currency with foreign symbols ISO english 1269set pattern \u00a4\u00a4 0.00;\u00a4\u00a4 (#) 1270set locale en_US 1271begin 1272parse output outputCurrency 1273EUR 7.82 7.82 EUR 1274\u20ac 7.82 7.82 EUR 1275Euro 7.82 7.82 EUR 1276Euros 7.82 7.82 EUR 1277 1278test parse currency with foreign symbols full english 1279set pattern \u00a4\u00a4\u00a4 0.00;\u00a4\u00a4\u00a4 (#) 1280set locale en_US 1281begin 1282parse output outputCurrency 1283EUR 7.82 7.82 EUR 1284\u20ac 7.82 7.82 EUR 1285Euro 7.82 7.82 EUR 1286Euros 7.82 7.82 EUR 1287 1288test parse currency without currency mode 1289// Should accept a symbol associated with the currency specified by the API, 1290// but should not traverse the full currency data. 1291set locale en_US 1292set pattern \u00a4#,##0.00 1293begin 1294parse currency output breaks 1295$52.41 USD 52.41 1296USD52.41 USD 52.41 K 1297\u20ac52.41 USD fail 1298EUR52.41 USD fail 1299$52.41 EUR fail 1300USD52.41 EUR fail 1301\u20ac52.41 EUR 52.41 K 1302EUR52.41 EUR 52.41 1303 1304test parse currency ISO strict 1305set pattern 0.00 \u00a4\u00a4;(#) \u00a4\u00a4 1306set locale en_US 1307set lenient 0 1308begin 1309parse output outputCurrency breaks 1310$53.45 53.45 USD 131153.45 USD 53.45 USD 1312USD 53.45 fail USD 131353.45USD fail USD 1314USD53.45 53.45 USD 1315(7.92) USD -7.92 USD 1316(7.92) EUR -7.92 EUR 1317(7.926) USD -7.926 USD 1318(7.926 USD) fail USD 1319(USD 7.926) fail USD 1320USD (7.926) fail USD 1321USD (7.92) fail USD 1322(7.92)USD fail USD 1323USD(7.92) fail USD 1324(8) USD -8 USD 1325-8 USD fail USD J 132667 USD 67 USD 132753.45$ fail USD 1328US Dollars 53.45 fail USD 132953.45 US Dollars 53.45 USD 1330US Dollar 53.45 fail USD 133153.45 US Dollar 53.45 USD 1332US Dollars53.45 53.45 USD 133353.45US Dollars fail USD 1334US Dollar53.45 53.45 USD 1335US Dollat53.45 fail USD 133653.45US Dollar fail USD 1337US Dollars (53.45) fail USD 1338(53.45) US Dollars -53.45 USD 1339US Dollar (53.45) fail USD 1340(53.45) US Dollar -53.45 USD 1341US Dollars(53.45) fail USD 1342(53.45)US Dollars fail USD 1343US Dollar(53.45) fail USD 1344US Dollat(53.45) fail USD 1345(53.45)US Dollar fail USD 1346 1347test ticket 10436 1348set locale en 1349set roundingMode ceiling 1350set minFractionDigits 0 1351set maxFractionDigits 0 1352begin 1353format output breaks 1354-0.99 -0 JK 1355 1356test parse decimalPatternMatchRequired 1357set locale en 1358set decimalPatternMatchRequired 1 1359begin 1360pattern parse output breaks 1361// K doesn't support this feature. 13620 123 123 13630 123. fail CJK 13640 1.23 fail CJK 13650 -513 -513 13660 -513. fail CJK 13670 -5.13 fail CJK 13680.0 123 fail K 13690.0 123. 123 C 13700.0 1.23 1.23 C 13710.0 -513 fail K 13720.0 -513. -513 13730.0 -5.13 -5.13 1374 1375test parse minus sign 1376set locale en 1377set pattern # 1378begin 1379parse output breaks 1380-123 -123 1381- 123 -123 JK 1382 -123 -123 JK 1383 - 123 -123 JK 1384123- -123 CJKS 1385123 - -123 CJKS 1386 1387test parse case sensitive 1388set locale en 1389set lenient 1 1390set pattern Aa# 1391begin 1392parse parseCaseSensitive output breaks 1393Aa1.23 1 1.23 1394Aa1.23 0 1.23 1395AA1.23 1 fail 1396// J and K do not support case-insensitive parsing for prefix/suffix. 1397// J supports it for the exponent separator, but not K. 1398AA1.23 0 1.23 CJK 1399aa1.23 1 fail 1400aa1.23 0 1.23 CJK 1401Aa1.23E3 1 1230 1402Aa1.23E3 0 1230 1403Aa1.23e3 1 1.23 CJ 1404Aa1.23e3 0 1230 K 1405NaN 1 NaN K 1406NaN 0 NaN K 1407nan 1 fail 1408nan 0 NaN CJK 1409 1410test parse infinity and scientific notation overflow 1411set locale en 1412begin 1413parse output breaks 1414NaN NaN K 1415// JDK returns zero 14161E999999999999999 Inf K 1417-1E999999999999999 -Inf K 14181E-99999999999999 0.0 1419// Note: The test suite code doesn't properly check for 0.0 vs. -0.0 1420-1E-99999999999999 -0.0 14211E2147483648 Inf K 14221E2147483647 Inf K 14231E2147483646 1E2147483646 14241E-2147483649 0 14251E-2147483648 0 1426// S returns zero here 14271E-2147483647 1E-2147483647 S 14281E-2147483646 1E-2147483646 1429 1430test format push limits 1431set locale en 1432set minFractionDigits 2 1433set roundingMode halfDown 1434begin 1435maxFractionDigits format output breaks 1436// C has trouble formatting too many digits (#11318) 1437100 987654321987654321 987654321987654321.00 C 1438100 987654321.987654321 987654321.987654321 C 1439100 9999999999999.9950000000001 9999999999999.9950000000001 C 14402 9999999999999.9950000000001 10000000000000.00 C 14412 9999999.99499999 9999999.99 1442// K doesn't support halfDowm rounding mode? 14432 9999999.995 9999999.99 K 14442 9999999.99500001 10000000.00 1445100 56565656565656565656565656565656565656565656565656565656565656 56565656565656565656565656565656565656565656565656565656565656.00 C 1446100 454545454545454545454545454545.454545454545454545454545454545 454545454545454545454545454545.454545454545454545454545454545 C 1447100 0.0000000000000000000123 0.0000000000000000000123 1448100 -78787878787878787878787878787878 -78787878787878787878787878787878.00 C 1449100 -8989898989898989898989.8989898989898989 -8989898989898989898989.8989898989898989 C 1450 1451test ticket 11230 1452set locale en 1453set pattern #,##0 1454begin 1455parse output breaks 1456// K and J return null; S and C return 99 1457 9 9 9 CJKS 1458// K returns null 1459 9 999 9999 K 1460 1461test parse ignorables 1462set locale ar 1463// Note: Prefixes contain RLMs, as do some of the test cases. 1464set pattern x ab0c df 1465set negativePrefix y gh 1466set negativeSuffix i jk 1467begin 1468parse output breaks 1469x ab56c df 56 1470x ab56c df 56 K 1471x ab56c df 56 K 1472x ab56c df 56 JK 1473x ab56c df 56 K 1474x ab56 56 JK 1475x a b56 56 JK 147656cdf 56 JK 147756c df 56 JK 147856cd f 56 JK 147956cdf 56 JK 148056cdf 56 JK 148156c df 56 JK 148256c df 56 JK 1483y gh56i jk -56 1484y gh56i jk -56 K 1485y gh56i jk -56 K 1486y gh56i jk -56 JK 1487y gh56i jk -56 K 1488y gh56 -56 JK 1489y g h56 -56 JK 1490// S stops parsing after the 'i' for these and returns -56 1491// C stops before the 'i' and gets 56 149256ijk -56 CJK 149356i jk -56 CJK 149456ij k -56 CJK 149556ijk -56 CJK 149656ijk -56 CJK 149756i jk -56 CJK 149856i jk -56 CJK 1499// S and C get 56 (accepts ' ' gs grouping); J and K get null 15005 6 fail CS 150156 5 JK 1502 1503test parse spaces in grouping 1504// This test gives the ideal behavior of these cases, which 1505// none of the implementations currently support. 1506set locale en 1507set pattern #,##0 1508begin 1509parse output breaks 1510// C, J and S get "12" here 15111 2 1 CJS 15121 23 1 CJS 1513// K gets 1 here; doesn't pick up the grouping separator 15141 234 1234 K 1515 1516test rounding increment significant digits 1517// This test is for #13111 1518set locale en 1519set pattern 0.1 1520set useSigDigits 1 1521set maxSigDigits 2 1522begin 1523format output breaks 1524// C and J get "1" 1525// Q gets "1.0" 1526// K gets "1.1" (??) 15270.975 0.98 CJKQ 1528 1529test lenient parse currency match 1530// This test is for #13112 1531set locale en 1532set pattern ¤#,##0.00 1533begin 1534parse output breaks 1535// J and K get null 15361.23!@#$%^ 1.23 JK 1537 1538test percentage parsing multiplier 1539// This test is for #13114 1540set locale en 1541set pattern 0% 1542begin 1543parse output breaks 154455% 0.55 1545// J and K get null 154655 0.55 JK 1547 1548test trailing grouping separators in pattern 1549// This test is for #13115 1550set locale en 1551begin 1552pattern format output breaks 1553$0M 123456 $123456M 1554// The following patterns are rejected as malformed. 1555$0,M 123456 fail 1556$0,,M 123456 fail 1557 1558test empty negative subpattern 1559// This test is for #13117 1560set locale en 1561begin 1562pattern format output breaks 15630 -15 -15 15640; -15 -15 1565// C, J, and K still prepend a '-' even though the pattern says otherwise 15660;0 -15 15 CJK 1567 1568test percentage multiplier parsing 1569// This test is for #13129 1570set locale en 1571set pattern 0% 1572begin 1573parse output breaks 15749223372036854775807% 92233720368547758.07 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618