summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2984c03)
raw | patch | inline | side by side (parent: 2984c03)
author | Tomi Valkeinen <tomi.valkeinen@iki.fi> | |
Fri, 2 Oct 2015 18:34:38 +0000 (21:34 +0300) | ||
committer | Tomi Valkeinen <tomi.valkeinen@iki.fi> | |
Sat, 3 Oct 2015 13:59:19 +0000 (16:59 +0300) |
libkmstest/test.h | patch | blob | history |
diff --git a/libkmstest/test.h b/libkmstest/test.h
index 0913e79b8058ccc9b3abaaa32a827954e11de370..f4cec599e7e83cc9d6c127f04650466e4d1d9594 100644 (file)
--- a/libkmstest/test.h
+++ b/libkmstest/test.h
#include "conv.h"
#include "testpat.h"
#include "conv.h"
#include "testpat.h"
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
#define unlikely(x) __builtin_expect(!!(x), 0)
static void ASSERT_FAIL(const char *cond, const char *file,
#define unlikely(x) __builtin_expect(!!(x), 0)
static void ASSERT_FAIL(const char *cond, const char *file,
#define ASSERT(x) if (unlikely(!(x))) { ASSERT_FAIL( __STRING(x), __FILE__, __LINE__, __PRETTY_FUNCTION__); }
#define ASSERT(x) if (unlikely(!(x))) { ASSERT_FAIL( __STRING(x), __FILE__, __LINE__, __PRETTY_FUNCTION__); }
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+static void FAIL_IF_FAIL(const char *txt, const char *file,
+ unsigned int line, const char *func) __attribute__ ((__noreturn__));
+
+static void FAIL_IF_FAIL(const char *txt, const char *file,
+ unsigned int line, const char *func)
+{
+ fprintf(stderr, "%s:%d: %s: FAIL: %s\n", file, line, func, txt);
+ abort();
+}
+
+#define FAIL_IF(x, y) if (unlikely(x)) { FAIL_IF_FAIL(y, __FILE__, __LINE__, __PRETTY_FUNCTION__); }