Deploy the new <ctype.h> and `foocmp' macros from mLib.
[catacomb] / math / ec-test.c
index d9cda6f..ff01a2e 100644 (file)
@@ -215,6 +215,8 @@ const test_type type_ec = { eccvt, ecdump };
 
 #ifdef TEST_RIG
 
+#include <mLib/macros.h>
+
 static void ecdestroy(ec_curve *c)
 {
   field *f = c->f;
@@ -354,7 +356,7 @@ static int vec2osp(dstr v[])
   int ok = 1;
   int win, wantwin;
 
-  if (strcmp(v[3].buf, "FAIL") == 0) wantwin = 0;
+  if (STRCMP(v[3].buf, ==, "FAIL")) wantwin = 0;
   else { wantwin = 1; type_hex.cvt(v[3].buf, &d); }
 
   dstr_ensure(&dd, n); buf_init(&b, dd.buf, n);
@@ -362,7 +364,7 @@ static int vec2osp(dstr v[])
   win = !ec_ec2osp(e, f, &b, p);
   if (!win != !wantwin ||
       (win && (BLEN(&b) != d.len ||
-              memcmp(BBASE(&b), d.buf, BLEN(&b)) != 0))) {
+              MEMCMP(BBASE(&b), !=, d.buf, BLEN(&b))))) {
     ok = 0;
     fprintf(stderr, "ec2osp failed");
     fprintf(stderr, "\ncurve = "); type_ecurve.dump(v, stderr);
@@ -393,7 +395,7 @@ static int vos2ecp(dstr v[])
   int ok = 1;
   int win;
 
-  if (strcmp(v[3].buf, "FAIL") == 0) p = 0;
+  if (STRCMP(v[3].buf, ==, "FAIL")) p = 0;
   else { type_ec.cvt(v[3].buf, &d); p = (ec *)d.buf; }
 
   buf_init(&b, v[2].buf, v[2].len);