ICU-13513 Synchronizing C and J copies of numberformattestspecification.txt
X-SVN-Rev: 40909
This commit is contained in:
parent
bfcedd7774
commit
fc3c904559
@ -325,6 +325,7 @@ const NumberFormatTestTupleFieldData gFieldData[] = {
|
||||
FIELD_INIT(positiveSuffix, &gStrOps),
|
||||
FIELD_INIT(negativePrefix, &gStrOps),
|
||||
FIELD_INIT(negativeSuffix, &gStrOps),
|
||||
FIELD_INIT(signAlwaysShown, &gIntOps),
|
||||
FIELD_INIT(localizedPattern, &gStrOps),
|
||||
FIELD_INIT(toPattern, &gStrOps),
|
||||
FIELD_INIT(toLocalizedPattern, &gStrOps),
|
||||
|
@ -55,6 +55,7 @@ enum ENumberFormatTestTupleField {
|
||||
kPositiveSuffix,
|
||||
kNegativePrefix,
|
||||
kNegativeSuffix,
|
||||
kSignAlwaysShown,
|
||||
kLocalizedPattern,
|
||||
kToPattern,
|
||||
kToLocalizedPattern,
|
||||
@ -118,6 +119,7 @@ public:
|
||||
UnicodeString positiveSuffix;
|
||||
UnicodeString negativePrefix;
|
||||
UnicodeString negativeSuffix;
|
||||
int32_t signAlwaysShown;
|
||||
UnicodeString localizedPattern;
|
||||
UnicodeString toPattern;
|
||||
UnicodeString toLocalizedPattern;
|
||||
@ -164,6 +166,7 @@ public:
|
||||
UBool positiveSuffixFlag;
|
||||
UBool negativePrefixFlag;
|
||||
UBool negativeSuffixFlag;
|
||||
UBool signAlwaysShownFlag;
|
||||
UBool localizedPatternFlag;
|
||||
UBool toPatternFlag;
|
||||
UBool toLocalizedPatternFlag;
|
||||
|
@ -229,6 +229,9 @@ static void adjustDecimalFormat(
|
||||
if (tuple.negativeSuffixFlag) {
|
||||
fmt.setNegativeSuffix(tuple.negativeSuffix);
|
||||
}
|
||||
if (tuple.signAlwaysShownFlag) {
|
||||
// Not currently supported
|
||||
}
|
||||
if (tuple.localizedPatternFlag) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
fmt.applyLocalizedPattern(tuple.localizedPattern, status);
|
||||
|
@ -441,11 +441,10 @@ en_US 1 123,456 123456
|
||||
en_US 0 123,456 123
|
||||
en_US 1 123.456 123.456
|
||||
en_US 0 123.456 123.456
|
||||
fr_FR 1 123,456 123.456
|
||||
fr_FR 0 123,456 123.456
|
||||
// JDK returns 123 here; not sure why.
|
||||
fr_FR 1 123.456 123456 K
|
||||
fr_FR 0 123.456 123
|
||||
it_IT 1 123,456 123.456
|
||||
it_IT 0 123,456 123.456
|
||||
it_IT 1 123.456 123456
|
||||
it_IT 0 123.456 123
|
||||
|
||||
test no grouping in pattern with parsing
|
||||
set pattern 0
|
||||
@ -466,9 +465,8 @@ output grouping breaks grouping2 minGroupingDigits
|
||||
1,2345,6789 4
|
||||
1,23,45,6789 4 K 2
|
||||
1,23,45,6789 4 K 2 2
|
||||
// Q only supports minGrouping<=2
|
||||
123,456789 6 6 3
|
||||
123456789 6 JKQ 6 4
|
||||
123456789 6 JK 6 4
|
||||
|
||||
test multiplier setters
|
||||
set locale en_US
|
||||
@ -754,6 +752,7 @@ parse output breaks
|
||||
+3.52EE4 3.52
|
||||
+1,234,567.8901 1234567.8901
|
||||
+1,23,4567.8901 1234567.8901
|
||||
// Fraction grouping is disabled by default
|
||||
+1,23,4567.89,01 1234567.89
|
||||
+1,23,456.78.9 123456.78
|
||||
+12.34,56 12.34
|
||||
@ -831,15 +830,14 @@ parse output breaks
|
||||
// JDK does allow separators in the wrong place and parses as -5347.25
|
||||
(53,47.25) fail K
|
||||
// strict requires prefix or suffix, except in C
|
||||
65,347.25 fail
|
||||
65,347.25 fail
|
||||
+3.52E4 35200
|
||||
(34.8E-3) -0.0348
|
||||
(3425E-1) -342.5
|
||||
// Strict doesn't allow separators in sci notation.
|
||||
(63,425) -63425
|
||||
// JDK and S allow separators in sci notation and parses as -342.5
|
||||
// C passes
|
||||
(63,425E-1) fail CKS
|
||||
// J does not allow grouping separators in scientific notation.
|
||||
(63,425E-1) -6342.5 J
|
||||
// Both prefix and suffix needed for strict.
|
||||
// JDK accepts this and parses as -342.5
|
||||
(3425E-1 fail K
|
||||
@ -954,12 +952,12 @@ set negativeSuffix 9N
|
||||
begin
|
||||
parse output breaks
|
||||
// S is the only implementation that passes these cases.
|
||||
// C consumes the '9' as a digit and assumes number is negative
|
||||
// C and P consume the '9' as a digit and assumes number is negative
|
||||
// J and JDK bail
|
||||
6549K 654 CJK
|
||||
// C consumes the '9' as a digit and assumes number is negative
|
||||
6549K 654 CJKP
|
||||
// C and P consume the '9' as a digit and assumes number is negative
|
||||
// J and JDK bail
|
||||
6549N -654 CJK
|
||||
6549N -654 CJKP
|
||||
|
||||
test really strange prefix
|
||||
set locale en
|
||||
@ -974,7 +972,7 @@ test parse pattern with quotes
|
||||
set locale en
|
||||
set pattern '-'#y
|
||||
begin
|
||||
parse output
|
||||
parse output breaks
|
||||
-45y 45
|
||||
|
||||
test parse with locale symbols
|
||||
@ -1187,17 +1185,17 @@ $53.45 fail USD J
|
||||
USD 53.45 53.45 USD J
|
||||
53.45USD 53.45 USD CJ
|
||||
USD53.45 53.45 USD
|
||||
// S fails these because '(' is an incomplete prefix.
|
||||
(7.92) USD -7.92 USD CJS
|
||||
(7.92) GBP -7.92 GBP CJS
|
||||
(7.926) USD -7.926 USD CJS
|
||||
(7.926 USD) -7.926 USD CJS
|
||||
// P fails these because '(' is an incomplete prefix.
|
||||
(7.92) USD -7.92 USD CJP
|
||||
(7.92) GBP -7.92 GBP CJP
|
||||
(7.926) USD -7.926 USD CJP
|
||||
(7.926 USD) -7.926 USD CJP
|
||||
(USD 7.926) -7.926 USD J
|
||||
USD (7.926) -7.926 USD CJS
|
||||
USD (7.92) -7.92 USD CJS
|
||||
(7.92)USD -7.92 USD CJS
|
||||
USD(7.92) -7.92 USD CJS
|
||||
(8) USD -8 USD CJS
|
||||
USD (7.926) -7.926 USD CJP
|
||||
USD (7.92) -7.92 USD CJP
|
||||
(7.92)USD -7.92 USD CJP
|
||||
USD(7.92) -7.92 USD CJP
|
||||
(8) USD -8 USD CJP
|
||||
-8 USD -8 USD C
|
||||
67 USD 67 USD C
|
||||
53.45$ fail USD
|
||||
@ -1223,37 +1221,38 @@ test parse foreign currency symbol
|
||||
set pattern \u00a4 0.00;\u00a4 -#
|
||||
set locale fa_IR
|
||||
begin
|
||||
parse output outputCurrency
|
||||
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
|
||||
// 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 P
|
||||
IRR 1235 1235 IRR
|
||||
\u0631\u06cc\u0627\u0644 1235 1235 IRR
|
||||
\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR
|
||||
\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR P
|
||||
|
||||
test parse foreign currency ISO
|
||||
set pattern \u00a4\u00a4 0.00;\u00a4\u00a4 -#
|
||||
set locale fa_IR
|
||||
begin
|
||||
parse output outputCurrency
|
||||
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
|
||||
\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR P
|
||||
IRR 1235 1235 IRR
|
||||
\u0631\u06cc\u0627\u0644 1235 1235 IRR
|
||||
\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR
|
||||
\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR P
|
||||
|
||||
test parse foreign currency full
|
||||
set pattern \u00a4\u00a4\u00a4 0.00;\u00a4\u00a4\u00a4 -#
|
||||
set locale fa_IR
|
||||
begin
|
||||
parse output outputCurrency
|
||||
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
|
||||
\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR P
|
||||
IRR 1235 1235 IRR
|
||||
\u0631\u06cc\u0627\u0644 1235 1235 IRR
|
||||
\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR
|
||||
\u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR P
|
||||
|
||||
test parse currency with foreign symbols symbol english
|
||||
set pattern \u00a4 0.00;\u00a4 (#)
|
||||
@ -1288,16 +1287,17 @@ Euros 7.82 7.82 EUR
|
||||
test parse currency without currency mode
|
||||
// Should accept a symbol associated with the currency specified by the API,
|
||||
// but should not traverse the full currency data.
|
||||
// P always traverses full currency data.
|
||||
set locale en_US
|
||||
set pattern \u00a4#,##0.00
|
||||
begin
|
||||
parse currency output breaks
|
||||
$52.41 USD 52.41
|
||||
USD52.41 USD 52.41 K
|
||||
\u20ac52.41 USD fail
|
||||
EUR52.41 USD fail
|
||||
$52.41 EUR fail
|
||||
USD52.41 EUR fail
|
||||
\u20ac52.41 USD fail P
|
||||
EUR52.41 USD fail P
|
||||
$52.41 EUR fail P
|
||||
USD52.41 EUR fail P
|
||||
\u20ac52.41 EUR 52.41 K
|
||||
EUR52.41 EUR 52.41
|
||||
|
||||
@ -1307,11 +1307,11 @@ set locale en_US
|
||||
set lenient 0
|
||||
begin
|
||||
parse output outputCurrency breaks
|
||||
$53.45 53.45 USD
|
||||
$53.45 53.45 USD P
|
||||
53.45 USD 53.45 USD
|
||||
USD 53.45 fail USD
|
||||
53.45USD fail USD
|
||||
USD53.45 53.45 USD
|
||||
USD53.45 53.45 USD P
|
||||
(7.92) USD -7.92 USD
|
||||
(7.92) EUR -7.92 EUR
|
||||
(7.926) USD -7.926 USD
|
||||
@ -1329,9 +1329,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
|
||||
US Dollars53.45 53.45 USD P
|
||||
53.45US Dollars fail USD
|
||||
US Dollar53.45 53.45 USD
|
||||
US Dollar53.45 53.45 USD P
|
||||
US Dollat53.45 fail USD
|
||||
53.45US Dollar fail USD
|
||||
US Dollars (53.45) fail USD
|
||||
@ -1376,13 +1376,15 @@ test parse minus sign
|
||||
set locale en
|
||||
set pattern #
|
||||
begin
|
||||
parse output breaks
|
||||
-123 -123
|
||||
- 123 -123 JK
|
||||
-123 -123 JK
|
||||
- 123 -123 JK
|
||||
123- -123 CJKS
|
||||
123 - -123 CJKS
|
||||
pattern parse output breaks
|
||||
# -123 -123
|
||||
# - 123 -123 JK
|
||||
# -123 -123 JK
|
||||
# - 123 -123 JK
|
||||
# 123- 123
|
||||
# 123 - 123
|
||||
#;#- 123- -123
|
||||
#;#- 123 - -123 JK
|
||||
|
||||
test parse case sensitive
|
||||
set locale en
|
||||
@ -1423,8 +1425,8 @@ NaN NaN K
|
||||
1E2147483646 1E2147483646
|
||||
1E-2147483649 0
|
||||
1E-2147483648 0
|
||||
// S returns zero here
|
||||
1E-2147483647 1E-2147483647 S
|
||||
// P returns zero here
|
||||
1E-2147483647 1E-2147483647 P
|
||||
1E-2147483646 1E-2147483646
|
||||
|
||||
test format push limits
|
||||
@ -1439,7 +1441,7 @@ maxFractionDigits format output breaks
|
||||
100 9999999999999.9950000000001 9999999999999.9950000000001 C
|
||||
2 9999999999999.9950000000001 10000000000000.00 C
|
||||
2 9999999.99499999 9999999.99
|
||||
// K doesn't support halfDowm rounding mode?
|
||||
// K doesn't support halfDown rounding mode?
|
||||
2 9999999.995 9999999.99 K
|
||||
2 9999999.99500001 10000000.00
|
||||
100 56565656565656565656565656565656565656565656565656565656565656 56565656565656565656565656565656565656565656565656565656565656.00 C
|
||||
@ -1453,8 +1455,8 @@ set locale en
|
||||
set pattern #,##0
|
||||
begin
|
||||
parse output breaks
|
||||
// K and J return null; S and C return 99
|
||||
9 9 9 CJKS
|
||||
// K and J return null; S, C, and P return 99
|
||||
9 9 9 CJKP
|
||||
// K returns null
|
||||
9 999 9999 K
|
||||
|
||||
@ -1497,7 +1499,7 @@ y g h56 -56 JK
|
||||
56i jk -56 CJK
|
||||
56i jk -56 CJK
|
||||
// S and C get 56 (accepts ' ' gs grouping); J and K get null
|
||||
5 6 fail CS
|
||||
5 6 fail CP
|
||||
56 5 JK
|
||||
|
||||
test parse spaces in grouping
|
||||
@ -1507,9 +1509,9 @@ set locale en
|
||||
set pattern #,##0
|
||||
begin
|
||||
parse output breaks
|
||||
// C, J and S get "12" here
|
||||
1 2 1 CJS
|
||||
1 23 1 CJS
|
||||
// C, J, S, and P get "12" here
|
||||
1 2 1 CJP
|
||||
1 23 1 CJP
|
||||
// K gets 1 here; doesn't pick up the grouping separator
|
||||
1 234 1234 K
|
||||
|
||||
@ -1543,7 +1545,8 @@ begin
|
||||
parse output breaks
|
||||
55% 0.55
|
||||
// J and K get null
|
||||
55 0.55 JK
|
||||
// P requires the symbol to be present and gets 55
|
||||
55 0.55 JKP
|
||||
|
||||
test trailing grouping separators in pattern
|
||||
// This test is for #13115
|
||||
@ -1573,6 +1576,34 @@ begin
|
||||
parse output breaks
|
||||
9223372036854775807% 92233720368547758.07
|
||||
|
||||
test sign always shown
|
||||
set locale en
|
||||
set pattern 0
|
||||
set signAlwaysShown 1
|
||||
begin
|
||||
format output breaks
|
||||
// C, J and K do not support this feature
|
||||
42 +42 CJK
|
||||
0 +0 CJK
|
||||
-42 -42
|
||||
|
||||
test parse strict with plus sign
|
||||
set locale en
|
||||
set pattern 0
|
||||
set signAlwaysShown 1
|
||||
begin
|
||||
lenient parse output breaks
|
||||
1 42 42
|
||||
1 -42 -42
|
||||
1 +42 42 CJK
|
||||
1 0 0
|
||||
1 +0 0 CJK
|
||||
0 42 fail CJK
|
||||
0 -42 -42
|
||||
0 +42 42 CJK
|
||||
0 0 fail CJK
|
||||
0 +0 0 CJK
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1582,9 +1582,9 @@ set pattern 0
|
||||
set signAlwaysShown 1
|
||||
begin
|
||||
format output breaks
|
||||
// J and K do not support this feature
|
||||
42 +42 JK
|
||||
0 +0 JK
|
||||
// C, J and K do not support this feature
|
||||
42 +42 CJK
|
||||
0 +0 CJK
|
||||
-42 -42
|
||||
|
||||
test parse strict with plus sign
|
||||
@ -1595,14 +1595,14 @@ begin
|
||||
lenient parse output breaks
|
||||
1 42 42
|
||||
1 -42 -42
|
||||
1 +42 42 JK
|
||||
1 +42 42 CJK
|
||||
1 0 0
|
||||
1 +0 0 JK
|
||||
1 +0 0 CJK
|
||||
0 42 fail CJK
|
||||
0 -42 -42
|
||||
0 +42 42 JK
|
||||
0 +42 42 CJK
|
||||
0 0 fail CJK
|
||||
0 +0 0 JK
|
||||
0 +0 0 CJK
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user