roken: configure checks for inet_ntop and inet_pton
[openafs.git] / tests / opr / jhash-t.c
index 4fa518f..707cd06 100644 (file)
@@ -26,7 +26,7 @@
 #include <afs/param.h>
 
 #include <roken.h>
-#include <tap/basic.h>
+#include <tests/tap/basic.h>
 
 #include <opr/jhash.h>
 
 int
 main(int argc, char **argv)
 {
-   plan(8);
-   uint32_t test[] = {3526055646, 2064483663, 3234460805, 3963629775};
+   plan(13);
+   uint32_t test[] = {3526055646UL, 2064483663UL, 3234460805UL, 3963629775UL};
 
    is_int(256, opr_jhash_size(8), "opr_jhash_size returns expected value");
    is_int(255, opr_jhash_mask(8), "opr_jhash_mask returns expected value");
 
    is_int(0xdeadbeef, opr_jhash(test, 0, 0), "empty array hashes as expected");
    is_int(766530906, opr_jhash(test, 4, 0), "simple array works");
-   is_int(3782684773, opr_jhash(test, 4, 1), "changing initval works");
+   is_int(3782684773UL, opr_jhash(test, 4, 1), "changing initval works");
 
    test[2]++;
    is_int(1977082159, opr_jhash(test, 4, 0), "modifying value works");
@@ -57,5 +57,19 @@ main(int argc, char **argv)
    is_int(1100796964, opr_jhash_int(test[0], 0),
           "single value works through jhash_int");
 
-   return 0;
+   is_int(3704403432, opr_jhash(test, 2, 0),
+         "Hashing two values works");
+   is_int(3704403432, opr_jhash_int2(test[0], test[1], 0),
+         "jhash_int2 gives same result");
+
+   is_int(0xdeadbeef, opr_jhash_opaque("", 0, 0),
+         "Hashing an empty string works");
+
+   is_int(2748273291UL,
+         opr_jhash_opaque("Four score and seven years ago", 30, 0),
+         "Hashing a string with a 0 initval works");
+   is_int(1389900913,
+         opr_jhash_opaque("Four score and seven years ago", 30, 1),
+         "Hashing a string with a 1 initval works");
+  return 0;
 }