Mercurial > hg > th-libs
comparison tests.c @ 334:b90173719330
Add more tests (some of which will fail for now due to unimplemented features).
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 23 Feb 2016 13:52:12 +0200 |
parents | a705d21ca25b |
children | b6f2efd0f6f2 |
comparison
equal
deleted
inserted
replaced
333:a705d21ca25b | 334:b90173719330 |
---|---|
267 | 267 |
268 | 268 |
269 | 269 |
270 int main(int argc, char *argv[]) | 270 int main(int argc, char *argv[]) |
271 { | 271 { |
272 size_t i1, i2, i3; | 272 size_t i1, i2, i3, i4; |
273 char buf[64], buf2[64]; | 273 char buf[64], buf2[64]; |
274 | 274 |
275 // | 275 // |
276 // Initialization | 276 // Initialization |
277 // | 277 // |
297 | 297 |
298 | 298 |
299 // | 299 // |
300 // Test series #1 | 300 // Test series #1 |
301 // | 301 // |
302 char *i_fmts[] = { "%", "%05", "%5", "%-5", "%.5", "%5.5", "%05.5", "% ", "% 3", "% 3.2", "%+3", }; | 302 char *i_fmts[] = { "", "05", "5", "5", ".5", "5.5", "05.5", "3", "3.2", "3", }; |
303 char *i_mods[] = { "", "-", "+", "#", }; | |
303 char *i_types[] = { "d", "x", "X", "o", }; | 304 char *i_types[] = { "d", "x", "X", "o", }; |
304 if (test_set_start("printf() integer")) | 305 if (test_set_start("printf() integer")) |
305 { | 306 { |
306 int i_vals[] = { 0, -0, -1, 2, -2, 612342, -612342, 0x1fff, 0x8000000, }; | 307 int i_vals[] = { 0, -0, -1, 2, -2, 612342, -612342, 0x1fff, 0x8000000, }; |
307 | 308 |
308 for (i1 = 0; i1 < NCOUNT(i_vals); i1++) | 309 for (i1 = 0; i1 < NCOUNT(i_vals); i1++) |
309 { | 310 { |
310 snprintf(buf, sizeof(buf), "%d", i_vals[i1]); | 311 snprintf(buf, sizeof(buf), "%d", i_vals[i1]); |
311 | 312 |
313 for (i4 = 0; i4 < NCOUNT(i_mods); i4++) | |
312 for (i3 = 0; i3 < NCOUNT(i_types); i3++) | 314 for (i3 = 0; i3 < NCOUNT(i_types); i3++) |
313 for (i2 = 0; i2 < NCOUNT(i_fmts); i2++) | 315 for (i2 = 0; i2 < NCOUNT(i_fmts); i2++) |
314 { | 316 { |
315 snprintf(buf2, sizeof(buf2), "%s%s", i_fmts[i2], i_types[i3]); | 317 snprintf(buf2, sizeof(buf2), "%%%s%s%s", i_mods[i4], i_fmts[i2], i_types[i3]); |
316 test_snprintf(buf, buf2, i_vals[i1]); | 318 test_snprintf(buf, buf2, i_vals[i1]); |
317 } | 319 } |
318 } | 320 } |
319 } | 321 } |
320 | 322 |