changeset 333:a705d21ca25b

Simplify tests.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 23 Feb 2016 13:00:20 +0200
parents 799e38f867da
children b90173719330
files tests.c
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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]);
             }
         }
     }