} \
} while (0)
+#define test_compare(A,B) \
+do \
+{ \
+ if ((A) != (B)) \
+ { \
+ fprintf(stderr, "\n%s:%d: Expected %s, got %lu\n", __FILE__, __LINE__, #A, (unsigned long)(B)); \
+ create_core(); \
+ return TEST_FAILURE; \
+ } \
+} while (0)
+
+#define test_compare_got(A,B,C) \
+do \
+{ \
+ if ((A) != (B)) \
+ { \
+ fprintf(stderr, "\n%s:%d: Expected %s, got %s\n", __FILE__, __LINE__, #A, (C)); \
+ create_core(); \
+ return TEST_FAILURE; \
+ } \
+} while (0)
+
#define test_false(A) \
do \
{ \
} \
} while (0)
+#define test_false_with(A,B) \
+do \
+{ \
+ if ((A)) { \
+ fprintf(stderr, "\nAssertion failed at %s:%d: %s with %s\n", __FILE__, __LINE__, #A, (B));\
+ create_core(); \
+ return TEST_FAILURE; \
+ } \
+} while (0)
+
#define test_strcmp(A,B) \
do \
{ \
if (strcmp((A), (B))) \
{ \
- fprintf(stderr, "\n%s:%d: %s -> %s\n", __FILE__, __LINE__, (A), (B)); \
+ fprintf(stderr, "\n%s:%d: `%s` -> `%s`\n", __FILE__, __LINE__, (A), (B)); \
create_core(); \
return TEST_FAILURE; \
} \
} 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)