comparison tests.c @ 356:d7f43fce0dce

Add tests for printing pointers (%p formatters).
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 25 Feb 2016 09:49:28 +0200
parents 75b20d9bef64
children 9ca9ef4e3656
comparison
equal deleted inserted replaced
355:5016bf56e5d8 356:d7f43fce0dce
378 378
379 for (i1 = 0; i1 < NCOUNT(c_fmts); i1++) 379 for (i1 = 0; i1 < NCOUNT(c_fmts); i1++)
380 test_snprintf(c_msg, c_fmts[i1], c_val); 380 test_snprintf(c_msg, c_fmts[i1], c_val);
381 } 381 }
382 382
383 if (test_set_start("printf() pointers"))
384 {
385 char *p_fmts[] = { "%p", "%8p", "%32p", "%032p", "%-32p", };
386 void *p_vals[] = { NULL, (void *) 1, &p_fmts, };
387
388 for (i1 = 0; i1 < NCOUNT(p_vals); i1++)
389 {
390 snprintf(buf, sizeof(buf), "%p", p_vals[i1]);
391 for (i2 = 0; i2 < NCOUNT(p_fmts); i2++)
392 test_snprintf(buf, p_fmts[i2], p_vals[i1]);
393 }
394 }
395
383 // 396 //
384 // String matching functions 397 // String matching functions
385 // 398 //
386 if (test_set_start("String matching #1")) 399 if (test_set_start("String matching #1"))
387 { 400 {