Mercurial > hg > th-libs
changeset 544:619e7fcff486
Add more printf() format tests.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 31 Dec 2019 05:13:13 +0200 |
parents | 3738d07e20e7 |
children | 4d2e9c806b98 |
files | tests.c |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/tests.c Mon Dec 30 18:33:27 2019 +0200 +++ b/tests.c Tue Dec 31 05:13:13 2019 +0200 @@ -580,9 +580,10 @@ // // Test series for printf() // - char *i_fmts[] = { "", "05", "6", ".4", "8.5", "08.5", "3", "2.1", "3", "1", "18", "018", ".0", "0" }; + char *i_fmts[] = { "", "05", "6", ".4", "1.1", "1.0", "8.5", "08.5", "3", "2.1", "3", "1", "18", "018", ".0", "0" }; char *i_mods[] = { "", "-", "+", "#", }; char *i_types[] = { "d", "u", "i", "x", "X", "o", }; + if (test_set_start("printf() integer")) { int i_vals[] = { @@ -607,7 +608,9 @@ if (test_set_start("printf() integer 64bit")) { int64_t i_vals64[] = { - 0, -0, 1, -1, 10, -10, + 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++) @@ -627,7 +630,7 @@ #ifdef TH_WIP_FLOAT_SUPPORT if (test_set_start("printf() float")) { - double f_vals[] = { 1, 2, 3, 2.02, 612342.234, -2.07, -612342.12, 437692.9876543219, 0x1fff, 0x8000000, 0.15625 }; + double f_vals[] = { 0, 1, 2, 3, 2.02, 612342.234, -2.07, -612342.12, 437692.9876543219, 0x1fff, 0x8000000, 0.15625 }; char *f_fmts[] = { "%f", "%1.1f", "%8.5f", "%5f", "%-5f", "", "%-5.2f", "%08.5f" }; for (i1 = 0; i1 < NCOUNT(f_vals); i1++)