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