Mercurial > hg > th-libs
changeset 724:388d72f4189d
Add some tests for PRI* printf specifiers to test 64bit.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 18 Oct 2021 01:56:09 +0300 |
parents | 10f2eba7c59b |
children | 5c8936e326d6 |
files | tests.c |
diffstat | 1 files changed, 28 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tests.c Mon Oct 18 01:04:46 2021 +0300 +++ b/tests.c Mon Oct 18 01:56:09 2021 +0300 @@ -823,7 +823,7 @@ } } - if (test_set_start("printf() integer 64bit")) + if (test_set_start("printf() integer 64bit generic")) { int64_t i_vals64[] = { 0, -0, 1, -1, 10, -10, 512, -512, -1024, @@ -845,6 +845,33 @@ } } + if (test_set_start("printf() integer 64bit PRI* specifiers")) + { + int64_t i_vals64[] = { + 0, -0, 1, -1, 10, -10, 512, -512, -1024, + 612342, -612342, 0x1fff, 0x8000000, -123456789, + 4294967295, -2147483648, + 0x3342344341fff, 0x1f8000000, }; + + for (i1 = 0; i1 < NCOUNT(i_vals64); i1++) + { + snprintf(buf, sizeof(buf), "%" PRId64, i_vals64[i1]); + + for (i4 = 0; i3 < NCOUNT(i_mods); i3++) + for (i2 = 0; i2 < NCOUNT(i_fmts); i2++) + { + snprintf(buf2, sizeof(buf2), "%%%s%s" PRId64, i_mods[i3], i_fmts[i2]); + test_snprintf(buf, buf2, i_vals64[i1]); + + snprintf(buf2, sizeof(buf2), "%%%s%s" PRIx64, i_mods[i3], i_fmts[i2]); + test_snprintf(buf, buf2, i_vals64[i1]); + + snprintf(buf2, sizeof(buf2), "%%%s%s" PRIX64, i_mods[i3], i_fmts[i2]); + test_snprintf(buf, buf2, i_vals64[i1]); + } + } + } + #ifdef TH_WIP_FLOAT_SUPPORT if (test_set_start("printf() float")) {