utils/macros.h: Add <ctype.h> and `foocmp' helper macros.
[mLib] / struct / t / assoc-test.c
index bd1bab4..a727bbf 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "assoc.h"
 #include "atom.h"
+#include "macros.h"
 
 typedef struct word {
   assoc_base _b;
@@ -34,7 +35,7 @@ int main(void)
     buf[strlen(buf) - 1] = 0;
     p = strtok(buf, " ");
 
-    if (strcmp(p, "set") == 0) {
+    if (STRCMP(p, ==, "set")) {
       char *k = strtok(0, " ");
       int i = atoi(strtok(0, " "));
       unsigned f;
@@ -42,14 +43,14 @@ int main(void)
       w->i = i;
       if (!f)
        n++;
-    } else if (strcmp(p, "get") == 0) {
+    } else if (STRCMP(p, ==, "get")) {
       char *k = strtok(0, " ");
       word *w = assoc_find(&t, atom_intern(&at, k), 0, 0);
       if (w)
        printf("%i\n", w->i);
       else
        puts("*MISSING*");
-    } else if (strcmp(p, "del") == 0) {
+    } else if (STRCMP(p, ==, "del")) {
       char *k = strtok(0, " ");
       word *w = assoc_find(&t, atom_intern(&at, k), 0, 0);
       if (w) {
@@ -57,9 +58,9 @@ int main(void)
        n--;
       } else
        puts("*MISSING*");
-    } else if (strcmp(p, "count") == 0) {
+    } else if (STRCMP(p, ==, "count")) {
       printf("%lu\n", (unsigned long)n);
-    } else if (strcmp(p, "show") == 0) {
+    } else if (STRCMP(p, ==, "show")) {
       assoc_iter i;
       word *w;
       word **v, **vv;