summaryrefslogtreecommitdiff
path: root/test/lib/testassert.h
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2007-09-22 13:32:42 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2007-09-22 13:32:42 +0000
commitf1f80696ebe87520de0c857371e0ca109fce68cb (patch)
tree66b241e6ef7384e9bed2b57b11c5d8f075601b12 /test/lib/testassert.h
parentdac9bafa302a42ef8e58fa017739cc29a046413f (diff)
downloadlibdom-f1f80696ebe87520de0c857371e0ca109fce68cb.tar.gz
libdom-f1f80696ebe87520de0c857371e0ca109fce68cb.tar.bz2
Create a library of utility functions for the testsuite to use
Make test/binding.c include stdio.h itself rather than relying on other things to include it. svn path=/trunk/dom/; revision=3568
Diffstat (limited to 'test/lib/testassert.h')
-rw-r--r--test/lib/testassert.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lib/testassert.h b/test/lib/testassert.h
new file mode 100644
index 0000000..329feff
--- /dev/null
+++ b/test/lib/testassert.h
@@ -0,0 +1,22 @@
+/*
+ * This file is part of libdom test suite.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
+ */
+
+#ifndef testassert_h_
+#define testassert_h_
+
+/* Redefine assert, so we can simply use the standard assert mechanism
+ * within testcases and exit with the right output for the testrunner
+ * to do the right thing. */
+void __assert2(const char *expr, const char *function,
+ const char *file, int line);
+
+#define assert(expr) \
+ ((void) ((expr) || (__assert2 (#expr, __func__, __FILE__, __LINE__), 0)))
+
+
+#endif
+