LEFT | RIGHT |
(no file at all) | |
1 // Copyright (C) 2016 and later: Unicode, Inc. and others. | 1 // Copyright (C) 2016 and later: Unicode, Inc. and others. |
2 // License & terms of use: http://www.unicode.org/copyright.html | 2 // License & terms of use: http://www.unicode.org/copyright.html |
3 // Copyright (C) 2015-2016, International Business Machines | 3 // Copyright (C) 2015-2016, International Business Machines |
4 // Corporation and others. All Rights Reserved. | 4 // Corporation and others. All Rights Reserved. |
5 // | 5 // |
6 // This file is divided into test suites separated by whitespace. Each test | 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 | 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 | 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 | 9 // per-test field names, and finally the test specific field values, 1 test |
10 // per line. | 10 // per line. |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 12345 0 | 434 12345 0 |
435 | 435 |
436 test grouping used setters in parsing | 436 test grouping used setters in parsing |
437 set pattern #,##0 | 437 set pattern #,##0 |
438 begin | 438 begin |
439 locale useGrouping parse output breaks | 439 locale useGrouping parse output breaks |
440 en_US 1 123,456 123456 | 440 en_US 1 123,456 123456 |
441 en_US 0 123,456 123 | 441 en_US 0 123,456 123 |
442 en_US 1 123.456 123.456 | 442 en_US 1 123.456 123.456 |
443 en_US 0 123.456 123.456 | 443 en_US 0 123.456 123.456 |
444 fr_FR» 1» 123,456»123.456 | 444 it_IT» 1» 123,456»123.456 |
445 fr_FR» 0» 123,456»123.456 | 445 it_IT» 0» 123,456»123.456 |
446 // JDK returns 123 here; not sure why. | 446 // JDK returns 123 here; not sure why. |
447 fr_FR» 1» 123.456»123456» K | 447 it_IT» 1» 123.456»123456» K |
448 fr_FR» 0» 123.456»123 | 448 it_IT» 0» 123.456»123 |
449 | 449 |
450 test no grouping in pattern with parsing | 450 test no grouping in pattern with parsing |
451 set pattern 0 | 451 set pattern 0 |
452 begin | 452 begin |
453 locale parse output breaks | 453 locale parse output breaks |
454 en_US 123,456 123 | 454 en_US 123,456 123 |
455 en_US 123.456 123.456 | 455 en_US 123.456 123.456 |
456 fr_FR 123,456 123.456 | 456 fr_FR 123,456 123.456 |
457 fr_FR 123.456 123 | 457 fr_FR 123.456 123 |
458 | 458 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 parse output breaks | 824 parse output breaks |
825 +123d5 123 | 825 +123d5 123 |
826 +5347.25 5347.25 | 826 +5347.25 5347.25 |
827 // separators in wrong place cause failure, no separators ok. | 827 // separators in wrong place cause failure, no separators ok. |
828 +65,347.25 65347.25 | 828 +65,347.25 65347.25 |
829 (65347.25) -65347.25 | 829 (65347.25) -65347.25 |
830 (65,347.25) -65347.25 | 830 (65,347.25) -65347.25 |
831 // JDK does allow separators in the wrong place and parses as -5347.25 | 831 // JDK does allow separators in the wrong place and parses as -5347.25 |
832 (53,47.25) fail K | 832 (53,47.25) fail K |
833 // strict requires prefix or suffix, except in C | 833 // strict requires prefix or suffix, except in C |
834 65,347.25» fail»··· | 834 65,347.25» fail» P |
835 +3.52E4 35200 | 835 +3.52E4 35200 |
836 (34.8E-3) -0.0348 | 836 (34.8E-3) -0.0348 |
837 (3425E-1) -342.5 | 837 (3425E-1) -342.5 |
838 // Strict doesn't allow separators in sci notation. | 838 // Strict doesn't allow separators in sci notation. |
839 (63,425) -63425 | 839 (63,425) -63425 |
840 // JDK and S allow separators in sci notation and parses as -342.5 | 840 // J does not allow grouping separators in scientific notation. |
841 // C passes | 841 (63,425E-1)» -6342.5»J |
842 (63,425E-1)» fail» CKS | |
843 // Both prefix and suffix needed for strict. | 842 // Both prefix and suffix needed for strict. |
844 // JDK accepts this and parses as -342.5 | 843 // JDK accepts this and parses as -342.5 |
845 (3425E-1 fail K | 844 (3425E-1 fail K |
846 +3.52EE4 3.52 | 845 +3.52EE4 3.52 |
847 +12,34,567.8901 1234567.8901 | 846 +12,34,567.8901 1234567.8901 |
848 // With strict digit separators don't have to be the right type | 847 // With strict digit separators don't have to be the right type |
849 // JDK doesn't acknowledge space as a separator | 848 // JDK doesn't acknowledge space as a separator |
850 +12 34 567.8901 1234567.8901 K | 849 +12 34 567.8901 1234567.8901 K |
851 // In general the grouping separators have to match their expected | 850 // In general the grouping separators have to match their expected |
852 // location exactly. The only exception is when string being parsed | 851 // location exactly. The only exception is when string being parsed |
853 // have no separators at all. | 852 // have no separators at all. |
854 +12,345.67 12345.67 | 853 +12,345.67 12345.67 |
855 // JDK doesn't require separators to be in the right place. | 854 // JDK doesn't require separators to be in the right place. |
856 +1,23,4567.8901»fail» K | 855 // P stops after reading an unexpected grouping separator instead of failing. |
857 +1,234,567.8901»fail» K | 856 +1,23,4567.8901»fail» KP |
858 +1234,567.8901» fail» K | 857 +1,234,567.8901»fail» KP |
859 +1,234567.8901» fail» K | 858 +1234,567.8901» fail» KP |
| 859 +1,234567.8901» fail» KP |
860 +1234567.8901 1234567.8901 | 860 +1234567.8901 1234567.8901 |
861 // Minimum grouping is not satisfied below, but that's ok | 861 // Minimum grouping is not satisfied below, but that's ok |
862 // because minimum grouping is optional. | 862 // because minimum grouping is optional. |
863 +1,234.5 1234.5 | 863 +1,234.5 1234.5 |
864 // Comma after decimal means parse to a comma | 864 // Comma after decimal means parse to a comma |
865 +1,23,456.78,9 123456.78 | 865 +1,23,456.78,9 123456.78 |
866 // C and J fail upon seeing the second decimal point | 866 // C and J fail upon seeing the second decimal point |
867 +1,23,456.78.9 123456.78 CJ | 867 +1,23,456.78.9 123456.78 CJ |
868 +79 79 | 868 +79 79 |
869 +79 79 | 869 +79 79 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 4582ddd -4582 | 947 4582ddd -4582 |
948 | 948 |
949 test really strange suffix | 949 test really strange suffix |
950 set locale en | 950 set locale en |
951 set positiveSuffix 9K | 951 set positiveSuffix 9K |
952 set negativePrefix· | 952 set negativePrefix· |
953 set negativeSuffix 9N | 953 set negativeSuffix 9N |
954 begin | 954 begin |
955 parse output breaks | 955 parse output breaks |
956 // S is the only implementation that passes these cases. | 956 // S is the only implementation that passes these cases. |
957 // C consumes the '9' as a digit and assumes number is negative | 957 // C and P consume the '9' as a digit and assumes number is negative |
958 // J and JDK bail | 958 // J and JDK bail |
959 6549K» 654» CJK | 959 6549K» 654» CJKP |
960 // C consumes the '9' as a digit and assumes number is negative | 960 // C and P consume the '9' as a digit and assumes number is negative |
961 // J and JDK bail | 961 // J and JDK bail |
962 6549N» -654» CJK | 962 6549N» -654» CJKP |
963 | 963 |
964 test really strange prefix | 964 test really strange prefix |
965 set locale en | 965 set locale en |
966 set positivePrefix 82 | 966 set positivePrefix 82 |
967 set negativePrefix 28 | 967 set negativePrefix 28 |
968 begin | 968 begin |
969 parse output | 969 parse output |
970 8245 45 | 970 8245 45 |
971 2845 -45 | 971 2845 -45 |
972 | 972 |
973 test parse pattern with quotes | 973 test parse pattern with quotes |
974 set locale en | 974 set locale en |
975 set pattern '-'#y | 975 set pattern '-'#y |
976 begin | 976 begin |
977 parse» output | 977 parse» output» breaks |
978 -45y 45 | 978 -45y 45 |
979 | 979 |
980 test parse with locale symbols | 980 test parse with locale symbols |
981 // The grouping separator in it_CH is an apostrophe | 981 // The grouping separator in it_CH is an apostrophe |
982 set locale it_CH | 982 set locale it_CH |
983 set pattern #,##0 | 983 set pattern #,##0 |
984 begin | 984 begin |
985 parse output breaks | 985 parse output breaks |
986 १३ 13······ | 986 १३ 13······ |
987 १३.३१ 13.31··· | 987 १३.३१ 13.31··· |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 begin | 1281 begin |
1282 parse output outputCurrency | 1282 parse output outputCurrency |
1283 EUR 7.82 7.82 EUR | 1283 EUR 7.82 7.82 EUR |
1284 \u20ac 7.82 7.82 EUR | 1284 \u20ac 7.82 7.82 EUR |
1285 Euro 7.82 7.82 EUR | 1285 Euro 7.82 7.82 EUR |
1286 Euros 7.82 7.82 EUR | 1286 Euros 7.82 7.82 EUR |
1287 | 1287 |
1288 test parse currency without currency mode | 1288 test parse currency without currency mode |
1289 // Should accept a symbol associated with the currency specified by the API, | 1289 // Should accept a symbol associated with the currency specified by the API, |
1290 // but should not traverse the full currency data. | 1290 // but should not traverse the full currency data. |
| 1291 // P always traverses full currency data. |
1291 set locale en_US | 1292 set locale en_US |
1292 set pattern \u00a4#,##0.00 | 1293 set pattern \u00a4#,##0.00 |
1293 begin | 1294 begin |
1294 parse currency output breaks | 1295 parse currency output breaks |
1295 $52.41 USD 52.41 | 1296 $52.41 USD 52.41 |
1296 USD52.41 USD 52.41 K | 1297 USD52.41 USD 52.41 K |
1297 \u20ac52.41» USD» fail | 1298 \u20ac52.41» USD» fail» P |
1298 EUR52.41» USD» fail | 1299 EUR52.41» USD» fail» P |
1299 $52.41» EUR» fail | 1300 $52.41» EUR» fail» P |
1300 USD52.41» EUR» fail | 1301 USD52.41» EUR» fail» P |
1301 \u20ac52.41 EUR 52.41 K | 1302 \u20ac52.41 EUR 52.41 K |
1302 EUR52.41 EUR 52.41 | 1303 EUR52.41 EUR 52.41 |
1303 | 1304 |
1304 test parse currency ISO strict | 1305 test parse currency ISO strict |
1305 set pattern 0.00 \u00a4\u00a4;(#) \u00a4\u00a4 | 1306 set pattern 0.00 \u00a4\u00a4;(#) \u00a4\u00a4 |
1306 set locale en_US | 1307 set locale en_US |
1307 set lenient 0 | 1308 set lenient 0 |
1308 begin | 1309 begin |
1309 parse output outputCurrency breaks | 1310 parse output outputCurrency breaks |
1310 $53.45 53.45 USD | 1311 $53.45 53.45 USD |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 begin | 1353 begin |
1353 format output breaks | 1354 format output breaks |
1354 -0.99 -0 JK | 1355 -0.99 -0 JK |
1355 | 1356 |
1356 test parse decimalPatternMatchRequired | 1357 test parse decimalPatternMatchRequired |
1357 set locale en | 1358 set locale en |
1358 set decimalPatternMatchRequired 1 | 1359 set decimalPatternMatchRequired 1 |
1359 begin | 1360 begin |
1360 pattern parse output breaks | 1361 pattern parse output breaks |
1361 // K doesn't support this feature. | 1362 // K doesn't support this feature. |
| 1363 // P stops parsing when it sees the decimal separator, but doesn't fail. |
1362 0 123 123 | 1364 0 123 123 |
1363 0» 123.» fail» CJK | 1365 0» 123.» fail» CJKP |
1364 0» 1.23» fail» CJK | 1366 0» 1.23» fail» CJKP |
1365 0 -513 -513 | 1367 0 -513 -513 |
1366 0» -513.» fail» CJK | 1368 0» -513.» fail» CJKP |
1367 0» -5.13» fail» CJK | 1369 0» -5.13» fail» CJKP |
1368 0.0 123 fail K | 1370 0.0 123 fail K |
1369 0.0 123. 123 C | 1371 0.0 123. 123 C |
1370 0.0 1.23 1.23 C | 1372 0.0 1.23 1.23 C |
1371 0.0 -513 fail K | 1373 0.0 -513 fail K |
1372 0.0 -513. -513 | 1374 0.0 -513. -513 |
1373 0.0 -5.13 -5.13 | 1375 0.0 -5.13 -5.13 |
1374 | 1376 |
1375 test parse minus sign | 1377 test parse minus sign |
1376 set locale en | 1378 set locale en |
1377 set pattern # | 1379 set pattern # |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 1E999999999999999 Inf K | 1418 1E999999999999999 Inf K |
1417 -1E999999999999999 -Inf K | 1419 -1E999999999999999 -Inf K |
1418 1E-99999999999999 0.0 | 1420 1E-99999999999999 0.0 |
1419 // Note: The test suite code doesn't properly check for 0.0 vs. -0.0 | 1421 // Note: The test suite code doesn't properly check for 0.0 vs. -0.0 |
1420 -1E-99999999999999 -0.0 | 1422 -1E-99999999999999 -0.0 |
1421 1E2147483648 Inf K | 1423 1E2147483648 Inf K |
1422 1E2147483647 Inf K | 1424 1E2147483647 Inf K |
1423 1E2147483646 1E2147483646 | 1425 1E2147483646 1E2147483646 |
1424 1E-2147483649 0 | 1426 1E-2147483649 0 |
1425 1E-2147483648 0 | 1427 1E-2147483648 0 |
1426 // S returns zero here | 1428 // S and P return zero here |
1427 1E-2147483647» 1E-2147483647» S | 1429 1E-2147483647» 1E-2147483647» SP |
1428 1E-2147483646 1E-2147483646 | 1430 1E-2147483646 1E-2147483646 |
1429 | 1431 |
1430 test format push limits | 1432 test format push limits |
1431 set locale en | 1433 set locale en |
1432 set minFractionDigits 2 | 1434 set minFractionDigits 2 |
1433 set roundingMode halfDown | 1435 set roundingMode halfDown |
1434 begin | 1436 begin |
1435 maxFractionDigits format output breaks | 1437 maxFractionDigits format output breaks |
1436 // C has trouble formatting too many digits (#11318) | 1438 // C has trouble formatting too many digits (#11318) |
1437 100 987654321987654321 987654321987654321.00 C | 1439 100 987654321987654321 987654321987654321.00 C |
1438 100 987654321.987654321 987654321.987654321 C | 1440 100 987654321.987654321 987654321.987654321 C |
1439 100 9999999999999.9950000000001 9999999999999.9950000000001 C | 1441 100 9999999999999.9950000000001 9999999999999.9950000000001 C |
1440 2 9999999999999.9950000000001 10000000000000.00 C | 1442 2 9999999999999.9950000000001 10000000000000.00 C |
1441 2 9999999.99499999 9999999.99 | 1443 2 9999999.99499999 9999999.99 |
1442 // K doesn't support halfDowm rounding mode? | 1444 // K doesn't support halfDown rounding mode? |
1443 2 9999999.995 9999999.99 K | 1445 2 9999999.995 9999999.99 K |
1444 2 9999999.99500001 10000000.00 | 1446 2 9999999.99500001 10000000.00 |
1445 100 56565656565656565656565656565656565656565656565656565656565656 56565656
565656565656565656565656565656565656565656565656565656.00 C | 1447 100 56565656565656565656565656565656565656565656565656565656565656 56565656
565656565656565656565656565656565656565656565656565656.00 C |
1446 100 454545454545454545454545454545.454545454545454545454545454545 45454545
4545454545454545454545.454545454545454545454545454545 C | 1448 100 454545454545454545454545454545.454545454545454545454545454545 45454545
4545454545454545454545.454545454545454545454545454545 C |
1447 100 0.0000000000000000000123 0.0000000000000000000123 | 1449 100 0.0000000000000000000123 0.0000000000000000000123 |
1448 100 -78787878787878787878787878787878 -7878787878787878787878787878787
8.00 C | 1450 100 -78787878787878787878787878787878 -7878787878787878787878787878787
8.00 C |
1449 100 -8989898989898989898989.8989898989898989 -8989898989898989898989.
8989898989898989 C | 1451 100 -8989898989898989898989.8989898989898989 -8989898989898989898989.
8989898989898989 C |
1450 | 1452 |
1451 test ticket 11230 | 1453 test ticket 11230 |
1452 set locale en | 1454 set locale en |
1453 set pattern #,##0 | 1455 set pattern #,##0 |
1454 begin | 1456 begin |
1455 parse output breaks | 1457 parse output breaks |
1456 // K and J return null; S and C return 99 | 1458 // K and J return null; S, C, and P return 99 |
1457 9 9» 9» CJKS | 1459 9 9» 9» CJKSP |
1458 // K returns null | 1460 // K returns null |
1459 9 999 9999 K | 1461 9 999 9999 K |
1460 | 1462 |
1461 test parse ignorables | 1463 test parse ignorables |
1462 set locale ar | 1464 set locale ar |
1463 // Note: Prefixes contain RLMs, as do some of the test cases. | 1465 // Note: Prefixes contain RLMs, as do some of the test cases. |
| 1466 // P does not work on most of these right now. |
1464 set pattern x ab0c df· | 1467 set pattern x ab0c df· |
1465 set negativePrefix y gh | 1468 set negativePrefix y gh |
1466 set negativeSuffix i jk· | 1469 set negativeSuffix i jk· |
1467 begin | 1470 begin |
1468 parse output breaks | 1471 parse output breaks |
1469 x ab56c df 56 | 1472 x ab56c df 56 |
1470 x ab56c df » 56» K | 1473 x ab56c df » 56» KP |
1471 x ab56c df » 56» K | 1474 x ab56c df » 56» KP |
1472 x ab56c df» 56» JK | 1475 x ab56c df» 56» JKP |
1473 x ab56c df » 56» K | 1476 x ab56c df » 56» KP |
1474 x ab56» 56» JK | 1477 x ab56» 56» JKP |
1475 x a b56»56» JK | 1478 x a b56»56» JKP |
1476 56cdf 56 JK | 1479 56cdf 56 JK |
1477 56c df 56 JK | 1480 56c df 56 JK |
1478 56cd f 56 JK | 1481 56cd f 56 JK |
1479 56cdf 56 JK | 1482 56cdf 56 JK |
1480 56cdf 56 JK | 1483 56cdf 56 JK |
1481 56c df 56 JK | 1484 56c df 56 JK |
1482 56c df 56 JK | 1485 56c df 56 JK |
1483 y gh56i jk -56 | 1486 y gh56i jk -56 |
1484 y gh56i jk » -56» K | 1487 y gh56i jk » -56» KP |
1485 y gh56i jk » -56» K | 1488 y gh56i jk » -56» KP |
1486 y gh56i jk» -56» JK | 1489 y gh56i jk» -56» JKP |
1487 y gh56i jk » -56» K | 1490 y gh56i jk » -56» KP |
1488 y gh56» -56» JK | 1491 y gh56» -56» JKP |
1489 y g h56»-56» JK | 1492 y g h56»-56» JKP |
1490 // S stops parsing after the 'i' for these and returns -56 | 1493 // S stops parsing after the 'i' for these and returns -56 |
1491 // C stops before the 'i' and gets 56 | 1494 // C stops before the 'i' and gets 56 |
1492 56ijk» -56» CJK | 1495 56ijk» -56» CJKP |
1493 56i jk -56 CJK | 1496 56i jk -56 CJK |
1494 56ij k» -56» CJK | 1497 56ij k» -56» CJKP |
1495 56ijk»-56» CJK | 1498 56ijk»-56» CJKP |
1496 56ijk » -56» CJK | 1499 56ijk » -56» CJKP |
1497 56i jk » -56» CJK | 1500 56i jk » -56» CJKP |
1498 56i jk -56 CJK | 1501 56i jk -56 CJK |
1499 // S and C get 56 (accepts ' ' gs grouping); J and K get null | 1502 // S and C get 56 (accepts ' ' gs grouping); J and K get null |
1500 5 6» fail» CS | 1503 5 6» fail» CSP |
1501 56 5 JK | 1504 56 5 JK |
1502 | 1505 |
1503 test parse spaces in grouping | 1506 test parse spaces in grouping |
1504 // This test gives the ideal behavior of these cases, which | 1507 // This test gives the ideal behavior of these cases, which |
1505 // none of the implementations currently support. | 1508 // none of the implementations currently support. |
1506 set locale en | 1509 set locale en |
1507 set pattern #,##0 | 1510 set pattern #,##0 |
1508 begin | 1511 begin |
1509 parse output breaks | 1512 parse output breaks |
1510 // C, J and S get "12" here | 1513 // C, J, S, and P get "12" here |
1511 1 2» 1» CJS | 1514 1 2» 1» CJSP |
1512 1 23» 1» CJS | 1515 1 23» 1» CJSP |
1513 // K gets 1 here; doesn't pick up the grouping separator | 1516 // K gets 1 here; doesn't pick up the grouping separator |
1514 1 234 1234 K | 1517 1 234 1234 K |
1515 | 1518 |
1516 test rounding increment significant digits | 1519 test rounding increment significant digits |
1517 // This test is for #13111 | 1520 // This test is for #13111 |
1518 set locale en | 1521 set locale en |
1519 set pattern 0.1 | 1522 set pattern 0.1 |
1520 set useSigDigits 1 | 1523 set useSigDigits 1 |
1521 set maxSigDigits 2 | 1524 set maxSigDigits 2 |
1522 begin | 1525 begin |
(...skipping 13 matching lines...) Expand all Loading... |
1536 1.23!@#$%^ 1.23 JK | 1539 1.23!@#$%^ 1.23 JK |
1537 | 1540 |
1538 test percentage parsing multiplier | 1541 test percentage parsing multiplier |
1539 // This test is for #13114 | 1542 // This test is for #13114 |
1540 set locale en | 1543 set locale en |
1541 set pattern 0% | 1544 set pattern 0% |
1542 begin | 1545 begin |
1543 parse output breaks | 1546 parse output breaks |
1544 55% 0.55 | 1547 55% 0.55 |
1545 // J and K get null | 1548 // J and K get null |
1546 55» 0.55» JK | 1549 // P requires the symbol to be present and gets 55 |
| 1550 55» 0.55» JKP |
1547 | 1551 |
1548 test trailing grouping separators in pattern | 1552 test trailing grouping separators in pattern |
1549 // This test is for #13115 | 1553 // This test is for #13115 |
1550 set locale en | 1554 set locale en |
1551 begin | 1555 begin |
1552 pattern format output breaks | 1556 pattern format output breaks |
1553 $0M 123456 $123456M | 1557 $0M 123456 $123456M |
1554 // The following patterns are rejected as malformed. | 1558 // The following patterns are rejected as malformed. |
1555 $0,M 123456 fail | 1559 $0,M 123456 fail |
1556 $0,,M 123456 fail | 1560 $0,,M 123456 fail |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 | 1612 |
1609 | 1613 |
1610 | 1614 |
1611 | 1615 |
1612 | 1616 |
1613 | 1617 |
1614 | 1618 |
1615 | 1619 |
1616 | 1620 |
1617 | 1621 |
LEFT | RIGHT |