math/Makefile.am, symm/Makefile.am: Use `--no-install' on oddball tests.
[catacomb] / symm / hash.h
index dc0bbaa..eb3cd75 100644 (file)
                                                                        \
   {                                                                    \
     uint32 _l = U32(_bsz);                                             \
-    uint32 _h = ((_bsz & ~MASK32) >> 16) >> 16;                                \
+    uint32 _h = ((_bsz & ~(size_t)MASK32) >> 16) >> 16;                        \
     _bctx->nh += _h;                                                   \
     _bctx->nl += _l;                                                   \
-    if (_bctx->nl < _l || _bctx->nl & ~MASK32)                         \
+    if (_bctx->nl < _l || _bctx->nl & ~(uint32)MASK32)                 \
       _bctx->nh++;                                                     \
   }                                                                    \
                                                                        \
 
 #define HASH_VERIFYX(PRE, pre, name)                                   \
                                                                        \
-static int vrf_##pre(dstr *v)                                          \
+static int vrf_##pre(dstr *v, const test_type *msgty)                  \
 {                                                                      \
   pre##_ctx ctx;                                                       \
   int ok = 1;                                                          \
@@ -201,8 +201,9 @@ static int vrf_##pre(dstr *v)                                               \
     }                                                                  \
     pre##_done(&ctx, d.buf);                                           \
     if (memcmp(d.buf, v[1].buf, PRE##_HASHSZ) != 0) {                  \
-      printf("\nfail:\n\tstep = %i\n\tinput = `%s'\n\texpected = ",    \
-            *ip, v[0].buf);                                            \
+      printf("\nfail:\n\tstep = %i\n\tinput = ", *ip);                 \
+      msgty->dump(&v[0], stdout);                                      \
+      printf("\n\texpected = ");                                       \
       type_hex.dump(&v[1], stdout);                                    \
       fputs("\n\tcomputed = ", stdout);                                        \
       type_hex.dump(&d, stdout);                                       \
@@ -215,6 +216,11 @@ static int vrf_##pre(dstr *v)                                              \
   return (ok);                                                         \
 }                                                                      \
                                                                        \
+static int vrf_##pre##_hex(dstr *v)                                    \
+  { return vrf_##pre(v, &type_hex); }                                  \
+static int vrf_##pre##_lit(dstr *v)                                    \
+  { return vrf_##pre(v, &type_string); }                               \
+                                                                       \
 static int vrf_##pre##_rep(dstr *v)                                    \
 {                                                                      \
   pre##_ctx ctx;                                                       \
@@ -255,7 +261,8 @@ static int vrf_##pre##_rep(dstr *v)                                 \
 #define HASH_TESTDEFS(PRE, pre) HASH_TESTDEFSX(PRE, pre, #pre)
 
 #define HASH_TESTDEFSX(PRE, pre, name)                                 \
-  { name, vrf_##pre, { &type_string, &type_hex, 0 } },                 \
+  { name, vrf_##pre##_lit, { &type_string, &type_hex, 0 } },           \
+  { name "-hex", vrf_##pre##_hex, { &type_hex, &type_hex, 0 } },       \
   { name "-rep", vrf_##pre##_rep,                                      \
     { &type_string, &type_int, &type_hex, 0 } },