changeset 502:ebf89497305a

Remove some unused functionality for simplification.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 26 Dec 2019 05:49:49 +0200
parents d42574b3dc00
children 12dbe0102d72
files tests.c
diffstat 1 files changed, 6 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/tests.c	Thu Dec 26 05:38:48 2019 +0200
+++ b/tests.c	Thu Dec 26 05:49:49 2019 +0200
@@ -22,7 +22,7 @@
 
 typedef struct
 {
-    char *header, *res;
+    char *header;
     BOOL shown;
 } test_ctx;
 
@@ -137,23 +137,16 @@
 }
 
 
-void test_init(test_ctx *ctx)
-{
-    memset(ctx, 0, sizeof(test_ctx));
-}
-
-
 void test_end(test_ctx *ctx)
 {
     th_free_r(&ctx->header);
-    th_free_r(&ctx->res);
 }
 
 
 void test_start_v(test_ctx *ctx, const char *fmt, va_list ap)
 {
     tests_total++;
-    test_end(ctx);
+    memset(ctx, 0, sizeof(test_ctx));
     ctx->header = th_strdup_vprintf(fmt, ap);
 }
 
@@ -187,8 +180,6 @@
             tprintv(0, fmt, ap);
             tprint(0, "\n");
         }
-        if (ctx->res != NULL)
-            tprint(0, "%s\n", ctx->res);
         tests_failed++;
     }
 }
@@ -218,7 +209,6 @@
     test_ctx ctx;
 
     // Test basic *printf() functionality
-    test_init(&ctx);
     test_start(&ctx, "th_vsnprintf(%" PRIu_SIZE_T ", \"%s\", %s)", len, fmt, msg);
 
     memset(buf1, SET_SENTINEL_BYTE, SET_BUF_SIZE_2); buf1[SET_BUF_SIZE_2-1] = 0;
@@ -259,7 +249,6 @@
     // Test th_strdup_vprintf()
     if (optFlags & TST_SUPERFLUOUS)
     {
-        test_init(&ctx);
         test_start(&ctx, "th_strdup_vprintf('%s')", fmt);
         va_copy(tmp, ap);
         char *str = th_strdup_vprintf(fmt, tmp);
@@ -296,28 +285,28 @@
 
 
 #define TEST2(fun, str1, str2, ret) do { \
-        test_ctx ctx; test_init(&ctx); \
+        test_ctx ctx; \
         test_start(&ctx, # fun  "('%s', '%s')", str1, str2); \
         test_result(&ctx, ( fun (str1, str2) == 0) == ret); \
         test_end(&ctx); \
     } while (0)
 
 #define TEST2B(fun, str1, str2, ret) do { \
-        test_ctx ctx; test_init(&ctx); \
+        test_ctx ctx; \
         test_start(&ctx, # fun  "('%s', '%s')", str1, str2); \
         test_result(&ctx, fun (str1, str2) == ret); \
         test_end(&ctx); \
     } while (0)
 
 #define TEST2C(fun, str1, str2, ret) do { \
-        test_ctx ctx; test_init(&ctx); \
+        test_ctx ctx; \
         test_start(&ctx, # fun  "('%s', '%s')", str1, str2); \
         test_result(&ctx, (fun (str1, str2) != NULL) == ret); \
         test_end(&ctx); \
     } while (0)
 
 #define TEST3(fun, str1, str2, len, ret) do { \
-        test_ctx ctx; test_init(&ctx); \
+        test_ctx ctx; \
         test_start(&ctx, # fun  "('%s', '%s', %d)", str1, str2, len); \
         test_result(&ctx, ( fun (str1, str2, len) == 0) == ret); \
         test_end(&ctx); \