1 /* 2 * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY 3 * 4 * FILE: dat_strfmon.c 5 * 6 * STRFMON: size_t strfmon (char *buf, size_t nbyte, char *fmt, ... ); 7 */ 8 9 /* 10 * NOTE: 11 * 12 * The buffer size should be enough to contain a string including a 13 * null char. 14 * Returns the number of bytes of the string (NOT including a null char). 15 */ 16 17 TST_STRFMON tst_strfmon_loc [] = { 18 { 19 { Tstrfmon, TST_LOC_de }, 20 { 21 { 22 /* #01 */ 23 /*inp*/ { 24, "%n %% %i", 123.00 }, 24 /*exp*/ { 0,1,23, "123,00 EUR % 123,00 EUR" }, 25 }, 26 { 27 /* #02 */ 28 /*inp*/ { 24, "%n %% %i", 123.00 }, 29 /*exp*/ { 0,1,23, "123,00 EUR % 123,00 EUR" }, 30 }, 31 { 32 /* #03 */ 33 /*inp*/ { 23, "%n %% %i", 123.00 }, 34 /*exp*/ { E2BIG,1,-1, "" }, 35 }, 36 { 37 /* #04 */ 38 /*inp*/ { 31, "%n|%i", 1234.561 }, 39 /*exp*/ { 0,1,25, "1.234,56 EUR|1.234,56 EUR"}, 40 }, 41 { 42 /* #05 */ 43 /*inp*/ { 33, "%n|%i", -1234.561 }, 44 /*exp*/ { 0,1,27, "-1.234,56 EUR|-1.234,56 EUR"}, 45 }, 46 { 47 /* #06 */ 48 /*inp*/ { 33, "%13n|%12i", 1234.561 }, 49 /*exp*/ { 0,1,26, " 1.234,56 EUR|1.234,56 EUR"}, 50 }, 51 { 52 /* #07 */ 53 /*inp*/ { 33, "%12n|%12i", -1234.561 }, 54 /*exp*/ { 0,1,27, "-1.234,56 EUR|-1.234,56 EUR"}, 55 }, 56 { 57 /* #08 */ 58 /*inp*/ { 33, "%#5n|%#5i", 1234.561 }, 59 /*exp*/ { 0,1,29, " 1.234,56 EUR| 1.234,56 EUR"}, 60 }, 61 { 62 /* #09 */ 63 /*inp*/ { 33, "%#5n|%#5i", -1234.561 }, 64 /*exp*/ { 0,1,29, "- 1.234,56 EUR|- 1.234,56 EUR"}, 65 }, 66 { 67 /* #10 */ 68 /*inp*/ { 33, "%=*#5n|%=*#5i", 1234.561 }, 69 /*exp*/ { 0,1,29, " *1.234,56 EUR| *1.234,56 EUR"}, 70 }, 71 { 72 /* #11 */ 73 /*inp*/ { 33, "%=0#5n|%=0#5i", -1234.561 }, 74 /*exp*/ { 0,1,29, "-01.234,56 EUR|-01.234,56 EUR"}, 75 }, 76 { 77 /* #12 */ 78 /*inp*/ { 33, "%^#5n|%^#5i", -1234.561 }, 79 /*exp*/ { 0,1,27, "- 1234,56 EUR|- 1234,56 EUR"}, 80 }, 81 { 82 /* #13 */ 83 /*inp*/ { 33, "%#5.0n|%#5.0i", 1234.444 }, 84 /*exp*/ { 0,1,23, " 1.234 EUR| 1.234 EUR" }, 85 }, 86 { 87 /* #14 */ 88 /*inp*/ { 33, "%#5.0n|%#5.4i", -1234.555 }, 89 /*exp*/ { 0,1,28, "- 1.235 EUR|- 1.234,5550 EUR"}, 90 }, 91 { 92 /* #15 */ 93 /*inp*/ { 33, "%(#5n|%!(#5i", -1234.561 }, 94 /*exp*/ { 0,1,27, "( 1.234,56 EUR)|( 1.234,56)"}, 95 }, 96 { .is_last = 1 } 97 } 98 }, 99 { 100 { Tstrfmon, TST_LOC_enUS }, 101 { 102 { 103 /* #01 */ 104 /*inp*/ { 22, "%n %% %i", 123.00 }, 105 /*exp*/ { 0,1,20, "$123.00 % USD 123.00" }, 106 }, 107 { 108 /* #02 */ 109 /*inp*/ { 21, "%n %% %i", 123.00 }, 110 /*exp*/ { 0,1,20, "$123.00 % USD 123.00" }, 111 }, 112 { 113 /* #03 */ 114 /*inp*/ { 20, "%n %% %i", 123.00 }, 115 /*exp*/ { E2BIG,1,-1, "" }, 116 }, 117 { 118 /* #04 */ 119 /*inp*/ { 30, "%n|%i", 1234.561 }, 120 /*exp*/ { 0,1,22, "$1,234.56|USD 1,234.56" }, 121 }, 122 { 123 /* #05 */ 124 /*inp*/ { 32, "%n|%i", -1234.561 }, 125 /*exp*/ { 0,1,24, "-$1,234.56|-USD 1,234.56" }, 126 }, 127 { 128 /* #06 */ 129 /*inp*/ { 30, "%12n|%12i", 1234.561 }, 130 /*exp*/ { 0,1,25, " $1,234.56|USD 1,234.56"}, 131 }, 132 { 133 /* #07 */ 134 /*inp*/ { 32, "%12n|%12i", -1234.561 }, 135 /*exp*/ { 0,1,26, " -$1,234.56|-USD 1,234.56"}, 136 }, 137 { 138 /* #08 */ 139 /*inp*/ { 32, "%#5n|%#5i", 1234.561 }, 140 /*exp*/ { 0,1,26, " $ 1,234.56| USD 1,234.56"}, 141 }, 142 { 143 /* #09 */ 144 /*inp*/ { 32, "%#5n|%#5i", -1234.561 }, 145 /*exp*/ { 0,1,26, "-$ 1,234.56|-USD 1,234.56"}, 146 }, 147 { 148 /* #10 */ 149 /*inp*/ { 32, "%=*#5n|%=*#5i", 1234.561 }, 150 /*exp*/ { 0,1,26, " $*1,234.56| USD *1,234.56"}, 151 }, 152 { 153 /* #11 */ 154 /*inp*/ { 32, "%=0#5n|%=0#5i", -1234.561 }, 155 /*exp*/ { 0,1,26, "-$01,234.56|-USD 01,234.56"}, 156 }, 157 { 158 /* #12 */ 159 /*inp*/ { 32, "%^#5n|%^#5i", -1234.561 }, 160 /*exp*/ { 0,1,24, "-$ 1234.56|-USD 1234.56" }, 161 }, 162 { 163 /* #13 */ 164 /*inp*/ { 32, "%#5.0n|%#5.0i", 1234.444 }, 165 /*exp*/ { 0,1,20, " $ 1,234| USD 1,234" }, 166 }, 167 { 168 /* #14 */ 169 /*inp*/ { 32, "%#5.0n|%#5.4i", -1234.555 }, 170 /*exp*/ { 0,1,25, "-$ 1,235|-USD 1,234.5550"}, 171 }, 172 { 173 /* #15 */ 174 /*inp*/ { 32, "%(#5n|%!(#5i", -1234.561 }, 175 /*exp*/ { 0,1,24, "($ 1,234.56)|( 1,234.56)" }, 176 }, 177 { .is_last = 1 } 178 } 179 }, 180 { 181 { Tstrfmon, TST_LOC_eucJP }, 182 { 183 { 184 /* #01 */ 185 /*inp*/ { 17, "%n %% %i", 123.00 }, 186 /*exp*/ { 0,1,15, "\241\357123 % JPY 123" }, 187 }, 188 { 189 /* #02 */ 190 /*inp*/ { 16, "%n %% %i", 123.00 }, 191 /*exp*/ { 0,1,15, "\241\357123 % JPY 123" }, 192 }, 193 { 194 /* #03 */ 195 /*inp*/ { 15, "%n %% %i", 123.00 }, 196 /*exp*/ { E2BIG,1,-1, "" }, 197 }, 198 { 199 /* #04 */ 200 /*inp*/ { 30, "%n|%i", 1234.561 }, 201 /*exp*/ { 0,1,17, "\241\3571,235|JPY 1,235" }, 202 }, 203 { 204 /* #05 */ 205 /*inp*/ { 32, "%n|%i", -1234.561 }, 206 /*exp*/ { 0,1,19, "\241\357-1,235|JPY -1,235" }, 207 }, 208 { 209 /* #06 */ 210 /*inp*/ { 32, "%12n|%12i", 1234.561 }, 211 /*exp*/ { 0,1,25, " \241\3571,235| JPY 1,235" }, 212 }, 213 { 214 /* #07 */ 215 /*inp*/ { 32, "%12n|%12i", -1234.561 }, 216 /*exp*/ { 0,1,25, " \241\357-1,235| JPY -1,235" }, 217 }, 218 { 219 /* #08 */ 220 /*inp*/ { 32, "%#5n|%#5i", 1234.561 }, 221 /*exp*/ { 0,1,21, " \241\357 1,235| JPY 1,235" }, 222 }, 223 { 224 /* #09 */ 225 /*inp*/ { 32, "%#5n|%#5i", -1234.561 }, 226 /*exp*/ { 0,1,21, "\241\357- 1,235|JPY - 1,235" }, 227 }, 228 { 229 /* #10 */ 230 /*inp*/ { 32, "%=*#5n|%=*#5i", 1234.561 }, 231 /*exp*/ { 0,1,21, " \241\357*1,235| JPY *1,235" }, 232 }, 233 { 234 /* #11 */ 235 /*inp*/ { 32, "%=0#5n|%=0#5i", -1234.561 }, 236 /*exp*/ { 0,1,21, "\241\357-01,235|JPY -01,235" }, 237 }, 238 { 239 /* #12 */ 240 /*inp*/ { 32, "%^#5n|%^#5i", -1234.561 }, 241 /*exp*/ { 0,1,19, "\241\357- 1235|JPY - 1235" }, 242 }, 243 { 244 /* #13 */ 245 /*inp*/ { 32, "%#5.0n|%#5.0i", 1234.444 }, 246 /*exp*/ { 0,1,21, " \241\357 1,234| JPY 1,234" }, 247 }, 248 { 249 /* #14 */ 250 /*inp*/ { 32, "%#5.0n|%#5.4i", -1234.555 }, 251 /*exp*/ { 0,1,26, "\241\357- 1,235|JPY - 1,234.5550"}, 252 }, 253 { 254 /* #15 */ 255 /*inp*/ { 32, "%(#5n|%!(#5i", -1234.561 }, 256 /*exp*/ { 0,1,19, "(\241\357 1,235)|( 1,235)" }, 257 }, 258 { .is_last = 1 } 259 } 260 }, 261 { 262 { Tstrfmon, TST_LOC_end } 263 } 264 }; 265