# HG changeset patch # User Matti Hamalainen # Date 1456225220 -7200 # Node ID a705d21ca25bd3ccdb889421691b9ab2b3e80fe2 # Parent 799e38f867da08ffa4d52b7f4845f86ac7e3072c Simplify tests. diff -r 799e38f867da -r a705d21ca25b tests.c --- a/tests.c Tue Feb 23 12:59:28 2016 +0200 +++ b/tests.c Tue Feb 23 13:00:20 2016 +0200 @@ -299,11 +299,11 @@ // // Test series #1 // + char *i_fmts[] = { "%", "%05", "%5", "%-5", "%.5", "%5.5", "%05.5", "% ", "% 3", "% 3.2", "%+3", }; + char *i_types[] = { "d", "x", "X", "o", }; if (test_set_start("printf() integer")) { int i_vals[] = { 0, -0, -1, 2, -2, 612342, -612342, 0x1fff, 0x8000000, }; - char *i_fmts[] = { "%", "%05", "%5", "%-5", "%.5", "%5.5", "%05.5", "% ", "% 3", "% 3.2", "%+3", }; - char *i_types[] = { "d", "x", "X", "o", }; for (i1 = 0; i1 < NCOUNT(i_vals); i1++) { @@ -320,19 +320,17 @@ if (test_set_start("printf() integer 64bit")) { - int64_t i_vals[] = { 0, -0, -1, 2, -2, 612342, -612342, 0x3342344341fff, 0x1f8000000, }; - char *i_fmts[] = { "%", "%05", "%5", "%-5", "%.5", "%5.5", "%05.5", "% ", "% 3", "% 3.2", "%+3", }; - char *i_types[] = { "d", "x", "X", "o", }; + int64_t i_vals64[] = { 0, -0, -1, 2, -2, 612342, -612342, 0x3342344341fff, 0x1f8000000, }; - for (i1 = 0; i1 < NCOUNT(i_vals); i1++) + for (i1 = 0; i1 < NCOUNT(i_vals64); i1++) { - snprintf(buf, sizeof(buf), "%lld", i_vals[i1]); + snprintf(buf, sizeof(buf), "%lld", i_vals64[i1]); for (i3 = 0; i3 < NCOUNT(i_types); i3++) for (i2 = 0; i2 < NCOUNT(i_fmts); i2++) { snprintf(buf2, sizeof(buf2), "%sll%s", i_fmts[i2], i_types[i3]); - test_snprintf(buf, buf2, i_vals[i1]); + test_snprintf(buf, buf2, i_vals64[i1]); } } }