changeset 315:2b657dcf346e

More tests.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 22 Feb 2016 23:01:27 +0200
parents 7bce1e9fa397
children d4a069014899
files tests.c
diffstat 1 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests.c	Mon Feb 22 22:52:45 2016 +0200
+++ b/tests.c	Mon Feb 22 23:01:27 2016 +0200
@@ -298,7 +298,20 @@
     if (test_set_start("printf() integer"))
     {
         int i_vals[] = { 0, -0, -1, 2, -2, 612342, -612342, 0x1fff, 0x8000000, };
-        char *i_fmts[] = { "%d", "%x", "%05d", "%5d", "%-5d", "%.5d", "%05x", "%5x", "", "% 3d", "% 3o", "%+3o", "%+3d", };
+        char *i_fmts[] = { "%d", "%x", "%05d", "%5d", "%-5d", "%.5d", "%05x", "%5x", "", "% 3d", "%+3d", "%05.5d", "%-8x", "%.x", };
+
+        for (i1 = 0; i1 < sizeof(i_vals) / sizeof(i_vals[0]); i1++)
+        {
+            tprint(1, "Value %d\n", i_vals[i1]);
+            for (i2 = 0; i2 < sizeof(i_fmts) / sizeof(i_fmts[0]); i2++)
+                test_snprintf(i_fmts[i2], i_vals[i1]);
+        }
+    }
+
+    if (test_set_start("printf() integer 2"))
+    {
+        int i_vals[] = { 0, -0, -1, 2, -2, 612342, -612342, 0x1fff, 0x8000000, };
+        char *i_fmts[] = { "% 3o", "%+3o", "%3o", "%.3o", "%3.3o", "%-4.2o", "%-4o", "%.o" };
 
         for (i1 = 0; i1 < sizeof(i_vals) / sizeof(i_vals[0]); i1++)
         {
@@ -311,7 +324,7 @@
     if (test_set_start("printf() float"))
     {
         int f_vals[] = { 2.02, 612342.234, -2.07, -612342.12, 0x1fff, 0x8000000, };
-        char *f_fmts[] = { "%f", "%1.1f", "%5.5f", "%5f", "%-5f", "", };
+        char *f_fmts[] = { "%f", "%1.1f", "%5.5f", "%5f", "%-5f", "", "%-2.2f", "%05.5f" };
 
         for (i1 = 0; i1 < sizeof(f_vals) / sizeof(f_vals[0]); i1++)
         {
@@ -344,6 +357,8 @@
         test_snprintf("% c", 'x');
         test_snprintf("%-3c", 'x');
         test_snprintf("%3c", 'x');
+        test_snprintf("%.3c", 'x');
+        test_snprintf("%-.3c", 'x');
     }
 
     //