utils/macros.h: Add <ctype.h> and `foocmp' helper macros.
[mLib] / test / testrig.c
index c85276f..c7dea67 100644 (file)
@@ -34,6 +34,7 @@
 #include <string.h>
 
 #include "dstr.h"
+#include "macros.h"
 #include "report.h"
 #include "quis.h"
 #include "testrig.h"
@@ -99,7 +100,7 @@ again:
 
   /* --- Skip leading whitespace --- */
 
-  while (isspace((unsigned char)ch))
+  while (ISSPACE(ch))
     ch = getc(fp);
 
   /* --- Trap some special characters --- */
@@ -163,7 +164,7 @@ again:
          case '`':
            goto done;
          default:
-           if (isspace((unsigned char)ch))
+           if (ISSPACE(ch))
              goto done;
        }
        if (ch == '\\') {
@@ -328,7 +329,7 @@ int test_do(const test_suite suites[], FILE *fp, test_results *results)
       goto done;
     }
 
-    if (strcmp(tok.buf, "SUITE") == 0) {
+    if (STRCMP(tok.buf, ==, "SUITE")) {
       t = gettok(fp);
       if (t != TOK_WORD) {
        moan("expected <word>; found `%s'", decode(t));
@@ -339,7 +340,7 @@ int test_do(const test_suite suites[], FILE *fp, test_results *results)
          chunks = 0;
          break;
        }
-       if (strcmp(tok.buf, ss->name) == 0) {
+       if (STRCMP(tok.buf, ==, ss->name)) {
          chunks = ss->chunks;
          break;
        }
@@ -354,7 +355,7 @@ int test_do(const test_suite suites[], FILE *fp, test_results *results)
     for (cch = chunks; ; cch++) {
       if (!cch->name)
        goto skip_chunk;
-      if (strcmp(tok.buf, cch->name) == 0)
+      if (STRCMP(tok.buf, ==, cch->name))
        break;
     }
 
@@ -479,7 +480,7 @@ void test_run(int argc, char *argv[],
        if (i >= argc - 1)
          break;
        p = argv[++i];
-       if (strcmp(p, "--") == 0) {
+       if (STRCMP(p, ==, "--")) {
          i++;
          break;
        }