aboutsummaryrefslogtreecommitdiffstats
path: root/test.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2018-08-18 23:40:11 +0200
committerMattias Andrée <maandree@kth.se>2018-08-18 23:40:11 +0200
commit3e746c51b3adcf97e4d11be30bfd91c8aaf2c2ba (patch)
treea00b8ec51cfaf110d8bf36daa91827c95dc107e7 /test.h
parentImprove makefile (diff)
downloadlibsimple-3e746c51b3adcf97e4d11be30bfd91c8aaf2c2ba.tar.gz
libsimple-3e746c51b3adcf97e4d11be30bfd91c8aaf2c2ba.tar.bz2
libsimple-3e746c51b3adcf97e4d11be30bfd91c8aaf2c2ba.tar.xz
Fix and run tests
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'test.h')
-rw-r--r--test.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/test.h b/test.h
new file mode 100644
index 0000000..2a1c656
--- /dev/null
+++ b/test.h
@@ -0,0 +1,19 @@
+/* See LICENSE file for copyright and license details. */
+
+
+#define assert(EXPR)\
+ do {\
+ if (EXPR)\
+ break;\
+ fprintf(stderr, "Failed at %s:%i: %s\n", __FILE__, __LINE__, #EXPR);\
+ exit(1);\
+ } while (0)
+
+
+
+#define strcmp(...) test_strcmp(__VA_ARGS__)
+static inline int
+test_strcmp(const char *a, const char *b)
+{
+ return (!a || !b) ? !b - !a : (strcmp)(a, b);
+}