2 * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
6 * STRFMON: size_t strfmon (char *buf, size_t nbyte, char *fmt, ... );
12 * The buffer size should be enough to contain a string including a
14 * Returns the number of bytes of the string (NOT including a null char).
17 TST_STRFMON tst_strfmon_loc
[] = {
19 { Tstrfmon
, TST_LOC_de
},
23 /*inp*/ { 24, "%n %% %i", 123.00 },
24 /*exp*/ { 0,1,23, "123,00 EUR % 123,00 EUR" },
28 /*inp*/ { 24, "%n %% %i", 123.00 },
29 /*exp*/ { 0,1,23, "123,00 EUR % 123,00 EUR" },
33 /*inp*/ { 23, "%n %% %i", 123.00 },
34 /*exp*/ { E2BIG
,1,-1, "" },
38 /*inp*/ { 31, "%n|%i", 1234.561 },
39 /*exp*/ { 0,1,25, "1.234,56 EUR|1.234,56 EUR"},
43 /*inp*/ { 33, "%n|%i", -1234.561 },
44 /*exp*/ { 0,1,27, "-1.234,56 EUR|-1.234,56 EUR"},
48 /*inp*/ { 33, "%13n|%12i", 1234.561 },
49 /*exp*/ { 0,1,26, " 1.234,56 EUR|1.234,56 EUR"},
53 /*inp*/ { 33, "%12n|%12i", -1234.561 },
54 /*exp*/ { 0,1,27, "-1.234,56 EUR|-1.234,56 EUR"},
58 /*inp*/ { 33, "%#5n|%#5i", 1234.561 },
59 /*exp*/ { 0,1,29, " 1.234,56 EUR| 1.234,56 EUR"},
63 /*inp*/ { 33, "%#5n|%#5i", -1234.561 },
64 /*exp*/ { 0,1,29, "- 1.234,56 EUR|- 1.234,56 EUR"},
68 /*inp*/ { 33, "%=*#5n|%=*#5i", 1234.561 },
69 /*exp*/ { 0,1,29, " *1.234,56 EUR| *1.234,56 EUR"},
73 /*inp*/ { 33, "%=0#5n|%=0#5i", -1234.561 },
74 /*exp*/ { 0,1,29, "-01.234,56 EUR|-01.234,56 EUR"},
78 /*inp*/ { 33, "%^#5n|%^#5i", -1234.561 },
79 /*exp*/ { 0,1,27, "- 1234,56 EUR|- 1234,56 EUR"},
83 /*inp*/ { 33, "%#5.0n|%#5.0i", 1234.444 },
84 /*exp*/ { 0,1,23, " 1.234 EUR| 1.234 EUR" },
88 /*inp*/ { 33, "%#5.0n|%#5.4i", -1234.555 },
89 /*exp*/ { 0,1,28, "- 1.235 EUR|- 1.234,5550 EUR"},
93 /*inp*/ { 33, "%(#5n|%!(#5i", -1234.561 },
94 /*exp*/ { 0,1,27, "( 1.234,56 EUR)|( 1.234,56)"},
100 { Tstrfmon
, TST_LOC_enUS
},
104 /*inp*/ { 22, "%n %% %i", 123.00 },
105 /*exp*/ { 0,1,20, "$123.00 % USD 123.00" },
109 /*inp*/ { 21, "%n %% %i", 123.00 },
110 /*exp*/ { 0,1,20, "$123.00 % USD 123.00" },
114 /*inp*/ { 20, "%n %% %i", 123.00 },
115 /*exp*/ { E2BIG
,1,-1, "" },
119 /*inp*/ { 30, "%n|%i", 1234.561 },
120 /*exp*/ { 0,1,22, "$1,234.56|USD 1,234.56" },
124 /*inp*/ { 32, "%n|%i", -1234.561 },
125 /*exp*/ { 0,1,24, "-$1,234.56|-USD 1,234.56" },
129 /*inp*/ { 30, "%12n|%12i", 1234.561 },
130 /*exp*/ { 0,1,25, " $1,234.56|USD 1,234.56"},
134 /*inp*/ { 32, "%12n|%12i", -1234.561 },
135 /*exp*/ { 0,1,26, " -$1,234.56|-USD 1,234.56"},
139 /*inp*/ { 32, "%#5n|%#5i", 1234.561 },
140 /*exp*/ { 0,1,26, " $ 1,234.56| USD 1,234.56"},
144 /*inp*/ { 32, "%#5n|%#5i", -1234.561 },
145 /*exp*/ { 0,1,26, "-$ 1,234.56|-USD 1,234.56"},
149 /*inp*/ { 32, "%=*#5n|%=*#5i", 1234.561 },
150 /*exp*/ { 0,1,26, " $*1,234.56| USD *1,234.56"},
154 /*inp*/ { 32, "%=0#5n|%=0#5i", -1234.561 },
155 /*exp*/ { 0,1,26, "-$01,234.56|-USD 01,234.56"},
159 /*inp*/ { 32, "%^#5n|%^#5i", -1234.561 },
160 /*exp*/ { 0,1,24, "-$ 1234.56|-USD 1234.56" },
164 /*inp*/ { 32, "%#5.0n|%#5.0i", 1234.444 },
165 /*exp*/ { 0,1,20, " $ 1,234| USD 1,234" },
169 /*inp*/ { 32, "%#5.0n|%#5.4i", -1234.555 },
170 /*exp*/ { 0,1,25, "-$ 1,235|-USD 1,234.5550"},
174 /*inp*/ { 32, "%(#5n|%!(#5i", -1234.561 },
175 /*exp*/ { 0,1,24, "($ 1,234.56)|( 1,234.56)" },
181 { Tstrfmon
, TST_LOC_eucJP
},
185 /*inp*/ { 17, "%n %% %i", 123.00 },
186 /*exp*/ { 0,1,15, "\241\357123 % JPY 123" },
190 /*inp*/ { 16, "%n %% %i", 123.00 },
191 /*exp*/ { 0,1,15, "\241\357123 % JPY 123" },
195 /*inp*/ { 15, "%n %% %i", 123.00 },
196 /*exp*/ { E2BIG
,1,-1, "" },
200 /*inp*/ { 30, "%n|%i", 1234.561 },
201 /*exp*/ { 0,1,17, "\241\3571,235|JPY 1,235" },
205 /*inp*/ { 32, "%n|%i", -1234.561 },
206 /*exp*/ { 0,1,19, "\241\357-1,235|JPY -1,235" },
210 /*inp*/ { 32, "%12n|%12i", 1234.561 },
211 /*exp*/ { 0,1,25, " \241\3571,235| JPY 1,235" },
215 /*inp*/ { 32, "%12n|%12i", -1234.561 },
216 /*exp*/ { 0,1,25, " \241\357-1,235| JPY -1,235" },
220 /*inp*/ { 32, "%#5n|%#5i", 1234.561 },
221 /*exp*/ { 0,1,21, " \241\357 1,235| JPY 1,235" },
225 /*inp*/ { 32, "%#5n|%#5i", -1234.561 },
226 /*exp*/ { 0,1,21, "\241\357- 1,235|JPY - 1,235" },
230 /*inp*/ { 32, "%=*#5n|%=*#5i", 1234.561 },
231 /*exp*/ { 0,1,21, " \241\357*1,235| JPY *1,235" },
235 /*inp*/ { 32, "%=0#5n|%=0#5i", -1234.561 },
236 /*exp*/ { 0,1,21, "\241\357-01,235|JPY -01,235" },
240 /*inp*/ { 32, "%^#5n|%^#5i", -1234.561 },
241 /*exp*/ { 0,1,19, "\241\357- 1235|JPY - 1235" },
245 /*inp*/ { 32, "%#5.0n|%#5.0i", 1234.444 },
246 /*exp*/ { 0,1,21, " \241\357 1,234| JPY 1,234" },
250 /*inp*/ { 32, "%#5.0n|%#5.4i", -1234.555 },
251 /*exp*/ { 0,1,26, "\241\357- 1,235|JPY - 1,234.5550"},
255 /*inp*/ { 32, "%(#5n|%!(#5i", -1234.561 },
256 /*exp*/ { 0,1,19, "(\241\357 1,235)|( 1,235)" },
262 { Tstrfmon
, TST_LOC_end
}