iFix for OSX
[m6w6/libmemcached] / libtest / test.h
index 58d24373ea8d17e3cf40c5b34ad366f69883fff1..656be1698967f36f92c0d50b6aefbb5b99e4cee0 100644 (file)
@@ -217,6 +217,17 @@ do \
   } \
 } while (0)
 
+#define test_compare(A,B) \
+do \
+{ \
+  if ((A) != (B)) \
+  { \
+    fprintf(stderr, "\n%s:%d: Expected %lu == %lu\n", __FILE__, __LINE__, (unsigned long)(A), (unsigned long)(B)); \
+    create_core(); \
+    return TEST_FAILURE; \
+  } \
+} while (0)
+
 #define test_false(A) \
 do \
 { \
@@ -248,6 +259,16 @@ do \
   } \
 } while (0)
 
+#define test_memcmp(A,B,C) \
+do \
+{ \
+  if (memcmp((A), (B), (C))) \
+  { \
+    fprintf(stderr, "\n%s:%d: %.*s -> %.*s\n", __FILE__, __LINE__, (int)(C), (char *)(A), (int)(C), (char *)(B)); \
+    create_core(); \
+    return TEST_FAILURE; \
+  } \
+} while (0)
 
 #define STRINGIFY(x) #x
 #define TOSTRING(x) STRINGIFY(x)