From: Pavel Březina Date: Wed, 17 Jul 2013 09:07:39 +0000 (+0200) Subject: Add new macro fail_msg X-Git-Tag: cmocka-1.1.1~206 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f4d5735a0a1db705252d2ee8054475d1dc9e9b5;p=platform%2Fupstream%2Fcmocka.git Add new macro fail_msg Signed-off-by: Pavel Březina Reviewed-by: Andreas Schneider --- diff --git a/include/cmocka.h b/include/cmocka.h index 372e134..02757ef 100644 --- a/include/cmocka.h +++ b/include/cmocka.h @@ -1246,6 +1246,18 @@ void fail(void); #ifdef DOXYGEN /** + * @brief Forces the test to fail immediately and quit, printing the reason. + */ +void fail_msg(const char *msg, ...); +#else +#define fail_msg(msg, ...) do { \ + print_error("ERROR: " msg "\n", ##__VA_ARGS__); \ + fail(); \ +} while (0) +#endif + +#ifdef DOXYGEN +/** * @brief Generic method to run a single test. * * @param[in] #function The function to test.