Commit dfc0c796 authored by Pieter Noordhuis's avatar Pieter Noordhuis
Browse files

String equality helper

parent 77a045ff
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define _TEST_HELPER_H 1 #define _TEST_HELPER_H 1
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <assert.h> #include <assert.h>
#define assert_equal(a, b, type, fmt) do { \ #define assert_equal(a, b, type, fmt) do { \
...@@ -32,4 +33,13 @@ ...@@ -32,4 +33,13 @@
assert_equal(a, b, double, "%f"); \ assert_equal(a, b, double, "%f"); \
} while(0) } while(0)
#define assert_equal_string(a,b) do { \
if (strcmp(a, b)) { \
fprintf(stderr, \
"%s:%d: %s != %s\n", \
__FILE__, __LINE__, a, b); \
assert(0); \
} \
} while(0)
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment