changeset 334:b90173719330

Add more tests (some of which will fail for now due to unimplemented features).
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 23 Feb 2016 13:52:12 +0200
parents a705d21ca25b
children 11d97063d6dd
files tests.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tests.c	Tue Feb 23 13:00:20 2016 +0200
+++ b/tests.c	Tue Feb 23 13:52:12 2016 +0200
@@ -269,7 +269,7 @@
 
 int main(int argc, char *argv[])
 {
-    size_t i1, i2, i3;
+    size_t i1, i2, i3, i4;
     char buf[64], buf2[64];
 
     //
@@ -299,7 +299,8 @@
     //
     // Test series #1
     //
-    char *i_fmts[] = { "%", "%05", "%5", "%-5", "%.5", "%5.5", "%05.5", "% ", "% 3", "% 3.2", "%+3", };
+    char *i_fmts[] = { "", "05", "5", "5", ".5", "5.5", "05.5", "3", "3.2", "3", };
+    char *i_mods[] = { "", "-", "+", "#", };
     char *i_types[] = { "d", "x", "X", "o", };
     if (test_set_start("printf() integer"))
     {
@@ -309,10 +310,11 @@
         {
             snprintf(buf, sizeof(buf), "%d", i_vals[i1]);
 
+            for (i4 = 0; i4 < NCOUNT(i_mods); i4++)
             for (i3 = 0; i3 < NCOUNT(i_types); i3++)
             for (i2 = 0; i2 < NCOUNT(i_fmts); i2++)
             {
-                snprintf(buf2, sizeof(buf2), "%s%s", i_fmts[i2], i_types[i3]);
+                snprintf(buf2, sizeof(buf2), "%%%s%s%s", i_mods[i4], i_fmts[i2], i_types[i3]);
                 test_snprintf(buf, buf2, i_vals[i1]);
             }
         }