aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKaterina Barone-Adesi <kat.obsc@gmail.com>2013-03-03 10:36:52 +0000
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-03-09 23:52:29 +0100
commit008e53baaeba1aaf126b11b5c211a1110e9dc087 (patch)
treee9929aeed60d619420ca59a3640cc8130f681301 /include
parent45cdaa095a0e2fe9558de682e1c12229dfab9adc (diff)
utils: Introduce OSMO_ASSERT in the utils and use it in the unit tests
The tests should unconditionally assert, regardless of debug settings. This uses the OSMO_ prefix as it's in the global namespace.
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/core/utils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index 03861d78..8f7bee31 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -51,6 +51,13 @@ do { \
rem -= ret; \
} while (0)
+#define OSMO_ASSERT(exp) \
+ if (!(exp)) { \
+ printf("Assert failed %s %s:%d\n", #exp, __FILE__, __LINE__); \
+ abort(); \
+ }
+
+
/*! @} */
#endif