1 // Copyright (C) 2015, International Business Machines 2 // Corporation and others. All Rights Reserved. 3 // 4 // This file is divided into test suites separated by whitespace. Each test 5 // suite starts with the name of the test followed by global field settings 6 // for that test suite. After the global settings, comes "begin", the 7 // per-test field names, and finally the test specific field values, 1 test 8 // per line. 9 // For more information on the format of this file, including all the available 10 // field names, please see 11 // https://docs.google.com/document/d/1T2P0p953_Lh1pRwo-5CuPVrHlIBa_wcXElG-Hhg_WHM/edit?usp=sharing 12 13 test plus sign 14 set locale ar 15 set pattern +0;-# 16 begin 17 format output breaks 18 6 \u200F+\u0666 JK 19 -6 \u200F-\u0666 JK 20 21 test basic patterns 22 set locale fr_FR 23 set format 1234.567 24 begin 25 pattern output 26 #,##0.## 1\u00a0234,57 27 0.## 1234,57 28 0 1235 29 #,##0.### 1\u00a0234,567 30 ###0.###### 1234,567 31 ###0.0000# 1234,5670 32 00000.0000 01234,5670 33 #,##0.00 \u00a4 1\u00a0234,57 \u20ac 34 'tick''bitten '0.00 tick'bitten 1234,57 35 'tick' 'bitten '0.00 tick bitten 1234,57 36 37 38 test minimum and maximum fraction digits 39 set locale en 40 set minIntegerDigits 2 41 set maxIntegerDigits 4 42 set minFractionDigits 3 43 set maxFractionDigits 5 44 begin 45 format output 46 6 06.000 47 6.000005 06.000 48 6.000006 06.00001 49 1002003004005 4005.000 50 -1002003004005 -4005.000 51 12 12.000 52 12345 2345.000 53 72.1234 72.1234 54 55 test int64 56 set locale en 57 begin 58 format output 59 1002003004005 1002003004005 60 -1002003004005 -1002003004005 61 62 test rounding 63 set locale fr 64 begin 65 pattern format output breaks 66 0.5 1.25 1,0 K 67 0.5 1.75 2,0 K 68 0.5 -1.25 -1,0 K 69 00.5 -1.75 -02,0 K 70 4 2.0 0 K 71 4 6.0 8 K 72 4 10.0 8 K 73 2.70 99.0 99,90 K 74 2.73 272.0 273,00 K 75 #,#3.70 104.0 1\u00a003,60 K 76 77 test significant digits 78 set locale en 79 set pattern #,#@,@### 80 begin 81 format output breaks 82 7 7.0 K 83 23 23 K 84 100 100 K 85 1000 1000 K 86 10000 1,0000 K 87 10001 1,0001 K 88 10001.5 1,0002 K 89 1234567 1,23,4600 K 90 -1234567 -1,23,4600 K 91 3.14159 3.1416 K 92 93 test scientific notation 94 set locale fr 95 begin 96 pattern format output breaks 97 0.00E0 12345 1,23E4 98 000.00E0 12300 123,00E2 99 000.0#E0 12300 123,0E2 100 000.0#E0 12300.1 123,0E2 101 000.0#E0 12301.0 123,01E2 102 // JDK does not support exponent signs 103 000.0#E+00 12301.0 123,01E+02 K 104 // JDK gives 12,345E3. JDK seems to include the hashes in significant digits 105 ##0.00E0 12345 12,3E3 K 106 // JDK gives 12,3001E3 107 ##0.0000E0 12300.1 12,300E3 K 108 // JDK gives 12,3001E3 109 ##0.000#E0 12300.1 12,30E3 K 110 ##0.000#E0 12301 12,301E3 111 0.05E0 12301.2 1,25E4 JK 112 ##0.000#E0 0.17 170,0E-3 113 // JDK doesn't support significant digits in exponents 114 @@@E0 6235 6,24E3 K 115 @@@#E0 6200 6,20E3 K 116 @@@#E0 6201 6,201E3 K 117 @@@#E0 6201.7 6,202E3 K 118 @@@#E00 6201.7 6,202E03 K 119 @@@#E+00 6201.7 6,202E+03 K 120 121 test percents 122 set locale fr 123 begin 124 pattern format output breaks 125 0.0% 0.573 57,3% 126 %0.0 0.573 %57,3 127 p%p0.0 0.573 p%p57,3 128 p'%'p0.0 0.573 p%p0,6 129 %@@@@ 0.0326 %3,260 K 130 %#,@@@ 15.43 %1\u00a0540 K 131 // JDK does not support rounding increments 132 %#,##4.1 16.55 %1\u00a0656,4 K 133 // JDK gives %16,255E3 134 %##0.00E0 162.55 %16,3E3 K 135 136 test permille 137 set locale fr 138 begin 139 pattern format output breaks 140 0.0\u2030 0.573 573,0 141 \u20300.0 0.573 \u2030573,0 142 p\u2030p0.0 0.573 p\u2030p573,0 143 p'\u2030'p0.0 0.573 p\u2030p0,6 144 \u2030@@@@ 0.0326 \u203032,60 K 145 \u2030#,@@@ 15.43 \u203015\u00a0400 K 146 \u2030#,##4.1 16.55 \u203016\u00a0551,7 K 147 // JDK gives \u2030162,55E3 148 \u2030##0.00E0 162.55 \u2030163E3 K 149 150 test padding 151 set locale fr_FR 152 begin 153 pattern format output breaks 154 // JDK does not seem to support padding 155 $**####,##0 1234 $***1\u00a0234 K 156 *x$####,##0 1234 xxx$1\u00a0234 K 157 ####,##0*x$ 1234 1\u00a0234xxx$ K 158 ####,##0$*x 1234 1\u00a0234$xxx K 159 // JDK doesn't seem to handle suffixes correctly dropping the 'nx' entirely 160 ####,##0$*x;ne#n -1234 ne1\u00a0234nx K 161 ####,##0$*x;n#'*' -1234 n1\u00a0234*xx K 162 *y%4.2###### 4.33 yyyy%432,6 K 163 // In J ICU adds padding as if 'EUR' is only 2 chars (2 * 0xa4) 164 \u00a4\u00a4 **####0.00 433.0 EUR *433,00 JK 165 // In J ICU adds padding as if 'EUR' is only 2 chars (2 * 0xa4) 166 \u00a4\u00a4 **#######0 433.0 EUR *433,00 JK 167 168 test padding and currencies 169 begin 170 locale currency pattern format output breaks 171 // In J, JPY is considered 2 char (2 * 0xa4) even though padding is done 172 // after prefix. In C this test works. 173 fr JPY \u00a4\u00a4 **#######0 433.22 JPY ****433 JK 174 // JDK doesn't correct rounding for currency, shows USD (433 175 en USD \u00a4\u00a4 **#######0;\u00a4\u00a4 (#) -433.22 USD (433.22) K 176 177 test currencies 178 set locale fr 179 set format 1234.567 180 begin 181 pattern currency output breaks 182 // JDK gives shows EUR instead of the euro symbol in this case 183 #,##0.00 \u00a4 EUR 1\u00a0234,57 \u20ac K 184 // JDK gives 1\u00A0234,57. JDK doesn't seem to correct rounding 185 // based on currency. 186 #,##0.00 \u00a4 JPY 1\u00a0235 JPY K 187 188 test prefixes and suffixes 189 set locale en 190 set pattern 0.00+;(#) 191 begin 192 format output breaks 193 7 7.00+ 194 // JDK does not support negative suffixes 195 -3.5 (3.50) K 196 197 test minimum grouping digits 198 set locale en 199 set pattern #,##0 200 set minGroupingDigits 2 201 begin 202 format output breaks 203 // min grouping digits not supported in any existing implementation 204 // but could be easily added to the new DecimalFormat C code. 205 1000 1000 JK 206 10000 10,000 207 100000 100,000 208 1000000 1,000,000 209 210 test min max fraction digits 211 set locale en 212 set pattern #,##0.### 213 set format 1234.567 214 begin 215 minFractionDigits maxFractionDigits output 216 0 0 1,235 217 0 2 1,234.57 218 4 5 1,234.5670 219 220 test min max integer digits 221 set locale en 222 set pattern #,##0.### 223 set format 1234.567 224 begin 225 minIntegerDigits maxIntegerDigits output 226 0 0 .567 227 0 3 234.567 228 5 5 01,234.567 229 230 test min max fraction digits scientific 231 set locale en 232 set pattern #E0 233 set format 299792458.0 234 begin 235 minIntegerDigits maxIntegerDigits minFractionDigits maxFractionDigits output breaks 236 // JDK gives .3E9 instead of unlimited precision. 237 0 1 0 0 2.99792458E8 K 238 1 1 0 0 3E8 239 // JDK gives E0 instead of allowing for unlimited precision 240 0 0 0 0 2.99792458E8 K 241 // JDK gives .299792E9 242 0 1 0 5 2.9979E8 K 243 // JDK gives 300E6 244 0 3 0 0 299.792458E6 K 245 // JDK gives 299.8E6 (maybe maxInt + maxFrac instead of minInt + maxFrac)? 246 0 3 0 1 300E6 K 247 // JDK gives 299.7925E6 248 2 3 0 4 299.792E6 K 249 // JDK gives 299.79246E6 250 2 3 0 5 299.7925E6 K 251 3 3 0 5 299.79246E6 252 3 3 0 4 299.7925E6 253 2 2 0 3 29.979E7 254 4 4 0 0 2998E5 255 0 0 1 5 .29979E9 256 // JDK gives E0 257 0 0 1 0 2.99792458E8 K 258 // JDK gives .2998E9 259 0 0 0 4 2.998E8 K 260 // JDK uses 8 + 6 for significant digits instead of 2 + 6 261 2 8 1 6 2.9979246E8 K 262 // Treat max int digits > 8 as being the same as min int digits. 263 // This behavior is not spelled out in the specification. 264 // JDK fails here because it tries to use 9 + 6 = 15 sig digits. 265 2 9 1 6 29.979246E7 K 266 267 test significant digits scientific 268 set locale en 269 set pattern #E0 270 set format 290000000.0 271 begin 272 minSigDigits maxSigDigits output breaks 273 0 1 3E8 K 274 0 2 2.9E8 K 275 0 3 2.9E8 K 276 1 1 3E8 K 277 1 2 2.9E8 K 278 1 3 2.9E8 K 279 2 2 2.9E8 K 280 2 3 2.9E8 K 281 3 3 2.90E8 K 282 3 4 2.90E8 K 283 284 test min max fraction digits scientific 2 285 set locale en 286 set pattern #E0 287 set format 29979245.0 288 begin 289 minIntegerDigits maxIntegerDigits minFractionDigits maxFractionDigits output breaks 290 // JDK gives E0 291 0 0 0 0 2.9979245E7 K 292 // JDK gives .3E8 293 0 1 0 0 2.9979245E7 K 294 // JDK gives 2998E4. 295 0 4 0 0 2997.9245E4 K 296 297 test ticket 11524 298 set locale en 299 set pattern #,##0.### 300 begin 301 format maxIntegerDigits output 302 123 1 3 303 123 -2147483648 0 304 12345 1 5 305 12345 -2147483648 0 306 5.3 1 5.3 307 5.3 -2147483648 .3 308 309 test patterns with zero 310 set locale en 311 set format 0 312 begin 313 pattern output 314 #.# 0 315 #. 0. 316 .# .0 317 # 0 318 00.000E00 00.000E00 319 0.####E0 0E0 320 ##0.######E000 0E000 321 322 test significant digits manually set 323 set locale en_US 324 set pattern 0.0 325 set useSigDigits 1 326 set minSigDigits 3 327 set maxSigDigits 5 328 begin 329 format output breaks 330 0.0012 0.00120 K 331 0.00123 0.00123 K 332 0.001234 0.001234 K 333 0.0012345 0.0012345 K 334 0.00123456 0.0012346 K 335 -43 -43.0 K 336 -43.7 -43.7 K 337 -43.76 -43.76 K 338 -43.762 -43.762 K 339 -43.7626 -43.763 K 340 341 test grouping used setters 342 set locale en_US 343 set pattern #,##0 344 set format 12345 345 begin 346 output useGrouping 347 12,345 348 12,345 1 349 12345 0 350 351 test grouping setters 352 set locale en_US 353 set pattern 0 354 set format 123456789 355 set useGrouping 1 356 begin 357 output grouping breaks grouping2 minGroupingDigits 358 1,2345,6789 4 359 1,23,45,6789 4 K 2 360 1,23,45,6789 4 K 2 2 361 123,456789 6 K 6 3 362 123456789 6 JK 6 4 363 364 test multiplier setters 365 set locale en_US 366 begin 367 format multiplier output breaks 368 23 -12 -276 369 23 -1 -23 370 // ICU4J and JDK throw exception on zero multiplier. ICU4C does not. 371 23 0 23 JK 372 23 1 23 373 23 12 276 374 -23 12 -276 375 -23 -12 276 376 377 test rounding setters 378 set locale en_US 379 set pattern 0.0# 380 set roundingIncrement 0.25 381 begin 382 format output breaks 383 -0.35 -0.25 K 384 0.35 0.25 K 385 0.39 0.5 K 386 0.62 0.5 K 387 0.63 0.75 K 388 389 test padding setters 390 set locale en_US 391 set pattern bill0 392 set format 1357 393 begin 394 padCharacter formatWidth output breaks 395 * 8 bill1357 K 396 * 9 *bill1357 K 397 ^ 10 ^^bill1357 K 398 399 test use scientific setter 400 set locale en_US 401 set pattern 0.00 402 set format 186283 403 begin 404 output breaks useScientific 405 186283.00 406 1.86E5 K 1 407 186283.00 K 0 408 409 test rounding mode setters 410 set locale en_US 411 set pattern 0.# 412 set roundingIncrement 0.5 413 begin 414 format roundingMode output breaks 415 1.24 halfUp 1 K 416 1.25 halfUp 1.5 K 417 1.25 halfDown 1 K 418 1.26 halfDown 1.5 K 419 1.25 halfEven 1 K 420 -1.01 up -1.5 K 421 -1.49 down -1 K 422 1.01 up 1.5 K 423 1.49 down 1 K 424 -1.01 ceiling -1 K 425 -1.49 floor -1.5 K 426 427 test currency usage setters 428 // TODO: Find a country and currency where standard and cash differ 429 set locale CH 430 set currency CHF 431 set pattern \u00a4\u00a4 0 432 begin 433 format currencyUsage output breaks 434 0.37 standard CHF 0.37 K 435 // TODO: Get the rounding data into ICU4C and ICU4J 436 0.37 cash CHF 0.35 CJK 437 438 test exponent parameter setters 439 set locale en_US 440 set pattern 0.##E0 441 set format 299792458 442 begin 443 decimalSeparatorAlwaysShown exponentSignAlwaysShown minimumExponentDigits output breaks 444 0 0 2 3E08 K 445 0 1 3 3E+008 K 446 // ICU DecimalFormat J does not honor decimalSeparatorAlwaysShown 447 // for scientific notation. But JDK DecimalFormat does honor 448 // decimalSeparatorAlwaysShown K=JDK; C=ICU4C; J=ICU4J 449 // See ticket 11621 450 1 0 2 3.E08 JK 451 1 1 3 3.E+008 JK 452 1 0 1 3.E8 J 453 0 0 1 3E8 454 455 test exponent decimalSeparatorAlwaysShown default 456 set locale en_US 457 set pattern 0.##E0 458 begin 459 format output breaks decimalSeparatorAlwaysShown 460 // decimalSeparatorAlwaysShown off by default 461 299792458 3E8 462 299000000 2.99E8 463 299792458 3.E8 J 1 464 465 test pad position setters 466 set locale en_US 467 set pattern **[#####0.##];((#)) 468 begin 469 format padPosition output breaks 470 12.34 beforePrefix ****[12.34] K 471 12.34 afterPrefix [****12.34] K 472 12.34 beforeSuffix [12.34****] K 473 12.34 afterSuffix [12.34]**** K 474 -12.34 beforePrefix **((12.34)) K 475 -12.34 afterPrefix ((**12.34)) K 476 -12.34 beforeSuffix ((12.34**)) K 477 -12.34 afterSuffix ((12.34))** K 478 479 test affix setters 480 set locale fr_FR 481 set currency EUR 482 set pattern 0.00 483 begin 484 format positivePrefix positiveSuffix negativePrefix negativeSuffix output 485 12.34 % %12,34 486 12.34 \u00a4\u00a4 12,34\u00a4\u00a4 487 12.34 - + 12,34 488 -12.34 - + -12,34+ 489 -12.34 \u00a4 \u00a412,34 490 12.34 \u00a4 12,34 491 -12.34 % 12,34% 492 12.34 % 12,34 493 494 test more affix setters 495 set locale fr_FR 496 set pattern %0.00 497 begin 498 format positivePrefix negativePrefix output 499 0.648 booya cooya booya64,80 500 501 test nan and infinity 502 set locale en_US 503 set pattern [0.00];(#) 504 begin 505 format output breaks 506 Inf [\u221e] K 507 -Inf (\u221e) K 508 NaN NaN K 509 510 test nan and infinity with multiplication 511 set locale en 512 set multiplier 100 513 begin 514 format output breaks 515 Inf \u221e 516 -Inf -\u221e 517 NaN NaN K 518 519 test nan and infinity with padding 520 set locale en_US 521 set pattern $$$0.00$ 522 set formatWidth 7 523 begin 524 format padPosition output breaks 525 Inf beforePrefix $$$\u221e$ K 526 Inf afterPrefix $$$ \u221e$ K 527 Inf beforeSuffix $$$\u221e $ K 528 Inf afterSuffix $$$\u221e$ K 529 NaN beforePrefix NaN K 530 NaN afterPrefix NaN K 531 NaN beforeSuffix NaN K 532 NaN afterSuffix NaN K 533 534 test apply localized patterns 535 begin 536 locale localizedPattern format output breaks 537 en 0% 0.4376 44% 538 // This next test breaks JDK. JDK doesn't multiply by 100. 539 fa \u06f0\u066a 0.4376 \u06f4\u06f4\u066a K 540 541 test toPattern 542 set locale en 543 begin 544 pattern toPattern breaks 545 // JDK doesn't support any patterns with padding or both negative prefix and suffix 546 // Breaks ICU4J See ticket 11671 547 **0,000 **0,000 JK 548 **##0,000 **##0,000 K 549 **###0,000 **###0,000 K 550 **####0,000 **#,##0,000 K 551 ###,000. #,000. 552 0,000 #0,000 553 .00 #.00 554 000 #000 555 000,000 #,000,000 556 pp#,000 pp#,000 557 00.## #00.## 558 #,#00.025 #,#00.025 559 // No secondary grouping in JDK 560 #,##,###.02500 #,##,###.02500 K 561 pp#,000;(#) pp#,000;(#,000) K 562 **####,##,##0.0##;(#) **#,##,##,##0.0##;**(##,##,##0.0##) K 563 // No significant digits in JDK 564 @@### @@### K 565 @,@#,### @,@#,### K 566 0.00E0 0.00E0 567 @@@##E0 @@@##E0 K 568 ###0.00#E0 ###0.00#E0 569 ##00.00#E0 ##00.00#E0 570 0.00E+00 0.00E+00 K 571 000.00E00 000.00E00 572 ###0.00#E00 ###0.00#E00 573 574 test parse 575 set locale en 576 set pattern +#,##0.0###;(#) 577 begin 578 parse output breaks 579 +5,347.25 5347.25 580 +5,347,.25 5347.25 581 +5,347, 5347 582 +5347,,, 5347 583 +5347,,,d8 5347 584 (5,347.25) -5347.25 585 // J requires prefix and suffix for lenient parsing, but C doesn't 586 5,347.25 5347.25 JK 587 (5,347.25 -5347.25 J 588 -5,347.25 fail 589 +3.52E4 35200 590 (34.8E-3) -0.0348 591 // JDK stops parsing at the spaces. JDK doesn't see space as a grouping separator 592 (34 25E-1) -342.5 K 593 (34,,25E-1) -342.5 594 // J doesn't allow trailing separators before E but C does 595 (34,,25,E-1) -342.5 J 596 (34 25 E-1) -342.5 JK 597 (34,,25 E-1) -3425 J 598 // Spaces are not allowed after exponent symbol 599 // C parses up to the E but J bails 600 (34 25E -1) -3425 JK 601 +3.52EE4 3.52 602 +1,234,567.8901 1234567.8901 603 +1,23,4567.8901 1234567.8901 604 +1,23,4567.89,01 1234567.89 605 +1,23,456.78.9 123456.78 606 +12.34,56 12.34 607 +79,,20,3 79203 608 +79 20 3 79203 K 609 // Parsing stops at comma as it is different from other separators 610 +79 20,3 7920 K 611 +79,,20 3 7920 612 + 79 79 K 613 +,79,,20,3 79203 614 +7920d3 7920 615 // Whitespace immediately after prefix doesn't count as digit separator 616 // in C but is does in J 617 + ,79,,20,3 79203 JK 618 ( 19 45) -1945 K 619 // C allows trailing separators when there is a prefix and suffix. 620 // J allows trailing separators only when there is just a prefix. 621 // In this case, J just bails 622 ( 19 45 ) -1945 JK 623 (,,19,45) -1945 624 // C parses to the space, but J bails 625 (,,19 45) -19 J 626 // J bails b/c comma different separator than space. C doesn't treat leading spaces 627 // as a separator. 628 ( 19,45) -1945 JK 629 // J bails. Doesn't allow trailing separators when there is prefix and suffix. 630 (,,19,45,) -1945 J 631 // J bails on next 4 because J doesn't allow letters inside prefix and suffix. 632 // C will parse up to the letter. 633 (,,19,45,d1) -1945 J 634 (,,19,45d1) -1945 J 635 ( 19 45 d1) -1945 JK 636 ( 19 45d1) -1945 JK 637 // J does allow trailing separator before a decimal point 638 (19,45,.25) -1945.25 639 // 2nd decimal points are ignored 640 +4.12.926 4.12 641 642 test parse suffix 643 set locale en 644 set pattern #,##0.0###+;#- 645 begin 646 parse output breaks 647 // C sees this as -3426, don't understand why 648 3426 -3426 JK 649 3426+ 3426 650 // J bails, but JDK will parse up to the space and get 34. 651 // C sees -34 652 34 d1+ -34 JK 653 // JDK sees this as -1234 for some reason 654 // J bails b/c of trailing separators 655 // C parses until trailing separators, but sees -1234 656 1,234,,,+ -1234 JK 657 1,234- -1234 658 // J bails because of trailing separators 659 1,234,- -1234 J 660 // J bails here too 661 1234 - -1234 J 662 663 664 665 test parse strict 666 set locale en 667 set pattern +#,##0.0###;(#) 668 set lenient 0 669 begin 670 parse output breaks 671 +123d5 123 672 +5347.25 5347.25 673 // separators in wrong place cause failure, no separators ok. 674 +5,347.25 5347.25 675 (5347.25) -5347.25 676 (5,347.25) -5347.25 677 // JDK does allow separators in the wrong place and parses as -5347.25 678 (53,47.25) fail K 679 // strict requires prefix or suffix 680 5,347.25 fail 681 +3.52E4 35200 682 (34.8E-3) -0.0348 683 (3425E-1) -342.5 684 // Strict doesn't allow separators in sci notation. 685 (3,425) -3425 686 // JDK allows separators in sci notation and parses as -342.5 687 (3,425E-1) fail K 688 // Both prefix and suffix needed for strict. 689 // JDK accepts this and parses as -342.5 690 (3425E-1 fail K 691 +3.52EE4 3.52 692 +1,234,567.8901 1234567.8901 693 // With strict digit separators don't have to be the right type 694 // JDK doesn't acknowledge space as a separator 695 +1 234 567.8901 1234567.8901 K 696 // In general the grouping separators have to match their expected 697 // location exactly. The only exception is when string being parsed 698 // have no separators at all. 699 +1,234,567.8901 1234567.8901 700 // JDK doesn't require separators to be in the right place 701 +1,23,4567.8901 fail K 702 +1234,567.8901 fail K 703 +1,234567.8901 fail K 704 +1234567.8901 1234567.8901 705 // Comma after decimal means parse to a comma 706 +123,456.78,9 123456.78 707 // A decimal after a decimal means bail 708 // JDK parses as 123456.78 709 +123,456.78.9 fail K 710 +79 79 711 +79 79 712 + 79 fail 713 // JDK parses as -1945 714 (1,945d1) fail K 715 716 test parse integer only 717 set locale en 718 set pattern 0.00 719 set parseIntegerOnly 1 720 begin 721 parse output breaks 722 35 35 723 +35 fail 724 -35 -35 725 2.63 2 726 -39.99 -39 727 728 test parse no exponent flag 729 set pattern 0 730 set locale en 731 begin 732 parseNoExponent parse output breaks 733 // JDK doesn't allow lowercase exponent but ICU4J and ICU4C do. 734 0 5e2 500 K 735 0 5.3E2 530 736 // See ticket 11725 737 1 5e2 5 J 738 1 5.3E2 5.3 JK 739 740 test parse currency fail 741 set pattern 0 742 set locale en 743 begin 744 parse output outputCurrency breaks 745 // See ticket 11735 746 53.45 fail USD J 747 748 test parse strange prefix 749 set locale en 750 set positivePrefix dd 751 set negativePrefix ddd 752 begin 753 parse output 754 dd4582 4582 755 ddd4582 -4582 756 757 test parse strange suffix 758 set locale en 759 set positiveSuffix dd 760 set negativePrefix 761 set negativeSuffix ddd 762 begin 763 parse output 764 4582dd 4582 765 4582ddd -4582 766 767 test really strange suffix 768 set locale en 769 set positiveSuffix 9K 770 set negativePrefix 771 set negativeSuffix 9N 772 begin 773 parse output breaks 774 // C consumes the '9' as a digit and assumes number is negative 775 // J and JDK bail 776 // 6549K 654 CJK 777 // C consumes the '9' as a digit and assumes number is negative 778 // J and JDK bail 779 // 6549N -654 CJK 780 781 test really strange prefix 782 set locale en 783 set positivePrefix 82 784 set negativePrefix 28 785 begin 786 parse output 787 8245 45 788 2845 -45 789 790 test select 791 set locale sr 792 begin 793 format pattern plural 794 Inf 0 other 795 -Inf 0 other 796 NaN 0 other 797 Inf 0.0 other 798 -Inf 0.0 other 799 NaN 0.0 other 800 1 0 one 801 1 0.0 other 802 2 0 few 803 2 0.0 other 804 2 0E0 other 805 5.1 0.0 one 806 5.09 0.0 one 807 808 test parse currency ISO 809 set pattern 0.00 \u00a4\u00a4;(#) \u00a4\u00a4 810 set locale en_US 811 begin 812 parse output outputCurrency breaks 813 $53.45 53.45 USD 814 53.45 USD 53.45 USD 815 USD 53.45 53.45 USD J 816 53.45USD fail USD 817 USD53.45 53.45 USD 818 (7.92) USD -7.92 USD 819 (7.92) EUR -7.92 EUR 820 (7.926) USD -7.926 USD 821 (7.926 USD) fail USD 822 (USD 7.926) fail USD 823 USD (7.926) fail USD 824 USD (7.92) fail USD 825 (7.92)USD fail USD 826 USD(7.92) fail USD 827 (8) USD -8 USD 828 -8 USD fail USD 829 67 USD 67 USD 830 53.45$ fail USD 831 US Dollars 53.45 53.45 USD J 832 53.45 US Dollars 53.45 USD 833 US Dollar 53.45 53.45 USD J 834 53.45 US Dollar 53.45 USD 835 US Dollars53.45 53.45 USD 836 53.45US Dollars fail USD 837 US Dollar53.45 53.45 USD 838 US Dollat53.45 fail USD 839 53.45US Dollar fail USD 840 US Dollars (53.45) fail USD 841 (53.45) US Dollars -53.45 USD 842 US Dollar (53.45) fail USD 843 (53.45) US Dollar -53.45 USD 844 US Dollars(53.45) fail USD 845 (53.45)US Dollars fail USD 846 US Dollar(53.45) fail USD 847 US Dollat(53.45) fail USD 848 (53.45)US Dollar fail USD 849 850 851 test parse currency ISO negative 852 set pattern 0.00 \u00a4\u00a4;-# \u00a4\u00a4 853 set locale en_US 854 begin 855 parse output outputCurrency breaks 856 $53.45 53.45 USD 857 53.45 USD 53.45 USD 858 USD 53.45 53.45 USD J 859 53.45USD fail USD 860 USD53.45 53.45 USD 861 -7.92 USD -7.92 USD 862 -7.92 EUR -7.92 EUR 863 -7.926 USD -7.926 USD 864 USD -7.926 fail USD 865 -7.92USD fail USD 866 USD-7.92 fail USD 867 -8 USD -8 USD 868 67 USD 67 USD 869 53.45$ fail USD 870 US Dollars 53.45 53.45 USD J 871 53.45 US Dollars 53.45 USD 872 US Dollar 53.45 53.45 USD J 873 53.45 US Dollar 53.45 USD 874 US Dollars53.45 53.45 USD 875 53.45US Dollars fail USD 876 US Dollar53.45 53.45 USD 877 US Dollat53.45 fail USD 878 53.45US Dollar fail USD 879 880 881 test parse currency long 882 set pattern 0.00 \u00a4\u00a4\u00a4;(#) \u00a4\u00a4\u00a4 883 set locale en_US 884 begin 885 parse output outputCurrency breaks 886 $53.45 53.45 USD 887 53.45 USD 53.45 USD 888 USD 53.45 53.45 USD J 889 // See ticket 11735 890 53.45USD fail USD J 891 USD53.45 53.45 USD 892 (7.92) USD -7.92 USD 893 (7.926) USD -7.926 USD 894 (7.926 USD) fail USD 895 (USD 7.926) fail USD 896 USD (7.926) fail USD 897 USD (7.92) fail USD 898 (7.92)USD fail USD 899 USD(7.92) fail USD 900 (8) USD -8 USD 901 // See ticket 11735 902 -8 USD fail USD J 903 67 USD 67 USD 904 // See ticket 11735 905 53.45$ fail USD J 906 US Dollars 53.45 53.45 USD J 907 53.45 US Dollars 53.45 USD 908 US Dollar 53.45 53.45 USD J 909 53.45 US Dollar 53.45 USD 910 US Dollars53.45 53.45 USD 911 // See ticket 11735 912 53.45US Dollars fail USD J 913 US Dollar53.45 53.45 USD 914 US Dollat53.45 fail USD 915 // See ticket 11735 916 53.45US Dollar fail USD J 917 918 919 test parse currency short 920 set pattern 0.00 \u00a4;(#) \u00a4 921 set locale en_US 922 begin 923 parse output outputCurrency breaks 924 $53.45 53.45 USD 925 53.45 USD 53.45 USD 926 USD 53.45 53.45 USD J 927 53.45USD fail USD 928 USD53.45 53.45 USD 929 (7.92) USD -7.92 USD 930 (7.926) USD -7.926 USD 931 (7.926 USD) fail USD 932 (USD 7.926) fail USD 933 USD (7.926) fail USD 934 USD (7.92) fail USD 935 (7.92)USD fail USD 936 USD(7.92) fail USD 937 (8) USD -8 USD 938 -8 USD fail USD 939 67 USD 67 USD 940 53.45$ fail USD 941 US Dollars 53.45 53.45 USD J 942 53.45 US Dollars 53.45 USD 943 US Dollar 53.45 53.45 USD J 944 53.45 US Dollar 53.45 USD 945 US Dollars53.45 53.45 USD 946 53.45US Dollars fail USD 947 US Dollar53.45 53.45 USD 948 US Dollat53.45 fail USD 949 53.45US Dollar fail USD 950 951 952 test parse currency short prefix 953 set pattern \u00a40.00;(\u00a4#) 954 set locale en_US 955 begin 956 parse output outputCurrency breaks 957 $53.45 53.45 USD 958 53.45 USD fail USD 959 USD 53.45 53.45 USD J 960 53.45USD fail USD 961 USD53.45 53.45 USD 962 (7.92) USD fail USD 963 (7.926) USD fail USD 964 (7.926 USD) fail USD 965 (USD 7.926) -7.926 USD J 966 USD (7.926) fail USD 967 USD (7.92) fail USD 968 (7.92)USD fail USD 969 USD(7.92) fail USD 970 (8) USD fail USD 971 -8 USD fail USD 972 67 USD fail USD 973 53.45$ fail USD 974 US Dollars 53.45 53.45 USD J 975 53.45 US Dollars 53.45 USD 976 US Dollar 53.45 53.45 USD J 977 53.45 US Dollar 53.45 USD 978 US Dollars53.45 53.45 USD 979 53.45US Dollars fail USD 980 US Dollar53.45 53.45 USD 981 53.45US Dollar fail USD 982 983 test format foreign currency 984 set locale fa_IR 985 begin 986 pattern format output breaks 987 \u00a4\u00a4\u00a4 0.00;\u00a4\u00a4\u00a4 # 1235 \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 K 988 \u00a4\u00a4 0.00;\u00a4\u00a4 -# 1235 IRR \u06F1\u06F2\u06F3\u06F5 K 989 \u00a4 0.00;\u00a4 -# 1235 \u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 K 990 991 test parse foreign currency symbol 992 set pattern \u00a4 0.00;\u00a4 -# 993 set locale fa_IR 994 begin 995 parse output outputCurrency 996 \u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 1235 IRR 997 IRR \u06F1\u06F2\u06F3\u06F5 1235 IRR 998 \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR 999 IRR 1235 1235 IRR 1000 \u0631\u06cc\u0627\u0644 1235 1235 IRR 1001 \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR 1002 1003 test parse foreign currency ISO 1004 set pattern \u00a4\u00a4 0.00;\u00a4\u00a4 -# 1005 set locale fa_IR 1006 begin 1007 parse output outputCurrency 1008 \u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 1235 IRR 1009 IRR \u06F1\u06F2\u06F3\u06F5 1235 IRR 1010 \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR 1011 IRR 1235 1235 IRR 1012 \u0631\u06cc\u0627\u0644 1235 1235 IRR 1013 \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR 1014 1015 test parse foreign currency full 1016 set pattern \u00a4\u00a4\u00a4 0.00;\u00a4\u00a4\u00a4 -# 1017 set locale fa_IR 1018 begin 1019 parse output outputCurrency 1020 \u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 1235 IRR 1021 IRR \u06F1\u06F2\u06F3\u06F5 1235 IRR 1022 \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR 1023 IRR 1235 1235 IRR 1024 \u0631\u06cc\u0627\u0644 1235 1235 IRR 1025 \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR 1026 1027 test parse currency with foreign symbols symbol english 1028 set pattern \u00a4 0.00;\u00a4 (#) 1029 set locale en_US 1030 begin 1031 parse output outputCurrency 1032 EUR 7.82 7.82 EUR 1033 \u20ac 7.82 7.82 EUR 1034 Euro 7.82 7.82 EUR 1035 Euros 7.82 7.82 EUR 1036 1037 test parse currency with foreign symbols ISO english 1038 set pattern \u00a4\u00a4 0.00;\u00a4\u00a4 (#) 1039 set locale en_US 1040 begin 1041 parse output outputCurrency 1042 EUR 7.82 7.82 EUR 1043 \u20ac 7.82 7.82 EUR 1044 Euro 7.82 7.82 EUR 1045 Euros 7.82 7.82 EUR 1046 1047 test parse currency with foreign symbols full english 1048 set pattern \u00a4\u00a4\u00a4 0.00;\u00a4\u00a4\u00a4 (#) 1049 set locale en_US 1050 begin 1051 parse output outputCurrency 1052 EUR 7.82 7.82 EUR 1053 \u20ac 7.82 7.82 EUR 1054 Euro 7.82 7.82 EUR 1055 Euros 7.82 7.82 EUR 1056 1057 test parse currency ISO strict 1058 set pattern 0.00 \u00a4\u00a4;(#) \u00a4\u00a4 1059 set locale en_US 1060 set lenient 0 1061 begin 1062 parse output outputCurrency breaks 1063 $53.45 53.45 USD 1064 53.45 USD 53.45 USD 1065 USD 53.45 fail USD 1066 53.45USD fail USD 1067 USD53.45 53.45 USD 1068 (7.92) USD -7.92 USD 1069 (7.92) EUR -7.92 EUR 1070 (7.926) USD -7.926 USD 1071 (7.926 USD) fail USD 1072 (USD 7.926) fail USD 1073 USD (7.926) fail USD 1074 USD (7.92) fail USD 1075 (7.92)USD fail USD 1076 USD(7.92) fail USD 1077 (8) USD -8 USD 1078 -8 USD fail USD 1079 67 USD 67 USD 1080 53.45$ fail USD 1081 US Dollars 53.45 fail USD 1082 53.45 US Dollars 53.45 USD 1083 US Dollar 53.45 fail USD 1084 53.45 US Dollar 53.45 USD 1085 US Dollars53.45 53.45 USD 1086 53.45US Dollars fail USD 1087 US Dollar53.45 53.45 USD 1088 US Dollat53.45 fail USD 1089 53.45US Dollar fail USD 1090 US Dollars (53.45) fail USD 1091 (53.45) US Dollars -53.45 USD 1092 US Dollar (53.45) fail USD 1093 (53.45) US Dollar -53.45 USD 1094 US Dollars(53.45) fail USD 1095 (53.45)US Dollars fail USD 1096 US Dollar(53.45) fail USD 1097 US Dollat(53.45) fail USD 1098 (53.45)US Dollar fail USD 1099 1100 test ticket 10436 1101 set locale en 1102 set roundingMode ceiling 1103 set minFractionDigits 0 1104 set maxFractionDigits 0 1105 begin 1106 format output breaks 1107 -0.99 -0 JK 1108 1109