]>
Commit | Line | Data |
---|---|---|
729e4ab9 A |
1 | |
2 | # Note: Please make sure that this utf-8 file contains a BOM. | |
3 | # Copyright (c) 2010, International Business Machines Corporation and | |
4 | # others. All Rights Reserved. | |
5 | # | |
6 | ||
7 | # File: dcfmtest.txt | |
8 | # | |
9 | # Decimal formatter test cases. | |
10 | # File Encoding: UTF-8 | |
11 | # | |
12 | # The syntax for this file is this: | |
13 | # One test case per line. No continuations. No multiple cases per line. | |
14 | # | |
15 | # Parsing Test case line: | |
16 | # parse "input text" type "expected_decimal_text" | |
17 | # | |
18 | # Format Test Case Line: | |
19 | # format pattern round-mode "decimal number" "expected formatted result" | |
20 | # | |
21 | # Fields are separated by spaces or tabs. Input text to be parsed, decimal numbers | |
22 | # and formatted output are "quoted". Other fields are not. | |
23 | # | |
24 | # "type" is a single letter, representing the type that the ICU formattable produces | |
25 | # for the input. | |
26 | # d double | |
27 | # i int32 | |
28 | # l int64 | |
29 | # | |
30 | # RoundingMode is one of | |
31 | # default | |
32 | # ceiling | |
33 | # floor | |
34 | # down | |
35 | # up | |
36 | # halfeven | |
37 | # halfdown | |
38 | # halfup | |
39 | # | |
40 | ||
41 | parse "123.45" d "123.45" | |
42 | ||
43 | format 0.0000E0 default "1234.01" "1.2340E3" | |
44 | ||
45 | format 00 default "1234" "1234" | |
46 | format 00 default ".01" "00" | |
47 | format 00 default "1" "01" | |
48 | format 00 default "1.9" "02" | |
49 | ||
50 | format #.# default "12.34" "12.3" | |
51 | ||
52 | format @@@ default "12.3456" "12.3" | |
53 | format @@@ default "123456" "123000" | |
54 | format @@@ default ".00123456" "0.00123" | |
55 | ||
56 | format @@### default "12345678" "12346000" | |
57 | format @@### default "12300001" "12300000" | |
58 | format @@### default ".0012345678" "0.0012346" | |
59 | format @@### default ".0012300000" "0.00123" | |
60 | ||
61 | format @@@@E0 default "1234567" "1.235E6" | |
62 | format 0.0##E0 default "1234567" "1.235E6" | |
63 | format 00.##E0 default "1234567" "12.35E5" | |
64 | format 00.##E0 default "1234567E111" "12.35E116" | |
65 | format 00.##E0 default "-1234567E111" "-12.35E116" | |
66 | ||
67 | ||
68 | # | |
69 | # Rounding Modes | |
70 | # | |
71 | format 0.00 default "32.045" "32.04" | |
72 | format 0.00 floor "32.045" "32.04" | |
73 | format 0.00 ceiling "32.045" "32.05" | |
74 | format 0.00 down "32.045" "32.04" | |
75 | format 0.00 up "32.045" "32.05" | |
76 | format 0.00 halfeven "32.045" "32.04" | |
77 | format 0.00 halfdown "32.045" "32.04" | |
78 | format 0.00 halfup "32.045" "32.05" | |
79 | ||
80 | format 0.00 default "-32.045" "-32.04" | |
81 | format 0.00 floor "-32.045" "-32.05" | |
82 | format 0.00 ceiling "-32.045" "-32.04" | |
83 | format 0.00 down "-32.045" "-32.04" | |
84 | format 0.00 up "-32.045" "-32.05" | |
85 | format 0.00 halfeven "-32.045" "-32.04" | |
86 | format 0.00 halfdown "-32.045" "-32.04" | |
87 | format 0.00 halfup "-32.045" "-32.05" | |
88 | ||
89 | format @@@ default "1235.00" "1240" | |
90 | format @@@ floor "1235.00" "1230" | |
91 | format @@@ ceiling "1235.00" "1240" | |
92 | format @@@ down "1235.00" "1230" | |
93 | format @@@ up "1235.00" "1240" | |
94 | format @@@ halfeven "1235.00" "1240" | |
95 | format @@@ halfdown "1235.00" "1230" | |
96 | format @@@ halfup "1235.00" "1240" | |
97 | ||
98 | format @@@ default "-1235.00" "-1240" | |
99 | format @@@ floor "-1235.00" "-1240" | |
100 | format @@@ ceiling "-1235.00" "-1230" | |
101 | format @@@ down "-1235.00" "-1230" | |
102 | format @@@ up "-1235.00" "-1240" | |
103 | format @@@ halfeven "-1235.00" "-1240" | |
104 | format @@@ halfdown "-1235.00" "-1230" | |
105 | format @@@ halfup "-1235.00" "-1240" | |
106 | ||
107 | format 0.000E0 default "12345" "1.234E4" | |
108 | format 0.000E0 floor "12345" "1.234E4" | |
109 | format 0.000E0 ceiling "12345" "1.235E4" | |
110 | format 0.000E0 down "12345" "1.234E4" | |
111 | format 0.000E0 up "12345" "1.235E4" | |
112 | format 0.000E0 halfeven "12345" "1.234E4" | |
113 | format 0.000E0 halfdown "12345" "1.234E4" | |
114 | format 0.000E0 halfup "12345" "1.235E4" | |
115 | ||
116 | ||
117 | format 0.0## default "1.00001" "1.0" | |
118 | format 0.0## up "1.00001" "1.001" | |
119 | format 0.0## up "1.0000000000000000000000000000000000000000000000000001" "1.001" | |
120 | format 0.0## up "1.0000000000000000000000000000000000000000000000000000" "1.0" | |
121 | ||
122 | format # default "10000000000000000000000000000000000000000000000000001" "10000000000000000000000000000000000000000000000000001" | |
123 | ||
124 | format 0.#E0 default "1234" "1.2E3" | |
125 | format 0.##E0 default "1234" "1.23E3" | |
126 | format .0E0 default "1234" ".1E4" | |
127 | format .0#E0 default "1234" ".12E4" | |
128 | format 0.##E0 default "1234" "1.23E3" | |
129 |