Update documentation.
[awesomized/libmemcached] / tests / hashkit_functions.c
index 53c94b59c3eb3dbde9313d97da396039b16fc91e..23feb9e50a6f3e46459684fb0a9196d07081359a 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <libhashkit/hashkit.h>
 
-#include "test.h"
+#include <libtest/test.h>
 
 #include "hash_results.h"
 
@@ -262,6 +262,7 @@ static test_return_t murmur_run (hashkit_st *hashk)
   (void)hashk;
 
 #ifdef WORDS_BIGENDIAN
+  (void)murmur_values;
   return TEST_SKIPPED;
 #else
   uint32_t x;
@@ -271,7 +272,11 @@ static test_return_t murmur_run (hashkit_st *hashk)
   {
     uint32_t hash_val;
 
+#ifdef HAVE_MURMUR_HASH
     hash_val= libhashkit_murmur(*ptr, strlen(*ptr));
+#else
+    hash_val= 1;
+#endif
     assert(murmur_values[x] == hash_val);
   }
 
@@ -330,13 +335,20 @@ static test_return_t hashkit_set_function_test(hashkit_st *hashk)
     rc= hashkit_set_function(hashk, algo);
 
     /* Hsieh is disabled most of the time for patent issues */
+#ifndef HAVE_HSIEH_HASH
     if (rc == HASHKIT_FAILURE && algo == HASHKIT_HASH_HSIEH)
       continue;
+#endif
+
+#ifndef HAVE_MURMUR_HASH
+    if (rc == HASHKIT_FAILURE && algo == HASHKIT_HASH_MURMUR)
+      continue;
+#endif
 
-    if (rc == HASHKIT_FAILURE && algo == HASHKIT_HASH_CUSTOM)
+    if (rc == HASHKIT_INVALID_ARGUMENT && algo == HASHKIT_HASH_CUSTOM)
       continue;
 
-    test_true(rc == HASHKIT_SUCCESS);
+    test_true_got(rc == HASHKIT_SUCCESS, hashkit_strerror(NULL, rc));
 
     switch (algo)
     {
@@ -436,7 +448,7 @@ static test_return_t hashkit_set_distribution_function_test(hashkit_st *hashk)
     if (rc == HASHKIT_FAILURE && algo == HASHKIT_HASH_HSIEH)
       continue;
 
-    if (rc == HASHKIT_FAILURE && algo == HASHKIT_HASH_CUSTOM)
+    if (rc == HASHKIT_INVALID_ARGUMENT && algo == HASHKIT_HASH_CUSTOM)
       continue;
 
     test_true(rc == HASHKIT_SUCCESS);