test_common.h: handle Check versions < 0.11
The nicer assertion macros are relatively recent; add a compatibility
shim for systems that don't have a bleeding-edge Check. (Ubuntu 16.04
ships with 0.10.0, for instance.)
#include <apr.h> /* for pid_t on Windows, needed by Check */
#include <check.h>
+/*
+ * Compatibility ck_assert macros for Check < 0.11.
+ */
+#if (CHECK_MAJOR_VERSION == 0) && (CHECK_MINOR_VERSION < 11)
+# include <math.h> /* fabs() */
+# include <string.h> /* memcmp() */
+
+# define ck_assert_double_eq_tol(a, b, tol) \
+ ck_assert(fabs((a) - (b)) <= (tol))
+# define ck_assert_mem_eq(a, b, len) \
+ ck_assert(!memcmp((a), (b), (len)))
+# define ck_assert_ptr_nonnull(p) \
+ ck_assert((p) != NULL)
+#endif
+
/*
* A list of Check test case declarations, usually one per source file. Add your
* test case here when adding a new source file, then add it to the
