Lines Matching refs:TEST
1 #include "test/jemalloc_test.h"
138 struct test_s *test = &tests[i];
144 result = malloc_strtoumax(test->input, &remainder, test->base);
146 assert_d_eq(err, test->expected_errno,
148 test->expected_errno_name, test->input, test->base);
149 assert_str_eq(remainder, test->expected_remainder,
151 test->input, test->base);
153 assert_ju_eq(result, test->expected_x,
155 test->input, test->base);
167 #define TEST(expected_str_untruncated, ...) do { \
177 TEST("012346789", "012346789");
178 TEST("a0123b", "a%sb", "0123");
179 TEST("a01234567", "a%s%s", "0123", "4567");
180 TEST("a0123 ", "a%-6s", "0123");
181 TEST("a 0123", "a%6s", "0123");
182 TEST("a 012", "a%6.3s", "0123");
183 TEST("a 012", "a%*.*s", 6, 3, "0123");
184 TEST("a 123b", "a% db", 123);
185 TEST("a123b", "a%-db", 123);
186 TEST("a-123b", "a%-db", -123);
187 TEST("a+123b", "a%+db", 123);
190 #undef TEST
199 #define TEST(expected_str, ...) do { \
205 TEST("hello", "hello");
207 TEST("50%, 100%", "50%%, %d%%", 100);
209 TEST("a0123b", "a%sb", "0123");
211 TEST("a 0123b", "a%5sb", "0123");
212 TEST("a 0123b", "a%*sb", 5, "0123");
214 TEST("a0123 b", "a%-5sb", "0123");
215 TEST("a0123b", "a%*sb", -1, "0123");
216 TEST("a0123 b", "a%*sb", -5, "0123");
217 TEST("a0123 b", "a%-*sb", -5, "0123");
219 TEST("a012b", "a%.3sb", "0123");
220 TEST("a012b", "a%.*sb", 3, "0123");
221 TEST("a0123b", "a%.*sb", -3, "0123");
223 TEST("a 012b", "a%5.3sb", "0123");
224 TEST("a 012b", "a%5.*sb", 3, "0123");
225 TEST("a 012b", "a%*.3sb", 5, "0123");
226 TEST("a 012b", "a%*.*sb", 5, 3, "0123");
227 TEST("a 0123b", "a%*.*sb", 5, -3, "0123");
229 TEST("_abcd_", "_%x_", 0xabcd);
230 TEST("_0xabcd_", "_%#x_", 0xabcd);
231 TEST("_1234_", "_%o_", 01234);
232 TEST("_01234_", "_%#o_", 01234);
233 TEST("_1234_", "_%u_", 1234);
235 TEST("_1234_", "_%d_", 1234);
236 TEST("_ 1234_", "_% d_", 1234);
237 TEST("_+1234_", "_%+d_", 1234);
238 TEST("_-1234_", "_%d_", -1234);
239 TEST("_-1234_", "_% d_", -1234);
240 TEST("_-1234_", "_%+d_", -1234);
242 TEST("_-1234_", "_%d_", -1234);
243 TEST("_1234_", "_%d_", 1234);
244 TEST("_-1234_", "_%i_", -1234);
245 TEST("_1234_", "_%i_", 1234);
246 TEST("_01234_", "_%#o_", 01234);
247 TEST("_1234_", "_%u_", 1234);
248 TEST("_0x1234abc_", "_%#x_", 0x1234abc);
249 TEST("_0X1234ABC_", "_%#X_", 0x1234abc);
250 TEST("_c_", "_%c_", 'c');
251 TEST("_string_", "_%s_", "string");
252 TEST("_0x42_", "_%p_", ((void *)0x42));
254 TEST("_-1234_", "_%ld_", ((long)-1234));
255 TEST("_1234_", "_%ld_", ((long)1234));
256 TEST("_-1234_", "_%li_", ((long)-1234));
257 TEST("_1234_", "_%li_", ((long)1234));
258 TEST("_01234_", "_%#lo_", ((long)01234));
259 TEST("_1234_", "_%lu_", ((long)1234));
260 TEST("_0x1234abc_", "_%#lx_", ((long)0x1234abc));
261 TEST("_0X1234ABC_", "_%#lX_", ((long)0x1234ABC));
263 TEST("_-1234_", "_%lld_", ((long long)-1234));
264 TEST("_1234_", "_%lld_", ((long long)1234));
265 TEST("_-1234_", "_%lli_", ((long long)-1234));
266 TEST("_1234_", "_%lli_", ((long long)1234));
267 TEST("_01234_", "_%#llo_", ((long long)01234));
268 TEST("_1234_", "_%llu_", ((long long)1234));
269 TEST("_0x1234abc_", "_%#llx_", ((long long)0x1234abc));
270 TEST("_0X1234ABC_", "_%#llX_", ((long long)0x1234ABC));
272 TEST("_-1234_", "_%qd_", ((long long)-1234));
273 TEST("_1234_", "_%qd_", ((long long)1234));
274 TEST("_-1234_", "_%qi_", ((long long)-1234));
275 TEST("_1234_", "_%qi_", ((long long)1234));
276 TEST("_01234_", "_%#qo_", ((long long)01234));
277 TEST("_1234_", "_%qu_", ((long long)1234));
278 TEST("_0x1234abc_", "_%#qx_", ((long long)0x1234abc));
279 TEST("_0X1234ABC_", "_%#qX_", ((long long)0x1234ABC));
281 TEST("_-1234_", "_%jd_", ((intmax_t)-1234));
282 TEST("_1234_", "_%jd_", ((intmax_t)1234));
283 TEST("_-1234_", "_%ji_", ((intmax_t)-1234));
284 TEST("_1234_", "_%ji_", ((intmax_t)1234));
285 TEST("_01234_", "_%#jo_", ((intmax_t)01234));
286 TEST("_1234_", "_%ju_", ((intmax_t)1234));
287 TEST("_0x1234abc_", "_%#jx_", ((intmax_t)0x1234abc));
288 TEST("_0X1234ABC_", "_%#jX_", ((intmax_t)0x1234ABC));
290 TEST("_1234_", "_%td_", ((ptrdiff_t)1234));
291 TEST("_-1234_", "_%td_", ((ptrdiff_t)-1234));
292 TEST("_1234_", "_%ti_", ((ptrdiff_t)1234));
293 TEST("_-1234_", "_%ti_", ((ptrdiff_t)-1234));
295 TEST("_-1234_", "_%zd_", ((ssize_t)-1234));
296 TEST("_1234_", "_%zd_", ((ssize_t)1234));
297 TEST("_-1234_", "_%zi_", ((ssize_t)-1234));
298 TEST("_1234_", "_%zi_", ((ssize_t)1234));
299 TEST("_01234_", "_%#zo_", ((ssize_t)01234));
300 TEST("_1234_", "_%zu_", ((ssize_t)1234));
301 TEST("_0x1234abc_", "_%#zx_", ((ssize_t)0x1234abc));
302 TEST("_0X1234ABC_", "_%#zX_", ((ssize_t)0x1234ABC));
311 return (test(