Mercurial > hg > th-libs
changeset 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 | 5016bf56e5d8 |
children | 77201824790c |
files | tests.c |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests.c Thu Feb 25 09:26:31 2016 +0200 +++ b/tests.c Thu Feb 25 09:49:28 2016 +0200 @@ -380,6 +380,19 @@ test_snprintf(c_msg, c_fmts[i1], c_val); } + if (test_set_start("printf() pointers")) + { + char *p_fmts[] = { "%p", "%8p", "%32p", "%032p", "%-32p", }; + void *p_vals[] = { NULL, (void *) 1, &p_fmts, }; + + for (i1 = 0; i1 < NCOUNT(p_vals); i1++) + { + snprintf(buf, sizeof(buf), "%p", p_vals[i1]); + for (i2 = 0; i2 < NCOUNT(p_fmts); i2++) + test_snprintf(buf, p_fmts[i2], p_vals[i1]); + } + } + // // String matching functions //