From 008e53baaeba1aaf126b11b5c211a1110e9dc087 Mon Sep 17 00:00:00 2001 From: Katerina Barone-Adesi Date: Sun, 3 Mar 2013 10:36:52 +0000 Subject: 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. --- include/osmocom/core/utils.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/osmocom/core/utils.h') 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 -- cgit v1.2.3