]>
Commit | Line | Data |
---|---|---|
0f5d89e8 | 1 | // Copyright (C) 2016 and later: Unicode, Inc. and others. |
f3c0d7a5 A |
2 | // License & terms of use: http://www.unicode.org/copyright.html |
3 | // Copyright (C) 2015-2016, International Business Machines | |
2ca993e8 A |
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. | |
0f5d89e8 A |
11 | // |
12 | // breaks field names: | |
13 | // H = ICU4J 58 (archive) | |
14 | // J = ICU4J (current) | |
15 | // K = JDK (ignored if not OpenJDK 1.8) | |
16 | // C = ICU4C (current) | |
17 | // P = Properties-based ICU4J (bypasses DecimalFormat wrapper) | |
18 | // Q = ? (old, from ICU 61 tests, maybe the same as P? | |
19 | // | |
2ca993e8 A |
20 | // For more information on the format of this file, including all the available |
21 | // field names, please see | |
22 | // https://docs.google.com/document/d/1T2P0p953_Lh1pRwo-5CuPVrHlIBa_wcXElG-Hhg_WHM/edit?usp=sharing | |
23 | ||
24 | test plus sign | |
0f5d89e8 | 25 | set locale ar-EG |
2ca993e8 A |
26 | set pattern +0;-# |
27 | begin | |
28 | format output breaks | |
0f5d89e8 A |
29 | 6 \u061C+\u0666 HK |
30 | -6 \u061C-\u0666 K | |
2ca993e8 A |
31 | |
32 | test basic patterns | |
33 | set locale fr_FR | |
34 | set format 1234.567 | |
35 | begin | |
36 | pattern output | |
37 | #,##0.## 1\u00a0234,57 | |
38 | 0.## 1234,57 | |
39 | 0 1235 | |
40 | #,##0.### 1\u00a0234,567 | |
41 | ###0.###### 1234,567 | |
42 | ###0.0000# 1234,5670 | |
43 | 00000.0000 01234,5670 | |
44 | #,##0.00 \u00a4 1\u00a0234,57 \u20ac | |
45 | 'tick''bitten '0.00 tick'bitten 1234,57 | |
46 | 'tick' 'bitten '0.00 tick bitten 1234,57 | |
47 | ||
48 | ||
49 | test minimum and maximum fraction digits | |
50 | set locale en | |
51 | set minIntegerDigits 2 | |
52 | set maxIntegerDigits 4 | |
53 | set minFractionDigits 3 | |
54 | set maxFractionDigits 5 | |
55 | begin | |
56 | format output | |
57 | 6 06.000 | |
58 | 6.000005 06.000 | |
59 | 6.000006 06.00001 | |
60 | 1002003004005 4005.000 | |
61 | -1002003004005 -4005.000 | |
62 | 12 12.000 | |
63 | 12345 2345.000 | |
64 | 72.1234 72.1234 | |
65 | ||
0f5d89e8 A |
66 | test patterns with no '0' symbols |
67 | set locale en_US | |
68 | begin | |
69 | pattern format output breaks | |
70 | # 514.23 514 | |
71 | # 0.23 0 | |
72 | # 0 0 | |
73 | # 1 1 | |
74 | ##.# 514.23 514.2 | |
75 | ##.# 0.23 0.2 | |
76 | ##.# 0 0 | |
77 | ##.# 1 1 | |
78 | #.# 514.23 514.2 | |
79 | #.# 0.23 0.2 | |
80 | #.# 0 0 | |
81 | #.# 1 1 | |
82 | .# 514.23 514.2 | |
83 | .# 0.23 .2 | |
84 | .# 0 .0 | |
85 | .# 1 1.0 | |
86 | #. 514.23 514. | |
87 | #. 0.23 0. | |
88 | #. 0 0. | |
89 | #. 1 1. | |
90 | . 514.23 514. | |
91 | . 0.23 0. | |
92 | . 0 0. | |
93 | . 1 1. | |
94 | ||
95 | test behavior on numbers approaching zero | |
96 | set locale en | |
97 | begin | |
98 | pattern format output breaks | |
99 | #.## 0.01 0.01 | |
100 | #.## 0.001 0 | |
101 | #.## 0 0 | |
102 | #.00 0.01 .01 | |
103 | #.00 0.001 .00 | |
104 | #.00 0 .00 | |
105 | 0.00 0.01 0.01 | |
106 | 0.00 0.001 0.00 | |
107 | 0.00 0 0.00 | |
108 | ||
109 | // Not in official spec, but needed for backwards compatibility | |
110 | test patterns with leading grouping separator | |
111 | set locale en_US | |
112 | begin | |
113 | pattern format output breaks | |
114 | ,##0 1234.56 1,235 | |
115 | '#',## 3456 #34,56 | |
116 | ||
117 | test patterns with valid and invalid quote marks | |
118 | set locale et | |
119 | begin | |
120 | pattern format output breaks | |
121 | '# 1 fail | |
122 | ''# 1 '1 | |
123 | '''# 1 fail | |
124 | ''''# 1 ''1 | |
125 | '''''# 1 fail | |
126 | '-''-'# 1 -'-1 | |
127 | // K doesn't know the locale symbol for et | |
128 | -'-'# 1 −-1 K | |
129 | '#'# 1 #1 | |
130 | ''#'' 1 '1' | |
131 | ''#- 1 '1− K | |
132 | '-'#- 1 -1− K | |
133 | -#'-' 1 −1- K | |
134 | ||
2ca993e8 A |
135 | test int64 |
136 | set locale en | |
137 | begin | |
138 | format output | |
139 | 1002003004005 1002003004005 | |
140 | -1002003004005 -1002003004005 | |
141 | ||
142 | test rounding | |
143 | set locale fr | |
144 | begin | |
145 | pattern format output breaks | |
146 | 0.5 1.25 1,0 K | |
147 | 0.5 1.75 2,0 K | |
148 | 0.5 -1.25 -1,0 K | |
149 | 00.5 -1.75 -02,0 K | |
150 | 4 2.0 0 K | |
151 | 4 6.0 8 K | |
152 | 4 10.0 8 K | |
153 | 2.70 99.0 99,90 K | |
154 | 2.73 272.0 273,00 K | |
155 | #,#3.70 104.0 1\u00a003,60 K | |
156 | ||
157 | test significant digits | |
158 | set locale en | |
159 | set pattern #,#@,@### | |
160 | begin | |
161 | format output breaks | |
162 | 7 7.0 K | |
163 | 23 23 K | |
164 | 100 100 K | |
165 | 1000 1000 K | |
166 | 10000 1,0000 K | |
167 | 10001 1,0001 K | |
168 | 10001.5 1,0002 K | |
169 | 1234567 1,23,4600 K | |
170 | -1234567 -1,23,4600 K | |
171 | 3.14159 3.1416 K | |
172 | ||
173 | test scientific notation | |
174 | set locale fr | |
175 | begin | |
176 | pattern format output breaks | |
177 | 0.00E0 12345 1,23E4 | |
178 | 000.00E0 12300 123,00E2 | |
179 | 000.0#E0 12300 123,0E2 | |
180 | 000.0#E0 12300.1 123,0E2 | |
181 | 000.0#E0 12301.0 123,01E2 | |
182 | // JDK does not support exponent signs | |
183 | 000.0#E+00 12301.0 123,01E+02 K | |
184 | // JDK gives 12,345E3. JDK seems to include the hashes in significant digits | |
185 | ##0.00E0 12345 12,3E3 K | |
186 | // JDK gives 12,3001E3 | |
187 | ##0.0000E0 12300.1 12,300E3 K | |
188 | // JDK gives 12,3001E3 | |
189 | ##0.000#E0 12300.1 12,30E3 K | |
190 | ##0.000#E0 12301 12,301E3 | |
0f5d89e8 | 191 | 0.05E0 12301.2 1,25E4 HK |
2ca993e8 A |
192 | ##0.000#E0 0.17 170,0E-3 |
193 | // JDK doesn't support significant digits in exponents | |
0f5d89e8 | 194 | @@@E0 6.235 6,24E0 K |
2ca993e8 A |
195 | @@@E0 6235 6,24E3 K |
196 | @@@#E0 6200 6,20E3 K | |
197 | @@@#E0 6201 6,201E3 K | |
198 | @@@#E0 6201.7 6,202E3 K | |
199 | @@@#E00 6201.7 6,202E03 K | |
200 | @@@#E+00 6201.7 6,202E+03 K | |
0f5d89e8 A |
201 | // If no zeros are specified, significant digits is fraction length plus 1 |
202 | #.##E0 52413 5,24E4 | |
203 | ###.##E0 52413 52,4E3 K | |
204 | #E0 52413 5,2413E4 K | |
205 | 0E0 52413 5E4 | |
2ca993e8 A |
206 | |
207 | test percents | |
208 | set locale fr | |
209 | begin | |
210 | pattern format output breaks | |
211 | 0.0% 0.573 57,3% | |
212 | %0.0 0.573 %57,3 | |
213 | p%p0.0 0.573 p%p57,3 | |
214 | p'%'p0.0 0.573 p%p0,6 | |
215 | %@@@@ 0.0326 %3,260 K | |
216 | %#,@@@ 15.43 %1\u00a0540 K | |
217 | // JDK does not support rounding increments | |
218 | %#,##4.1 16.55 %1\u00a0656,4 K | |
219 | // JDK gives %16,255E3 | |
220 | %##0.00E0 162.55 %16,3E3 K | |
221 | ||
222 | test permille | |
223 | set locale fr | |
224 | begin | |
225 | pattern format output breaks | |
226 | 0.0\u2030 0.573 573,0‰ | |
227 | \u20300.0 0.573 \u2030573,0 | |
228 | p\u2030p0.0 0.573 p\u2030p573,0 | |
229 | p'\u2030'p0.0 0.573 p\u2030p0,6 | |
230 | \u2030@@@@ 0.0326 \u203032,60 K | |
231 | \u2030#,@@@ 15.43 \u203015\u00a0400 K | |
232 | \u2030#,##4.1 16.55 \u203016\u00a0551,7 K | |
233 | // JDK gives \u2030162,55E3 | |
234 | \u2030##0.00E0 162.55 \u2030163E3 K | |
235 | ||
236 | test padding | |
237 | set locale fr_FR | |
238 | begin | |
239 | pattern format output breaks | |
240 | // JDK does not seem to support padding | |
241 | $**####,##0 1234 $***1\u00a0234 K | |
242 | *x$####,##0 1234 xxx$1\u00a0234 K | |
243 | ####,##0*x$ 1234 1\u00a0234xxx$ K | |
244 | ####,##0$*x 1234 1\u00a0234$xxx K | |
245 | // JDK doesn't seem to handle suffixes correctly dropping the 'nx' entirely | |
246 | ####,##0$*x;ne#n -1234 ne1\u00a0234nx K | |
247 | ####,##0$*x;n#'*' -1234 n1\u00a0234*xx K | |
248 | *y%4.2###### 4.33 yyyy%432,6 K | |
249 | // In J ICU adds padding as if 'EUR' is only 2 chars (2 * 0xa4) | |
0f5d89e8 A |
250 | \u00a4\u00a4 **####0.00 433.0 EUR *433,00 HK |
251 | // In H ICU adds padding as if 'EUR' is only 2 chars (2 * 0xa4) | |
252 | // P fails this one because the test code bypasses CurrencyUsage | |
253 | \u00a4\u00a4 **#######0 433.0 EUR *433,00 HKP | |
2ca993e8 A |
254 | |
255 | test padding and currencies | |
256 | begin | |
257 | locale currency pattern format output breaks | |
258 | // In J, JPY is considered 2 char (2 * 0xa4) even though padding is done | |
259 | // after prefix. In C this test works. | |
0f5d89e8 | 260 | fr JPY \u00a4\u00a4 **#######0 433.22 JPY ****433 HK |
2ca993e8 A |
261 | // JDK doesn't correct rounding for currency, shows USD (433 |
262 | en USD \u00a4\u00a4 **#######0;\u00a4\u00a4 (#) -433.22 USD (433.22) K | |
263 | ||
264 | test currencies | |
265 | set locale fr | |
266 | set format 1234.567 | |
267 | begin | |
268 | pattern currency output breaks | |
269 | // JDK gives shows EUR instead of the euro symbol in this case | |
270 | #,##0.00 \u00a4 EUR 1\u00a0234,57 \u20ac K | |
271 | // JDK gives 1\u00A0234,57. JDK doesn't seem to correct rounding | |
272 | // based on currency. | |
273 | #,##0.00 \u00a4 JPY 1\u00a0235 JPY K | |
274 | ||
275 | test prefixes and suffixes | |
276 | set locale en | |
277 | set pattern 0.00+;(#) | |
278 | begin | |
279 | format output breaks | |
280 | 7 7.00+ | |
281 | // JDK does not support negative suffixes | |
282 | -3.5 (3.50) K | |
283 | ||
284 | test minimum grouping digits | |
285 | set locale en | |
286 | set pattern #,##0 | |
287 | set minGroupingDigits 2 | |
288 | begin | |
289 | format output breaks | |
290 | // min grouping digits not supported in any existing implementation | |
291 | // but could be easily added to the new DecimalFormat C code. | |
0f5d89e8 | 292 | 1000 1000 HK |
2ca993e8 A |
293 | 10000 10,000 |
294 | 100000 100,000 | |
295 | 1000000 1,000,000 | |
296 | ||
297 | test min max fraction digits | |
298 | set locale en | |
299 | set pattern #,##0.### | |
300 | set format 1234.567 | |
301 | begin | |
302 | minFractionDigits maxFractionDigits output | |
303 | 0 0 1,235 | |
304 | 0 2 1,234.57 | |
305 | 4 5 1,234.5670 | |
306 | ||
307 | test min max integer digits | |
308 | set locale en | |
309 | set pattern #,##0.### | |
310 | set format 1234.567 | |
311 | begin | |
312 | minIntegerDigits maxIntegerDigits output | |
313 | 0 0 .567 | |
314 | 0 3 234.567 | |
315 | 5 5 01,234.567 | |
316 | ||
317 | test min max fraction digits scientific | |
318 | set locale en | |
319 | set pattern #E0 | |
320 | set format 299792458.0 | |
321 | begin | |
322 | minIntegerDigits maxIntegerDigits minFractionDigits maxFractionDigits output breaks | |
0f5d89e8 A |
323 | // JDK gives 2.99792458E8 (maxInt + maxFrac instead of minInt + maxFrac) |
324 | 1 99 0 5 2.99792E8 K | |
2ca993e8 A |
325 | // JDK gives .3E9 instead of unlimited precision. |
326 | 0 1 0 0 2.99792458E8 K | |
327 | 1 1 0 0 3E8 | |
328 | // JDK gives E0 instead of allowing for unlimited precision | |
329 | 0 0 0 0 2.99792458E8 K | |
0f5d89e8 A |
330 | // JDK gives .299792E9; Q gives 2.99792E8 |
331 | 0 1 0 5 2.9979E8 KQ | |
2ca993e8 A |
332 | // JDK gives 300E6 |
333 | 0 3 0 0 299.792458E6 K | |
334 | // JDK gives 299.8E6 (maybe maxInt + maxFrac instead of minInt + maxFrac)? | |
335 | 0 3 0 1 300E6 K | |
336 | // JDK gives 299.7925E6 | |
337 | 2 3 0 4 299.792E6 K | |
338 | // JDK gives 299.79246E6 | |
339 | 2 3 0 5 299.7925E6 K | |
340 | 3 3 0 5 299.79246E6 | |
341 | 3 3 0 4 299.7925E6 | |
342 | 2 2 0 3 29.979E7 | |
343 | 4 4 0 0 2998E5 | |
344 | 0 0 1 5 .29979E9 | |
345 | // JDK gives E0 | |
346 | 0 0 1 0 2.99792458E8 K | |
0f5d89e8 A |
347 | // JDK and Q give .2998E9 |
348 | 0 0 0 4 2.998E8 KQ | |
349 | // According to the spec, if maxInt>minInt and minInt>1, then set | |
350 | // Context: #13289 | |
2ca993e8 A |
351 | 2 8 1 6 2.9979246E8 K |
352 | // Treat max int digits > 8 as being the same as min int digits. | |
353 | // This behavior is not spelled out in the specification. | |
354 | // JDK fails here because it tries to use 9 + 6 = 15 sig digits. | |
355 | 2 9 1 6 29.979246E7 K | |
356 | ||
357 | test significant digits scientific | |
358 | set locale en | |
359 | set pattern #E0 | |
360 | set format 290000000.0 | |
361 | begin | |
362 | minSigDigits maxSigDigits output breaks | |
363 | 0 1 3E8 K | |
364 | 0 2 2.9E8 K | |
365 | 0 3 2.9E8 K | |
366 | 1 1 3E8 K | |
367 | 1 2 2.9E8 K | |
368 | 1 3 2.9E8 K | |
369 | 2 2 2.9E8 K | |
370 | 2 3 2.9E8 K | |
371 | 3 3 2.90E8 K | |
372 | 3 4 2.90E8 K | |
373 | ||
374 | test min max fraction digits scientific 2 | |
375 | set locale en | |
376 | set pattern #E0 | |
377 | set format 29979245.0 | |
378 | begin | |
379 | minIntegerDigits maxIntegerDigits minFractionDigits maxFractionDigits output breaks | |
380 | // JDK gives E0 | |
381 | 0 0 0 0 2.9979245E7 K | |
382 | // JDK gives .3E8 | |
383 | 0 1 0 0 2.9979245E7 K | |
384 | // JDK gives 2998E4. | |
385 | 0 4 0 0 2997.9245E4 K | |
386 | ||
387 | test ticket 11524 | |
388 | set locale en | |
389 | set pattern #,##0.### | |
390 | begin | |
0f5d89e8 A |
391 | format maxIntegerDigits output breaks |
392 | 123 1 3 | |
393 | // (ICU 61 behavior) | |
394 | 0 0 0 | |
395 | // Q ignores max integer if it is less than zero and prints "123" | |
396 | 123 -2147483648 0 Q | |
397 | 12345 1 5 | |
398 | 12345 -2147483648 0 Q | |
399 | 5.3 1 5.3 | |
400 | 5.3 -2147483648 .3 Q | |
2ca993e8 A |
401 | |
402 | test patterns with zero | |
403 | set locale en | |
404 | set format 0 | |
405 | begin | |
0f5d89e8 | 406 | pattern output breaks |
2ca993e8 A |
407 | #.# 0 |
408 | #. 0. | |
409 | .# .0 | |
410 | # 0 | |
0f5d89e8 A |
411 | #,##0.00 0.00 |
412 | #,###.00 .00 | |
2ca993e8 A |
413 | 00.000E00 00.000E00 |
414 | 0.####E0 0E0 | |
415 | ##0.######E000 0E000 | |
416 | ||
417 | test significant digits manually set | |
418 | set locale en_US | |
419 | set pattern 0.0 | |
420 | set useSigDigits 1 | |
421 | set minSigDigits 3 | |
422 | set maxSigDigits 5 | |
423 | begin | |
424 | format output breaks | |
425 | 0.0012 0.00120 K | |
426 | 0.00123 0.00123 K | |
427 | 0.001234 0.001234 K | |
428 | 0.0012345 0.0012345 K | |
429 | 0.00123456 0.0012346 K | |
0f5d89e8 A |
430 | -43 -43.0 |
431 | -43.7 -43.7 | |
2ca993e8 A |
432 | -43.76 -43.76 K |
433 | -43.762 -43.762 K | |
434 | -43.7626 -43.763 K | |
435 | ||
436 | test grouping used setters | |
437 | set locale en_US | |
438 | set pattern #,##0 | |
439 | set format 12345 | |
440 | begin | |
441 | output useGrouping | |
442 | 12,345 | |
443 | 12,345 1 | |
444 | 12345 0 | |
445 | ||
0f5d89e8 A |
446 | test grouping used setters in parsing |
447 | set pattern #,##0 | |
448 | begin | |
449 | locale useGrouping parse output breaks | |
450 | en_US 1 123,456 123456 | |
451 | en_US 0 123,456 123 | |
452 | en_US 1 123.456 123.456 | |
453 | en_US 0 123.456 123.456 | |
454 | it_IT 1 123,456 123.456 | |
455 | it_IT 0 123,456 123.456 | |
456 | it_IT 1 123.456 123456 | |
457 | it_IT 0 123.456 123 | |
458 | ||
459 | test no grouping in pattern with parsing | |
460 | set pattern 0 | |
461 | begin | |
462 | locale parse output breaks | |
463 | en_US 123,456 123 | |
464 | en_US 123.456 123.456 | |
465 | fr_FR 123,456 123.456 | |
466 | fr_FR 123.456 123 | |
467 | ||
2ca993e8 A |
468 | test grouping setters |
469 | set locale en_US | |
470 | set pattern 0 | |
471 | set format 123456789 | |
472 | set useGrouping 1 | |
473 | begin | |
0f5d89e8 | 474 | output grouping grouping2 breaks |
2ca993e8 | 475 | 1,2345,6789 4 |
0f5d89e8 A |
476 | 1,23,45,6789 4 2 K |
477 | ||
478 | test grouping setters with min grouping digits | |
479 | set locale en_US | |
480 | set pattern 0 | |
481 | set format 123456789 | |
482 | set useGrouping 1 | |
483 | begin | |
484 | output grouping grouping2 minGroupingDigits breaks | |
485 | 1,23,45,6789 4 2 2 K | |
486 | 123,456789 6 6 3 | |
487 | 123456789 6 6 4 HK | |
2ca993e8 A |
488 | |
489 | test multiplier setters | |
490 | set locale en_US | |
491 | begin | |
492 | format multiplier output breaks | |
493 | 23 -12 -276 | |
494 | 23 -1 -23 | |
0f5d89e8 A |
495 | // H (ICU4J 58) and J (current ICU4J) throw exception on zero multiplier. |
496 | // ICU4C prints 23. | |
497 | // Q multiplies by zero and prints 0. | |
498 | 23 0 0 CHJ | |
2ca993e8 A |
499 | 23 1 23 |
500 | 23 12 276 | |
501 | -23 12 -276 | |
502 | -23 -12 276 | |
503 | ||
504 | test rounding setters | |
505 | set locale en_US | |
506 | set pattern 0.0# | |
507 | set roundingIncrement 0.25 | |
508 | begin | |
509 | format output breaks | |
510 | -0.35 -0.25 K | |
511 | 0.35 0.25 K | |
0f5d89e8 A |
512 | // P doesn't support mixing minFrac with roundingIncrement (prints 0.50). |
513 | 0.39 0.5 JKP | |
514 | 0.62 0.5 JKP | |
2ca993e8 A |
515 | 0.63 0.75 K |
516 | ||
517 | test padding setters | |
518 | set locale en_US | |
519 | set pattern bill0 | |
520 | set format 1357 | |
521 | begin | |
522 | padCharacter formatWidth output breaks | |
0f5d89e8 | 523 | * 8 bill1357 |
2ca993e8 A |
524 | * 9 *bill1357 K |
525 | ^ 10 ^^bill1357 K | |
526 | ||
527 | test use scientific setter | |
528 | set locale en_US | |
529 | set pattern 0.00 | |
530 | set format 186283 | |
531 | begin | |
0f5d89e8 | 532 | output useScientific breaks |
2ca993e8 | 533 | 186283.00 |
0f5d89e8 A |
534 | 1.86E5 1 K |
535 | 186283.00 0 | |
2ca993e8 A |
536 | |
537 | test rounding mode setters | |
538 | set locale en_US | |
0f5d89e8 | 539 | set pattern 0.5 |
2ca993e8 A |
540 | begin |
541 | format roundingMode output breaks | |
0f5d89e8 A |
542 | 1.24 halfUp 1.0 K |
543 | 1.25 halfUp 1.5 | |
544 | 1.25 halfDown 1.0 K | |
545 | 1.26 halfDown 1.5 | |
546 | 1.25 halfEven 1.0 K | |
547 | -1.01 up -1.5 | |
548 | -1.49 down -1.0 K | |
549 | 1.01 up 1.5 | |
550 | 1.49 down 1.0 K | |
551 | -1.01 ceiling -1.0 K | |
552 | -1.49 floor -1.5 | |
2ca993e8 A |
553 | |
554 | test currency usage setters | |
2ca993e8 | 555 | set locale CH |
2ca993e8 A |
556 | set pattern \u00a4\u00a4 0 |
557 | begin | |
0f5d89e8 A |
558 | format currency currencyUsage output breaks |
559 | 0.37 CHF standard CHF 0.37 K | |
560 | 0.37 CHF cash CHF 0.35 K | |
561 | 1.234 CZK standard CZK 1.23 K | |
562 | 1.234 CZK cash CZK 1 | |
563 | ||
564 | test currency usage to pattern | |
565 | set locale en | |
566 | begin | |
567 | currency currencyUsage toPattern breaks | |
568 | // These work in J, but it prepends an extra hash sign to the pattern. | |
569 | // C does not print the currency rounding information in the pattern. | |
570 | // K does not support this feature. | |
571 | USD standard 0.00 CHK | |
572 | CHF standard 0.00 CHK | |
573 | CZK standard 0.00 CHK | |
574 | USD cash 0.00 CHK | |
575 | CHF cash 0.05 CHK | |
576 | CZK cash 0 CHK | |
577 | ||
578 | test currency rounding | |
579 | set locale en | |
580 | set currency USD | |
581 | begin | |
582 | pattern format output breaks | |
583 | # 123 123 P | |
584 | // Currency rounding should always override the pattern. | |
585 | // K prints the currency in ISO format for some reason. | |
586 | \u00a4# 123 $123.00 K | |
587 | \u00a4#.000 123 $123.00 K | |
588 | \u00a4#.## 123 $123.00 K | |
2ca993e8 A |
589 | |
590 | test exponent parameter setters | |
591 | set locale en_US | |
592 | set pattern 0.##E0 | |
593 | set format 299792458 | |
594 | begin | |
595 | decimalSeparatorAlwaysShown exponentSignAlwaysShown minimumExponentDigits output breaks | |
596 | 0 0 2 3E08 K | |
597 | 0 1 3 3E+008 K | |
2ca993e8 A |
598 | // decimalSeparatorAlwaysShown K=JDK; C=ICU4C; J=ICU4J |
599 | // See ticket 11621 | |
0f5d89e8 A |
600 | 1 0 2 3.E08 K |
601 | 1 1 3 3.E+008 K | |
f3c0d7a5 | 602 | 1 0 1 3.E8 |
2ca993e8 A |
603 | 0 0 1 3E8 |
604 | ||
605 | test exponent decimalSeparatorAlwaysShown default | |
606 | set locale en_US | |
607 | set pattern 0.##E0 | |
608 | begin | |
0f5d89e8 | 609 | format output decimalSeparatorAlwaysShown breaks |
2ca993e8 A |
610 | // decimalSeparatorAlwaysShown off by default |
611 | 299792458 3E8 | |
612 | 299000000 2.99E8 | |
0f5d89e8 | 613 | 299792458 3.E8 1 |
2ca993e8 A |
614 | |
615 | test pad position setters | |
616 | set locale en_US | |
617 | set pattern **[#####0.##];((#)) | |
618 | begin | |
619 | format padPosition output breaks | |
620 | 12.34 beforePrefix ****[12.34] K | |
621 | 12.34 afterPrefix [****12.34] K | |
622 | 12.34 beforeSuffix [12.34****] K | |
623 | 12.34 afterSuffix [12.34]**** K | |
624 | -12.34 beforePrefix **((12.34)) K | |
625 | -12.34 afterPrefix ((**12.34)) K | |
626 | -12.34 beforeSuffix ((12.34**)) K | |
627 | -12.34 afterSuffix ((12.34))** K | |
628 | ||
629 | test affix setters | |
630 | set locale fr_FR | |
631 | set currency EUR | |
632 | set pattern 0.00 | |
633 | begin | |
634 | format positivePrefix positiveSuffix negativePrefix negativeSuffix output | |
635 | 12.34 % %12,34 | |
636 | 12.34 \u00a4\u00a4 12,34\u00a4\u00a4 | |
637 | 12.34 - + 12,34 | |
638 | -12.34 - + -12,34+ | |
639 | -12.34 \u00a4 \u00a412,34 | |
640 | 12.34 \u00a4 12,34 | |
641 | -12.34 % 12,34% | |
642 | 12.34 % 12,34 | |
643 | ||
644 | test more affix setters | |
645 | set locale fr_FR | |
646 | set pattern %0.00 | |
647 | begin | |
648 | format positivePrefix negativePrefix output | |
649 | 0.648 booya cooya booya64,80 | |
650 | ||
651 | test nan and infinity | |
652 | set locale en_US | |
653 | set pattern [0.00];(#) | |
654 | begin | |
655 | format output breaks | |
0f5d89e8 | 656 | Inf [\u221e] |
2ca993e8 | 657 | -Inf (\u221e) K |
0f5d89e8 A |
658 | // J does not print the affixes |
659 | // K prints \uFFFD | |
660 | // Q prints the affixes | |
661 | NaN NaN HKQ | |
2ca993e8 A |
662 | |
663 | test nan and infinity with multiplication | |
664 | set locale en | |
665 | set multiplier 100 | |
666 | begin | |
667 | format output breaks | |
668 | Inf \u221e | |
669 | -Inf -\u221e | |
670 | NaN NaN K | |
671 | ||
672 | test nan and infinity with padding | |
673 | set locale en_US | |
674 | set pattern $$$0.00$ | |
0f5d89e8 | 675 | set formatWidth 8 |
2ca993e8 A |
676 | begin |
677 | format padPosition output breaks | |
0f5d89e8 A |
678 | Inf beforePrefix $$$\u221e$ K |
679 | Inf afterPrefix $$$ \u221e$ K | |
680 | Inf beforeSuffix $$$\u221e $ K | |
681 | Inf afterSuffix $$$\u221e$ K | |
682 | // J does not print the affixes | |
683 | // K prints \uFFFD | |
684 | // Q gets $$$NaN$ | |
685 | NaN beforePrefix NaN HKQ | |
686 | NaN afterPrefix NaN HKQ | |
687 | NaN beforeSuffix NaN HKQ | |
688 | NaN afterSuffix NaN HKQ | |
2ca993e8 | 689 | |
f3c0d7a5 | 690 | test apply formerly localized patterns |
2ca993e8 | 691 | begin |
f3c0d7a5 A |
692 | // documentation says localizedPattern is not supported, change to pattern |
693 | locale pattern format output breaks | |
694 | en #0% 0.4376 44% | |
2ca993e8 | 695 | // This next test breaks JDK. JDK doesn't multiply by 100. |
0f5d89e8 A |
696 | fa \u0025\u00a0\u0023\u0030 0.4376 \u066a\u00a0\u06f4\u06f4 K |
697 | ||
698 | test localized pattern basic symbol coverage | |
699 | begin | |
700 | locale localizedPattern toPattern breaks | |
701 | it #.##0,00 #,##0.00 | |
702 | // JDK either doesn't know sl uses this character for minus sign | |
703 | // or doesn't support minus sign in localized pattern | |
704 | sl #.##0;#.##0− #,##0;#,##0- K | |
705 | // JDK does not have data for "×10^" in this locale | |
706 | en_SE 0,00×10^0;0,00×10^0- 0.00E0;0.00E0- K | |
707 | // JDK does not seem to transform the digits in localized patterns | |
708 | ar_SA #\u066C##\u0660\u066B\u0660\u0660;a# #,##0.00;a#,##0.00 K | |
2ca993e8 A |
709 | |
710 | test toPattern | |
711 | set locale en | |
712 | begin | |
713 | pattern toPattern breaks | |
0f5d89e8 | 714 | // All of the C and S failures in this section are because of functionally equivalent patterns |
2ca993e8 A |
715 | // JDK doesn't support any patterns with padding or both negative prefix and suffix |
716 | // Breaks ICU4J See ticket 11671 | |
0f5d89e8 | 717 | **0,000 **0,000 HK |
2ca993e8 A |
718 | **##0,000 **##0,000 K |
719 | **###0,000 **###0,000 K | |
0f5d89e8 | 720 | **####0,000 **#,##0,000 JKP |
2ca993e8 | 721 | ###,000. #,000. |
0f5d89e8 | 722 | 0,000 #0,000 JP |
2ca993e8 | 723 | .00 #.00 |
0f5d89e8 A |
724 | 000 #000 JP |
725 | 000,000 #,000,000 JP | |
2ca993e8 | 726 | pp#,000 pp#,000 |
0f5d89e8 | 727 | 00.## #00.## JP |
2ca993e8 A |
728 | #,#00.025 #,#00.025 |
729 | // No secondary grouping in JDK | |
730 | #,##,###.02500 #,##,###.02500 K | |
731 | pp#,000;(#) pp#,000;(#,000) K | |
0f5d89e8 | 732 | **####,##,##0.0##;(#) **#,##,##,##0.0##;**(##,##,##0.0##) JKP |
2ca993e8 A |
733 | // No significant digits in JDK |
734 | @@### @@### K | |
735 | @,@#,### @,@#,### K | |
736 | 0.00E0 0.00E0 | |
0f5d89e8 A |
737 | // The following one works in JDK, probably because |
738 | // it just returns the same string | |
739 | @@@##E0 @@@##E0 | |
2ca993e8 A |
740 | ###0.00#E0 ###0.00#E0 |
741 | ##00.00#E0 ##00.00#E0 | |
742 | 0.00E+00 0.00E+00 K | |
743 | 000.00E00 000.00E00 | |
744 | ###0.00#E00 ###0.00#E00 | |
745 | ||
746 | test parse | |
747 | set locale en | |
748 | set pattern +#,##0.0###;(#) | |
749 | begin | |
750 | parse output breaks | |
751 | +5,347.25 5347.25 | |
752 | +5,347,.25 5347.25 | |
753 | +5,347, 5347 | |
754 | +5347,,, 5347 | |
755 | +5347,,,d8 5347 | |
756 | (5,347.25) -5347.25 | |
0f5d89e8 A |
757 | // H requires prefix and suffix for lenient parsing, but C doesn't |
758 | 5,347.25 5347.25 HK | |
759 | (5,347.25 -5347.25 H | |
760 | // S is successful at parsing this as -5347.25 in lenient mode | |
761 | -5,347.25 -5347.25 CHK | |
2ca993e8 A |
762 | +3.52E4 35200 |
763 | (34.8E-3) -0.0348 | |
764 | // JDK stops parsing at the spaces. JDK doesn't see space as a grouping separator | |
765 | (34 25E-1) -342.5 K | |
766 | (34,,25E-1) -342.5 | |
0f5d89e8 A |
767 | // Trailing grouping separators are not OK. |
768 | // H fails; C/J/P stop at the offending separator. | |
769 | (34,,25,E-1) fail CJKP | |
770 | (34,,25,E-1) -342.5 H | |
771 | (34 25 E-1) -342.5 HK | |
772 | (34,,25 E-1) -342.5 CHK | |
2ca993e8 | 773 | // Spaces are not allowed after exponent symbol |
0f5d89e8 A |
774 | // C parses up to the E but H bails |
775 | (34 25E -1) -3425 HK | |
2ca993e8 A |
776 | +3.52EE4 3.52 |
777 | +1,234,567.8901 1234567.8901 | |
778 | +1,23,4567.8901 1234567.8901 | |
0f5d89e8 | 779 | // Fraction grouping is disabled by default |
2ca993e8 A |
780 | +1,23,4567.89,01 1234567.89 |
781 | +1,23,456.78.9 123456.78 | |
782 | +12.34,56 12.34 | |
0f5d89e8 A |
783 | +79,,20,33 792033 |
784 | // JDK gets 79 | |
785 | +79 20 33 792033 K | |
2ca993e8 | 786 | // Parsing stops at comma as it is different from other separators |
0f5d89e8 A |
787 | +79 20,33 7920 K |
788 | +79,,20 33 7920 | |
2ca993e8 | 789 | + 79 79 K |
0f5d89e8 | 790 | +,79,,20,33 792033 |
2ca993e8 A |
791 | +7920d3 7920 |
792 | // Whitespace immediately after prefix doesn't count as digit separator | |
0f5d89e8 A |
793 | // in C but is does in H |
794 | + ,79,,20,33 792033 HK | |
2ca993e8 A |
795 | ( 19 45) -1945 K |
796 | // C allows trailing separators when there is a prefix and suffix. | |
0f5d89e8 A |
797 | // H allows trailing separators only when there is just a prefix. |
798 | // In this case, H just bails | |
799 | ( 19 45 ) -1945 HK | |
2ca993e8 | 800 | (,,19,45) -1945 |
0f5d89e8 A |
801 | // C parses to the space, but H bails |
802 | (,,19 45) -19 H | |
803 | // H bails b/c comma different separator than space. C doesn't treat leading spaces | |
2ca993e8 | 804 | // as a separator. |
0f5d89e8 A |
805 | ( 19,45) -1945 HK |
806 | // H bails. Doesn't allow trailing separators when there is prefix and suffix. | |
807 | (,,19,45,) -1945 H | |
808 | // H bails on next 4 because H doesn't allow letters inside prefix and suffix. | |
2ca993e8 | 809 | // C will parse up to the letter. |
0f5d89e8 A |
810 | (,,19,45,d1) -1945 H |
811 | (,,19,45d1) -1945 H | |
812 | ( 19 45 d1) -1945 HK | |
813 | ( 19 45d1) -1945 HK | |
814 | // H does allow trailing separator before a decimal point | |
2ca993e8 A |
815 | (19,45,.25) -1945.25 |
816 | // 2nd decimal points are ignored | |
817 | +4.12.926 4.12 | |
818 | ||
819 | test parse suffix | |
820 | set locale en | |
821 | set pattern #,##0.0###+;#- | |
822 | begin | |
823 | parse output breaks | |
0f5d89e8 A |
824 | // C sees this as -3426, don't understand why. |
825 | // J and K just bail. | |
826 | 3426 3426 CHK | |
2ca993e8 | 827 | 3426+ 3426 |
0f5d89e8 A |
828 | // J bails; C and K see -34 |
829 | 34 d1+ 34 CHK | |
2ca993e8 | 830 | // JDK sees this as -1234 for some reason |
0f5d89e8 | 831 | // H bails b/c of trailing separators |
2ca993e8 | 832 | // C parses until trailing separators, but sees -1234 |
0f5d89e8 | 833 | 1,234,,,+ 1234 CHK |
2ca993e8 | 834 | 1,234- -1234 |
0f5d89e8 A |
835 | // H and P bail because of trailing separators |
836 | 1,234,- -1234 HJP | |
2ca993e8 | 837 | // J bails here too |
0f5d89e8 | 838 | 1234 - -1234 H |
2ca993e8 A |
839 | |
840 | ||
841 | ||
842 | test parse strict | |
843 | set locale en | |
0f5d89e8 | 844 | set pattern +#,##,##0.0###;(#) |
2ca993e8 | 845 | set lenient 0 |
0f5d89e8 | 846 | set minGroupingDigits 2 |
2ca993e8 A |
847 | begin |
848 | parse output breaks | |
849 | +123d5 123 | |
850 | +5347.25 5347.25 | |
851 | // separators in wrong place cause failure, no separators ok. | |
0f5d89e8 A |
852 | +65,347.25 65347.25 |
853 | (65347.25) -65347.25 | |
854 | (65,347.25) -65347.25 | |
2ca993e8 A |
855 | // JDK does allow separators in the wrong place and parses as -5347.25 |
856 | (53,47.25) fail K | |
0f5d89e8 A |
857 | // strict requires prefix or suffix, except in C |
858 | 65,347.25 fail | |
2ca993e8 A |
859 | +3.52E4 35200 |
860 | (34.8E-3) -0.0348 | |
861 | (3425E-1) -342.5 | |
862 | // Strict doesn't allow separators in sci notation. | |
0f5d89e8 A |
863 | (63,425) -63425 |
864 | // H does not allow grouping separators in scientific notation. | |
865 | (63,425E-1) -6342.5 H | |
2ca993e8 A |
866 | // Both prefix and suffix needed for strict. |
867 | // JDK accepts this and parses as -342.5 | |
868 | (3425E-1 fail K | |
869 | +3.52EE4 3.52 | |
0f5d89e8 | 870 | +12,34,567.8901 1234567.8901 |
2ca993e8 A |
871 | // With strict digit separators don't have to be the right type |
872 | // JDK doesn't acknowledge space as a separator | |
0f5d89e8 | 873 | +12 34 567.8901 1234567.8901 K |
2ca993e8 A |
874 | // In general the grouping separators have to match their expected |
875 | // location exactly. The only exception is when string being parsed | |
876 | // have no separators at all. | |
0f5d89e8 A |
877 | +12,345.67 12345.67 |
878 | // JDK doesn't require separators to be in the right place. | |
2ca993e8 | 879 | +1,23,4567.8901 fail K |
0f5d89e8 | 880 | +1,234,567.8901 fail K |
2ca993e8 A |
881 | +1234,567.8901 fail K |
882 | +1,234567.8901 fail K | |
883 | +1234567.8901 1234567.8901 | |
0f5d89e8 A |
884 | // Minimum grouping is not satisfied below, but that's ok |
885 | // because minimum grouping is optional. | |
886 | +1,234.5 1234.5 | |
2ca993e8 | 887 | // Comma after decimal means parse to a comma |
0f5d89e8 A |
888 | +1,23,456.78,9 123456.78 |
889 | // C and H fail upon seeing the second decimal point | |
890 | +1,23,456.78.9 123456.78 CH | |
2ca993e8 A |
891 | +79 79 |
892 | +79 79 | |
893 | + 79 fail | |
894 | // JDK parses as -1945 | |
895 | (1,945d1) fail K | |
896 | ||
0f5d89e8 A |
897 | test parse strict scientific |
898 | // See #13737: Old behavior should be retained in this case | |
899 | set locale en | |
900 | set pattern #E0 | |
901 | set lenient 0 | |
902 | begin | |
903 | parse output breaks | |
904 | 123 123 | |
905 | 123E1 1230 | |
906 | 123E0 123 | |
907 | 123E 123 | |
908 | ||
909 | test parse strict without prefix/suffix | |
910 | set locale en | |
911 | set pattern # | |
912 | set lenient 0 | |
913 | begin | |
914 | parse output breaks | |
915 | 12.34 12.34 | |
916 | -12.34 -12.34 | |
917 | // The following case passes only when setSignAlwaysShown is enabled | |
918 | +12.34 fail | |
919 | $12.34 fail | |
920 | ||
2ca993e8 A |
921 | test parse integer only |
922 | set locale en | |
923 | set pattern 0.00 | |
924 | set parseIntegerOnly 1 | |
925 | begin | |
926 | parse output breaks | |
927 | 35 35 | |
0f5d89e8 A |
928 | // S accepts leading plus signs |
929 | +35 35 CHK | |
2ca993e8 A |
930 | -35 -35 |
931 | 2.63 2 | |
932 | -39.99 -39 | |
933 | ||
934 | test parse no exponent flag | |
935 | set pattern 0 | |
936 | set locale en | |
937 | begin | |
938 | parseNoExponent parse output breaks | |
939 | // JDK doesn't allow lowercase exponent but ICU4J and ICU4C do. | |
940 | 0 5e2 500 K | |
941 | 0 5.3E2 530 | |
942 | // See ticket 11725 | |
0f5d89e8 A |
943 | 1 5e2 5 H |
944 | 1 5.3E2 5.3 HK | |
2ca993e8 A |
945 | |
946 | test parse currency fail | |
947 | set pattern 0 | |
948 | set locale en | |
949 | begin | |
950 | parse output outputCurrency breaks | |
0f5d89e8 A |
951 | // Fixed in ticket 11735 |
952 | 53.45 fail USD | |
2ca993e8 A |
953 | |
954 | test parse strange prefix | |
955 | set locale en | |
956 | set positivePrefix dd | |
957 | set negativePrefix ddd | |
958 | begin | |
959 | parse output | |
960 | dd4582 4582 | |
961 | ddd4582 -4582 | |
962 | ||
963 | test parse strange suffix | |
964 | set locale en | |
965 | set positiveSuffix dd | |
966 | set negativePrefix | |
967 | set negativeSuffix ddd | |
968 | begin | |
969 | parse output | |
970 | 4582dd 4582 | |
971 | 4582ddd -4582 | |
972 | ||
973 | test really strange suffix | |
974 | set locale en | |
975 | set positiveSuffix 9K | |
976 | set negativePrefix | |
977 | set negativeSuffix 9N | |
978 | begin | |
979 | parse output breaks | |
0f5d89e8 A |
980 | // A non-greedy parse is required to pass these cases. |
981 | // All of the implementations being tested are greedy. | |
982 | 6549K 654 CHJKP | |
983 | 6549N -654 CHJKP | |
2ca993e8 A |
984 | |
985 | test really strange prefix | |
986 | set locale en | |
987 | set positivePrefix 82 | |
988 | set negativePrefix 28 | |
989 | begin | |
990 | parse output | |
991 | 8245 45 | |
992 | 2845 -45 | |
993 | ||
0f5d89e8 A |
994 | test parse pattern with quotes |
995 | set locale en | |
996 | set pattern '-'#y | |
997 | begin | |
998 | parse output breaks | |
999 | -45y 45 | |
1000 | ||
1001 | test parse with locale symbols | |
1002 | // The grouping separator in it_CH is an apostrophe | |
1003 | set locale it_CH | |
1004 | set pattern #,##0 | |
1005 | begin | |
1006 | parse output breaks | |
1007 | १३ 13 | |
1008 | १३.३१ 13.31 | |
1009 | 123'456 123456 | |
1010 | 524'11.3 52411.3 | |
1011 | ३'११ 311 | |
1012 | ||
1013 | test parse with European-style comma/period | |
1014 | set locale pt | |
1015 | set pattern #,##0 | |
1016 | begin | |
1017 | parse output breaks | |
1018 | 123.456 123456 | |
1019 | 123,456 123.456 | |
1020 | 987,654.321 987.654 | |
1021 | 987,654 321 987.654 | |
1022 | 987.654,321 987654.321 | |
1023 | ||
2ca993e8 A |
1024 | test select |
1025 | set locale sr | |
1026 | begin | |
1027 | format pattern plural | |
1028 | Inf 0 other | |
1029 | -Inf 0 other | |
1030 | NaN 0 other | |
1031 | Inf 0.0 other | |
1032 | -Inf 0.0 other | |
1033 | NaN 0.0 other | |
1034 | 1 0 one | |
1035 | 1 0.0 other | |
1036 | 2 0 few | |
1037 | 2 0.0 other | |
1038 | 2 0E0 other | |
1039 | 5.1 0.0 one | |
1040 | 5.09 0.0 one | |
1041 | ||
1042 | test parse currency ISO | |
1043 | set pattern 0.00 \u00a4\u00a4;(#) \u00a4\u00a4 | |
0f5d89e8 | 1044 | set locale en_GB |
2ca993e8 A |
1045 | begin |
1046 | parse output outputCurrency breaks | |
0f5d89e8 A |
1047 | 53.45 fail GBP |
1048 | £53.45 53.45 GBP | |
1049 | $53.45 fail USD J | |
2ca993e8 | 1050 | 53.45 USD 53.45 USD |
0f5d89e8 A |
1051 | 53.45 GBP 53.45 GBP |
1052 | USD 53.45 53.45 USD H | |
1053 | 53.45USD 53.45 USD CH | |
2ca993e8 A |
1054 | USD53.45 53.45 USD |
1055 | (7.92) USD -7.92 USD | |
0f5d89e8 | 1056 | (7.92) GBP -7.92 GBP |
2ca993e8 | 1057 | (7.926) USD -7.926 USD |
0f5d89e8 A |
1058 | (7.926 USD) -7.926 USD CH |
1059 | (USD 7.926) -7.926 USD CH | |
1060 | USD (7.926) -7.926 USD CH | |
1061 | USD (7.92) -7.92 USD CH | |
1062 | (7.92)USD -7.92 USD CH | |
1063 | USD(7.92) -7.92 USD CH | |
2ca993e8 | 1064 | (8) USD -8 USD |
0f5d89e8 | 1065 | -8 USD -8 USD C |
2ca993e8 A |
1066 | 67 USD 67 USD |
1067 | 53.45$ fail USD | |
0f5d89e8 | 1068 | US Dollars 53.45 53.45 USD H |
2ca993e8 | 1069 | 53.45 US Dollars 53.45 USD |
0f5d89e8 | 1070 | US Dollar 53.45 53.45 USD H |
2ca993e8 A |
1071 | 53.45 US Dollar 53.45 USD |
1072 | US Dollars53.45 53.45 USD | |
0f5d89e8 | 1073 | 53.45US Dollars 53.45 USD CH |
2ca993e8 A |
1074 | US Dollar53.45 53.45 USD |
1075 | US Dollat53.45 fail USD | |
0f5d89e8 A |
1076 | 53.45US Dollar 53.45 USD CH |
1077 | US Dollars (53.45) -53.45 USD CH | |
2ca993e8 | 1078 | (53.45) US Dollars -53.45 USD |
0f5d89e8 A |
1079 | (53.45) Euros -53.45 EUR |
1080 | US Dollar (53.45) -53.45 USD CH | |
2ca993e8 | 1081 | (53.45) US Dollar -53.45 USD |
0f5d89e8 A |
1082 | US Dollars(53.45) -53.45 USD CH |
1083 | (53.45)US Dollars -53.45 USD CH | |
1084 | US Dollar(53.45) -53.45 USD CH | |
2ca993e8 | 1085 | US Dollat(53.45) fail USD |
0f5d89e8 | 1086 | (53.45)US Dollar -53.45 USD CH |
2ca993e8 A |
1087 | |
1088 | ||
1089 | test parse currency ISO negative | |
1090 | set pattern 0.00 \u00a4\u00a4;-# \u00a4\u00a4 | |
0f5d89e8 | 1091 | set locale en_GB |
2ca993e8 A |
1092 | begin |
1093 | parse output outputCurrency breaks | |
0f5d89e8 A |
1094 | 53.45 fail GBP |
1095 | £53.45 53.45 GBP | |
1096 | $53.45 fail USD J | |
2ca993e8 | 1097 | 53.45 USD 53.45 USD |
0f5d89e8 A |
1098 | 53.45 GBP 53.45 GBP |
1099 | USD 53.45 53.45 USD H | |
1100 | 53.45USD 53.45 USD CH | |
2ca993e8 A |
1101 | USD53.45 53.45 USD |
1102 | -7.92 USD -7.92 USD | |
0f5d89e8 | 1103 | -7.92 GBP -7.92 GBP |
2ca993e8 | 1104 | -7.926 USD -7.926 USD |
0f5d89e8 A |
1105 | USD -7.926 -7.926 USD CH |
1106 | -7.92USD -7.92 USD CH | |
1107 | USD-7.92 -7.92 USD CH | |
2ca993e8 A |
1108 | -8 USD -8 USD |
1109 | 67 USD 67 USD | |
0f5d89e8 A |
1110 | 53.45$ 53.45 USD CH |
1111 | US Dollars 53.45 53.45 USD H | |
2ca993e8 | 1112 | 53.45 US Dollars 53.45 USD |
0f5d89e8 | 1113 | US Dollar 53.45 53.45 USD H |
2ca993e8 A |
1114 | 53.45 US Dollar 53.45 USD |
1115 | US Dollars53.45 53.45 USD | |
0f5d89e8 | 1116 | 53.45US Dollars 53.45 USD CH |
2ca993e8 A |
1117 | US Dollar53.45 53.45 USD |
1118 | US Dollat53.45 fail USD | |
0f5d89e8 | 1119 | 53.45US Dollar 53.45 USD CH |
2ca993e8 A |
1120 | |
1121 | ||
1122 | test parse currency long | |
1123 | set pattern 0.00 \u00a4\u00a4\u00a4;(#) \u00a4\u00a4\u00a4 | |
0f5d89e8 | 1124 | set locale en_GB |
2ca993e8 A |
1125 | begin |
1126 | parse output outputCurrency breaks | |
0f5d89e8 A |
1127 | // H throws a NullPointerException on the first case |
1128 | 53.45 fail GBP | |
1129 | £53.45 53.45 GBP | |
1130 | $53.45 fail USD J | |
2ca993e8 | 1131 | 53.45 USD 53.45 USD |
0f5d89e8 A |
1132 | 53.45 GBP 53.45 GBP |
1133 | USD 53.45 53.45 USD H | |
1134 | 53.45USD 53.45 USD CH | |
2ca993e8 A |
1135 | USD53.45 53.45 USD |
1136 | (7.92) USD -7.92 USD | |
0f5d89e8 | 1137 | (7.92) GBP -7.92 GBP |
2ca993e8 | 1138 | (7.926) USD -7.926 USD |
0f5d89e8 A |
1139 | (7.926 USD) -7.926 USD CH |
1140 | (USD 7.926) -7.926 USD CH | |
1141 | USD (7.926) -7.926 USD CH | |
1142 | USD (7.92) -7.92 USD CH | |
1143 | (7.92)USD -7.92 USD CH | |
1144 | USD(7.92) -7.92 USD CH | |
2ca993e8 | 1145 | (8) USD -8 USD |
0f5d89e8 | 1146 | -8 USD -8 USD C |
2ca993e8 | 1147 | 67 USD 67 USD |
0f5d89e8 A |
1148 | // H throws a NullPointerException on the next case |
1149 | 53.45$ 53.45 USD CH | |
1150 | US Dollars 53.45 53.45 USD H | |
2ca993e8 | 1151 | 53.45 US Dollars 53.45 USD |
0f5d89e8 | 1152 | US Dollar 53.45 53.45 USD H |
2ca993e8 A |
1153 | 53.45 US Dollar 53.45 USD |
1154 | US Dollars53.45 53.45 USD | |
0f5d89e8 | 1155 | 53.45US Dollars 53.45 USD CH |
2ca993e8 A |
1156 | US Dollar53.45 53.45 USD |
1157 | US Dollat53.45 fail USD | |
0f5d89e8 | 1158 | 53.45US Dollar 53.45 USD CH |
2ca993e8 A |
1159 | |
1160 | ||
1161 | test parse currency short | |
1162 | set pattern 0.00 \u00a4;(#) \u00a4 | |
0f5d89e8 | 1163 | set locale en_GB |
2ca993e8 A |
1164 | begin |
1165 | parse output outputCurrency breaks | |
0f5d89e8 A |
1166 | 53.45 fail GBP |
1167 | £53.45 53.45 GBP | |
1168 | $53.45 fail USD J | |
2ca993e8 | 1169 | 53.45 USD 53.45 USD |
0f5d89e8 A |
1170 | 53.45 GBP 53.45 GBP |
1171 | USD 53.45 53.45 USD H | |
1172 | 53.45USD 53.45 USD CH | |
2ca993e8 A |
1173 | USD53.45 53.45 USD |
1174 | (7.92) USD -7.92 USD | |
0f5d89e8 | 1175 | (7.92) GBP -7.92 GBP |
2ca993e8 | 1176 | (7.926) USD -7.926 USD |
0f5d89e8 A |
1177 | (7.926 USD) -7.926 USD CH |
1178 | (USD 7.926) -7.926 USD CH | |
1179 | USD (7.926) -7.926 USD CH | |
1180 | USD (7.92) -7.92 USD CH | |
1181 | (7.92)USD -7.92 USD CH | |
1182 | USD(7.92) -7.92 USD CH | |
2ca993e8 | 1183 | (8) USD -8 USD |
0f5d89e8 | 1184 | -8 USD -8 USD C |
2ca993e8 | 1185 | 67 USD 67 USD |
0f5d89e8 A |
1186 | 53.45$ 53.45 USD CH |
1187 | US Dollars 53.45 53.45 USD H | |
2ca993e8 | 1188 | 53.45 US Dollars 53.45 USD |
0f5d89e8 | 1189 | US Dollar 53.45 53.45 USD H |
2ca993e8 A |
1190 | 53.45 US Dollar 53.45 USD |
1191 | US Dollars53.45 53.45 USD | |
0f5d89e8 | 1192 | 53.45US Dollars 53.45 USD CH |
2ca993e8 A |
1193 | US Dollar53.45 53.45 USD |
1194 | US Dollat53.45 fail USD | |
0f5d89e8 | 1195 | 53.45US Dollar 53.45 USD CH |
2ca993e8 A |
1196 | |
1197 | ||
1198 | test parse currency short prefix | |
1199 | set pattern \u00a40.00;(\u00a4#) | |
0f5d89e8 | 1200 | set locale en_GB |
2ca993e8 A |
1201 | begin |
1202 | parse output outputCurrency breaks | |
0f5d89e8 A |
1203 | 53.45 fail GBP |
1204 | £53.45 53.45 GBP | |
1205 | $53.45 fail USD J | |
1206 | 53.45 USD 53.45 USD C | |
1207 | 53.45 GBP 53.45 GBP C | |
1208 | USD 53.45 53.45 USD H | |
1209 | 53.45USD 53.45 USD CH | |
2ca993e8 | 1210 | USD53.45 53.45 USD |
0f5d89e8 A |
1211 | // C and P fail these because '(' is an incomplete prefix. |
1212 | (7.92) USD -7.92 USD CHJP | |
1213 | (7.92) GBP -7.92 GBP CHJP | |
1214 | (7.926) USD -7.926 USD CHJP | |
1215 | (7.926 USD) -7.926 USD CHJP | |
1216 | (USD 7.926) -7.926 USD H | |
1217 | USD (7.926) -7.926 USD CHJP | |
1218 | USD (7.92) -7.92 USD CHJP | |
1219 | (7.92)USD -7.92 USD CHJP | |
1220 | USD(7.92) -7.92 USD CHJP | |
1221 | (8) USD -8 USD CHJP | |
1222 | -8 USD -8 USD C | |
1223 | 67 USD 67 USD C | |
1224 | 53.45$ 53.45 USD CH | |
1225 | US Dollars 53.45 53.45 USD H | |
2ca993e8 | 1226 | 53.45 US Dollars 53.45 USD |
0f5d89e8 | 1227 | US Dollar 53.45 53.45 USD H |
2ca993e8 A |
1228 | 53.45 US Dollar 53.45 USD |
1229 | US Dollars53.45 53.45 USD | |
0f5d89e8 | 1230 | 53.45US Dollars 53.45 USD CH |
2ca993e8 | 1231 | US Dollar53.45 53.45 USD |
0f5d89e8 | 1232 | 53.45US Dollar 53.45 USD CH |
2ca993e8 A |
1233 | |
1234 | test format foreign currency | |
1235 | set locale fa_IR | |
0f5d89e8 | 1236 | set currency IRR |
2ca993e8 A |
1237 | begin |
1238 | pattern format output breaks | |
1239 | \u00a4\u00a4\u00a4 0.00;\u00a4\u00a4\u00a4 # 1235 \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 K | |
1240 | \u00a4\u00a4 0.00;\u00a4\u00a4 -# 1235 IRR \u06F1\u06F2\u06F3\u06F5 K | |
1241 | \u00a4 0.00;\u00a4 -# 1235 \u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 K | |
1242 | ||
1243 | test parse foreign currency symbol | |
1244 | set pattern \u00a4 0.00;\u00a4 -# | |
1245 | set locale fa_IR | |
1246 | begin | |
0f5d89e8 | 1247 | parse output outputCurrency breaks |
2ca993e8 A |
1248 | \u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 1235 IRR |
1249 | IRR \u06F1\u06F2\u06F3\u06F5 1235 IRR | |
0f5d89e8 A |
1250 | // P fails here because this currency name is in the Trie only, but it has the same prefix as the non-Trie currency |
1251 | \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR JP | |
2ca993e8 A |
1252 | IRR 1235 1235 IRR |
1253 | \u0631\u06cc\u0627\u0644 1235 1235 IRR | |
0f5d89e8 | 1254 | \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR JP |
2ca993e8 A |
1255 | |
1256 | test parse foreign currency ISO | |
1257 | set pattern \u00a4\u00a4 0.00;\u00a4\u00a4 -# | |
1258 | set locale fa_IR | |
1259 | begin | |
0f5d89e8 | 1260 | parse output outputCurrency breaks |
2ca993e8 A |
1261 | \u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 1235 IRR |
1262 | IRR \u06F1\u06F2\u06F3\u06F5 1235 IRR | |
0f5d89e8 | 1263 | \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR JP |
2ca993e8 A |
1264 | IRR 1235 1235 IRR |
1265 | \u0631\u06cc\u0627\u0644 1235 1235 IRR | |
0f5d89e8 | 1266 | \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR JP |
2ca993e8 A |
1267 | |
1268 | test parse foreign currency full | |
1269 | set pattern \u00a4\u00a4\u00a4 0.00;\u00a4\u00a4\u00a4 -# | |
1270 | set locale fa_IR | |
1271 | begin | |
0f5d89e8 | 1272 | parse output outputCurrency breaks |
2ca993e8 A |
1273 | \u0631\u06cc\u0627\u0644 \u06F1\u06F2\u06F3\u06F5 1235 IRR |
1274 | IRR \u06F1\u06F2\u06F3\u06F5 1235 IRR | |
0f5d89e8 | 1275 | \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 \u06F1\u06F2\u06F3\u06F5 1235 IRR JP |
2ca993e8 A |
1276 | IRR 1235 1235 IRR |
1277 | \u0631\u06cc\u0627\u0644 1235 1235 IRR | |
0f5d89e8 | 1278 | \u0631\u06cc\u0627\u0644 \u0627\u06cc\u0631\u0627\u0646 1235 1235 IRR JP |
2ca993e8 A |
1279 | |
1280 | test parse currency with foreign symbols symbol english | |
1281 | set pattern \u00a4 0.00;\u00a4 (#) | |
1282 | set locale en_US | |
1283 | begin | |
1284 | parse output outputCurrency | |
1285 | EUR 7.82 7.82 EUR | |
1286 | \u20ac 7.82 7.82 EUR | |
1287 | Euro 7.82 7.82 EUR | |
1288 | Euros 7.82 7.82 EUR | |
1289 | ||
1290 | test parse currency with foreign symbols ISO english | |
1291 | set pattern \u00a4\u00a4 0.00;\u00a4\u00a4 (#) | |
1292 | set locale en_US | |
1293 | begin | |
1294 | parse output outputCurrency | |
1295 | EUR 7.82 7.82 EUR | |
1296 | \u20ac 7.82 7.82 EUR | |
1297 | Euro 7.82 7.82 EUR | |
1298 | Euros 7.82 7.82 EUR | |
1299 | ||
1300 | test parse currency with foreign symbols full english | |
1301 | set pattern \u00a4\u00a4\u00a4 0.00;\u00a4\u00a4\u00a4 (#) | |
1302 | set locale en_US | |
1303 | begin | |
1304 | parse output outputCurrency | |
1305 | EUR 7.82 7.82 EUR | |
1306 | \u20ac 7.82 7.82 EUR | |
1307 | Euro 7.82 7.82 EUR | |
1308 | Euros 7.82 7.82 EUR | |
1309 | ||
0f5d89e8 A |
1310 | test parse currency without currency mode |
1311 | // Should accept a symbol associated with the currency specified by the API, | |
1312 | // but should not traverse the full currency data. | |
1313 | set locale en_US | |
1314 | set pattern \u00a4#,##0.00 | |
1315 | begin | |
1316 | parse currency output breaks | |
1317 | $52.41 USD 52.41 | |
1318 | USD52.41 USD 52.41 K | |
1319 | \u20ac52.41 USD fail | |
1320 | EUR52.41 USD fail | |
1321 | $52.41 EUR fail | |
1322 | USD52.41 EUR fail | |
1323 | \u20ac52.41 EUR 52.41 K | |
1324 | EUR52.41 EUR 52.41 | |
1325 | ||
2ca993e8 A |
1326 | test parse currency ISO strict |
1327 | set pattern 0.00 \u00a4\u00a4;(#) \u00a4\u00a4 | |
1328 | set locale en_US | |
1329 | set lenient 0 | |
1330 | begin | |
1331 | parse output outputCurrency breaks | |
0f5d89e8 | 1332 | $53.45 53.45 USD JP |
2ca993e8 A |
1333 | 53.45 USD 53.45 USD |
1334 | USD 53.45 fail USD | |
1335 | 53.45USD fail USD | |
0f5d89e8 | 1336 | USD53.45 53.45 USD JP |
2ca993e8 A |
1337 | (7.92) USD -7.92 USD |
1338 | (7.92) EUR -7.92 EUR | |
1339 | (7.926) USD -7.926 USD | |
1340 | (7.926 USD) fail USD | |
1341 | (USD 7.926) fail USD | |
1342 | USD (7.926) fail USD | |
1343 | USD (7.92) fail USD | |
1344 | (7.92)USD fail USD | |
1345 | USD(7.92) fail USD | |
1346 | (8) USD -8 USD | |
0f5d89e8 | 1347 | -8 USD fail USD H |
2ca993e8 A |
1348 | 67 USD 67 USD |
1349 | 53.45$ fail USD | |
1350 | US Dollars 53.45 fail USD | |
1351 | 53.45 US Dollars 53.45 USD | |
1352 | US Dollar 53.45 fail USD | |
1353 | 53.45 US Dollar 53.45 USD | |
0f5d89e8 | 1354 | US Dollars53.45 53.45 USD JP |
2ca993e8 | 1355 | 53.45US Dollars fail USD |
0f5d89e8 | 1356 | US Dollar53.45 53.45 USD JP |
2ca993e8 A |
1357 | US Dollat53.45 fail USD |
1358 | 53.45US Dollar fail USD | |
1359 | US Dollars (53.45) fail USD | |
1360 | (53.45) US Dollars -53.45 USD | |
1361 | US Dollar (53.45) fail USD | |
1362 | (53.45) US Dollar -53.45 USD | |
1363 | US Dollars(53.45) fail USD | |
1364 | (53.45)US Dollars fail USD | |
1365 | US Dollar(53.45) fail USD | |
1366 | US Dollat(53.45) fail USD | |
1367 | (53.45)US Dollar fail USD | |
1368 | ||
1369 | test ticket 10436 | |
1370 | set locale en | |
1371 | set roundingMode ceiling | |
1372 | set minFractionDigits 0 | |
1373 | set maxFractionDigits 0 | |
1374 | begin | |
1375 | format output breaks | |
0f5d89e8 A |
1376 | -0.99 -0 HK |
1377 | ||
1378 | test parse decimalPatternMatchRequired | |
1379 | set locale en | |
1380 | set decimalPatternMatchRequired 1 | |
1381 | begin | |
1382 | pattern parse output breaks | |
1383 | // K doesn't support this feature. | |
1384 | 0 123 123 | |
1385 | 0 123. fail CHK | |
1386 | 0 1.23 fail CHK | |
1387 | 0 -513 -513 | |
1388 | 0 -513. fail CHK | |
1389 | 0 -5.13 fail CHK | |
1390 | 0.0 123 fail K | |
1391 | 0.0 123. 123 C | |
1392 | 0.0 1.23 1.23 C | |
1393 | 0.0 -513 fail K | |
1394 | 0.0 -513. -513 | |
1395 | 0.0 -5.13 -5.13 | |
1396 | ||
1397 | test parse minus sign | |
1398 | set locale en | |
1399 | set pattern # | |
1400 | begin | |
1401 | pattern parse output breaks | |
1402 | # -123 -123 | |
1403 | # - 123 -123 HK | |
1404 | # -123 -123 HK | |
1405 | # - 123 -123 HK | |
1406 | # 123- 123 | |
1407 | # 123 - 123 | |
1408 | #;#- 123- -123 | |
1409 | #;#- 123 - -123 HK | |
1410 | ||
1411 | test parse case sensitive | |
1412 | set locale en | |
1413 | set lenient 1 | |
1414 | set pattern Aa# | |
1415 | begin | |
1416 | parse parseCaseSensitive output breaks | |
1417 | Aa1.23 1 1.23 | |
1418 | Aa1.23 0 1.23 | |
1419 | AA1.23 1 fail | |
1420 | // H and K do not support case-insensitive parsing for prefix/suffix. | |
1421 | // H supports it for the exponent separator, but not K. | |
1422 | AA1.23 0 1.23 CHK | |
1423 | aa1.23 1 fail | |
1424 | aa1.23 0 1.23 CHK | |
1425 | Aa1.23E3 1 1230 | |
1426 | Aa1.23E3 0 1230 | |
1427 | Aa1.23e3 1 1.23 CH | |
1428 | Aa1.23e3 0 1230 K | |
1429 | NaN 1 NaN K | |
1430 | NaN 0 NaN K | |
1431 | nan 1 fail | |
1432 | nan 0 NaN CHK | |
1433 | ||
1434 | test parse infinity and scientific notation overflow | |
1435 | set locale en | |
1436 | set lenient 1 | |
1437 | begin | |
1438 | parse output breaks | |
1439 | NaN NaN K | |
1440 | // JDK returns zero | |
1441 | 1E999999999999999 Inf K | |
1442 | -1E999999999999999 -Inf K | |
1443 | 1E-99999999999999 0.0 | |
1444 | // Note: The test suite code doesn't properly check for 0.0 vs. -0.0 | |
1445 | -1E-99999999999999 -0.0 | |
1446 | 1E2147483648 Inf K | |
1447 | 1E2147483647 Inf K | |
1448 | // H, J and K get Infinity | |
1449 | 1E2147483646 1E+2147483646 HJK | |
1450 | 1E-2147483649 0 | |
1451 | 1E-2147483648 0 | |
1452 | // H and K return zero here | |
1453 | 1E-2147483647 1E-2147483647 HJK | |
1454 | 1E-2147483646 1E-2147483646 HJK | |
1455 | ||
1456 | test format push limits | |
1457 | set locale en | |
1458 | set minFractionDigits 2 | |
1459 | set roundingMode halfDown | |
1460 | begin | |
1461 | maxFractionDigits format output breaks | |
1462 | 100 987654321987654321 987654321987654321.00 | |
1463 | 100 987654321.987654321 987654321.987654321 | |
1464 | 100 9999999999999.9950000000001 9999999999999.9950000000001 | |
1465 | 2 9999999999999.9950000000001 10000000000000.00 | |
1466 | 2 9999999.99499999 9999999.99 | |
1467 | // K doesn't support halfDown rounding mode? | |
1468 | 2 9999999.995 9999999.99 K | |
1469 | 2 9999999.99500001 10000000.00 | |
1470 | 100 56565656565656565656565656565656565656565656565656565656565656 56565656565656565656565656565656565656565656565656565656565656.00 | |
1471 | 100 454545454545454545454545454545.454545454545454545454545454545 454545454545454545454545454545.454545454545454545454545454545 | |
1472 | 100 0.0000000000000000000123 0.0000000000000000000123 | |
1473 | 100 -78787878787878787878787878787878 -78787878787878787878787878787878.00 | |
1474 | 100 -8989898989898989898989.8989898989898989 -8989898989898989898989.8989898989898989 | |
1475 | ||
1476 | test ticket 11230 | |
1477 | set locale en | |
1478 | begin | |
1479 | pattern lenient parse output breaks | |
1480 | // Groups after the first group need 2 digits to be accepted. | |
1481 | // JDK does not see space as grouping and parses most of these as 9. | |
1482 | #,##0 1 9 9 9 CH | |
1483 | #,##0 1 9 99 999 K | |
1484 | #,##0 1 9 999 9999 K | |
1485 | #,##0 1 9 9 9 9 CH | |
1486 | #,##0 1 ,9 9 | |
1487 | #,##0 1 99,.0 99 | |
1488 | #,##0 1 9 9. 9 CH | |
1489 | #,##0 1 9 99. 999 K | |
1490 | 0 1 9 9 9 | |
1491 | 0 1 9 99 9 | |
1492 | 0 1 9 999 9 | |
1493 | 0 1 9 9 9 9 | |
1494 | 0 1 ,9 fail | |
1495 | 0 1 99,.0 99 | |
1496 | 0 1 9 9. 9 | |
1497 | 0 1 9 99. 9 | |
1498 | #,##0 0 9 9 fail K | |
1499 | #,##0 0 9 99 fail K | |
1500 | #,##0 0 9 999 9999 K | |
1501 | #,##0 0 9 9 9 fail K | |
1502 | #,##0 0 ,9 fail K | |
1503 | #,##0 0 99,.0 fail K | |
1504 | #,##0 0 9 9. fail K | |
1505 | #,##0 0 9 99. fail K | |
1506 | 0 0 9 9 9 | |
1507 | 0 0 9 99 9 | |
1508 | 0 0 9 999 9 | |
1509 | 0 0 9 9 9 9 | |
1510 | 0 0 ,9 fail | |
1511 | 0 0 99,.0 99 | |
1512 | 0 0 9 9. 9 | |
1513 | 0 0 9 99. 9 | |
1514 | ||
1515 | test more strict grouping parse | |
1516 | set locale en | |
1517 | set pattern #,##,##0 | |
1518 | begin | |
1519 | lenient parse output breaks | |
1520 | 1 1,23,, 123 | |
1521 | 0 9999, 9999 | |
1522 | 0 1,23,, fail K | |
1523 | ||
1524 | test parse ignorables | |
1525 | set locale ar | |
1526 | // Note: Prefixes contain RLMs, as do some of the test cases. | |
1527 | set pattern x ab0c df | |
1528 | set negativePrefix y gh | |
1529 | set negativeSuffix i jk | |
1530 | begin | |
1531 | parse output breaks | |
1532 | x ab56c df 56 | |
1533 | x ab56c df 56 K | |
1534 | x ab56c df 56 K | |
1535 | x ab56c df 56 HK | |
1536 | x ab56c df 56 K | |
1537 | x ab56 56 HK | |
1538 | x a b56 56 HK | |
1539 | 56cdf 56 HK | |
1540 | 56c df 56 HK | |
1541 | 56cd f 56 HK | |
1542 | 56cdf 56 HK | |
1543 | 56cdf 56 HK | |
1544 | 56c df 56 HK | |
1545 | 56c df 56 HK | |
1546 | y gh56i jk -56 | |
1547 | y gh56i jk -56 K | |
1548 | y gh56i jk -56 K | |
1549 | y gh56i jk -56 HK | |
1550 | y gh56i jk -56 K | |
1551 | y gh56 -56 HK | |
1552 | y g h56 -56 HK | |
1553 | // S stops parsing after the 'i' for these and returns -56 | |
1554 | // C stops before the 'i' and gets 56 | |
1555 | 56ijk -56 CHK | |
1556 | 56i jk -56 CHK | |
1557 | 56ij k -56 CHK | |
1558 | 56ijk -56 CHK | |
1559 | 56ijk -56 CHK | |
1560 | 56i jk -56 CHK | |
1561 | 56i jk -56 CHK | |
1562 | // S and C get 56 (accepts ' ' gs grouping); H and K get null | |
1563 | 5 6 fail CJP | |
1564 | 56 5 HK | |
1565 | ||
1566 | test parse spaces in grouping | |
1567 | // This test gives the ideal behavior of these cases, which | |
1568 | // none of the implementations currently support. | |
1569 | // Similar to the test above for ticket #11230 | |
1570 | set locale en | |
1571 | set pattern #,##0 | |
1572 | begin | |
1573 | parse output breaks | |
1574 | 1 2 1 CH | |
1575 | 1 23 123 K | |
1576 | // K gets 1 here; doesn't pick up the grouping separator | |
1577 | 1 234 1234 K | |
1578 | ||
1579 | test rounding increment significant digits | |
1580 | // This test is for #13111 | |
1581 | set locale en | |
1582 | set pattern 0.1 | |
1583 | set useSigDigits 1 | |
1584 | set maxSigDigits 2 | |
1585 | begin | |
1586 | format output breaks | |
1587 | // C and J get "1" | |
1588 | // P gets "1.0" | |
1589 | // K gets "1.1" (??) | |
1590 | 0.975 0.98 CHJKP | |
1591 | ||
1592 | test lenient parse currency match | |
1593 | // This test is for #13112 | |
1594 | set locale en | |
1595 | set pattern ¤#,##0.00 | |
1596 | begin | |
1597 | parse output breaks | |
1598 | // H and K get null | |
1599 | 1.23!@#$%^ 1.23 HK | |
1600 | ||
1601 | test percentage parsing multiplier | |
1602 | // This test is for #13114 | |
1603 | set locale en | |
1604 | set pattern 0% | |
1605 | begin | |
1606 | parse output breaks | |
1607 | 55% 0.55 | |
1608 | // H and K get null | |
1609 | // C and P scale by 100 even if the percent sign is not present | |
1610 | 55 0.55 HK | |
1611 | ||
1612 | test trailing grouping separators in pattern | |
1613 | // This test is for #13115 | |
1614 | set locale en | |
1615 | begin | |
1616 | pattern format output breaks | |
1617 | $0M 123456 $123456M | |
1618 | // The following patterns are rejected as malformed. | |
1619 | $0,M 123456 fail | |
1620 | $0,,M 123456 fail | |
1621 | ||
1622 | test empty negative subpattern | |
1623 | // This test is for #13117 | |
1624 | set locale en | |
1625 | begin | |
1626 | pattern format output breaks | |
1627 | 0 -15 -15 | |
1628 | 0; -15 -15 | |
1629 | // C, H and K still prepend a '-' even though the pattern says otherwise | |
1630 | 0;0 -15 15 CHK | |
1631 | ||
1632 | test percentage multiplier parsing | |
1633 | // This test is for #13129 | |
1634 | set locale en | |
1635 | set pattern 0% | |
1636 | begin | |
1637 | parse output breaks | |
1638 | 9223372036854775807% 92233720368547758.07 K | |
1639 | ||
1640 | test sign always shown | |
1641 | set locale en | |
1642 | set pattern 0 | |
1643 | set signAlwaysShown 1 | |
1644 | begin | |
1645 | format output breaks | |
1646 | // C, H and K do not support this feature | |
1647 | 42 +42 CHK | |
1648 | 0 +0 CHK | |
1649 | -42 -42 | |
1650 | ||
1651 | test parse strict with plus sign | |
1652 | set locale en | |
1653 | set pattern 0 | |
1654 | set signAlwaysShown 1 | |
1655 | begin | |
1656 | lenient parse output breaks | |
1657 | 1 42 42 | |
1658 | 1 -42 -42 | |
1659 | 1 +42 42 CHK | |
1660 | 1 0 0 | |
1661 | 1 +0 0 CHK | |
1662 | 0 42 fail CHK | |
1663 | 0 -42 -42 | |
1664 | 0 +42 42 CHK | |
1665 | 0 0 fail CHK | |
1666 | 0 +0 0 CHK | |
1667 | ||
1668 | test parse with scientific-separator-affix overlap | |
1669 | set locale en | |
1670 | begin | |
1671 | pattern lenient parse output breaks | |
1672 | 0E0','x 1 5E3,x 5000 | |
1673 | 0E0','x 0 5E3,x 5000 | |
1674 | 0E0'.'x 1 5E3.x 5000 | |
1675 | 0E0'.'x 0 5E3.x 5000 | |
1676 | ||
1677 | test parse lowercase currency | |
1678 | set locale en | |
1679 | set pattern ¤¤0 | |
1680 | set currency USD | |
1681 | begin | |
1682 | parse output outputCurrency breaks | |
1683 | USD123 123 USD | |
1684 | USD 123 123 USD H | |
1685 | // C does not currently accept case-insensitive ISO codes | |
1686 | usd123 123 USD C | |
1687 | usd 123 123 USD CH | |
1688 | Usd123 123 USD C | |
1689 | Usd 123 123 USD CH | |
1690 | US$123 123 USD C | |
1691 | us$123 fail fail | |
1692 | Us$123 fail fail | |
1693 | 123 US dollars 123 USD | |
1694 | 123 US DOLLARS 123 USD | |
1695 | 123 us dollars 123 USD | |
1696 | ||
1697 | ||
1698 | ||
1699 | ||
1700 | ||
1701 | ||
1702 | ||
1703 | ||
1704 | ||
1705 | ||
1706 | ||
1707 | ||
1708 | ||
1709 | ||
1710 | ||
1711 | ||
1712 | ||
1713 | ||
1714 | ||
1715 | ||
1716 | ||
1717 | ||
1718 | ||
1719 | ||
1720 | ||
1721 | ||
1722 | ||
1723 | ||
1724 | ||
1725 | ||
1726 | ||
1727 | ||
1728 | ||
1729 | ||
1730 | ||
1731 | ||
1732 | ||
1733 | ||
1734 | ||
1735 | ||
1736 | ||
2ca993e8 | 1737 |