From f37065bf846a9b270297fc15afaf9741206cee60 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Wed, 9 Nov 2016 12:49:52 -0800 Subject: [PATCH] ztest: add assert_not_equal() Assertion for complementing assert_equal() Change-Id: Ie3066f3b00ea3145a62ffb7e0d6c2c4de1719b4c Signed-off-by: Inaky Perez-Gonzalez --- tests/ztest/include/ztest_assert.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/ztest/include/ztest_assert.h b/tests/ztest/include/ztest_assert.h index ea5628a36d0..a150b836e69 100644 --- a/tests/ztest/include/ztest_assert.h +++ b/tests/ztest/include/ztest_assert.h @@ -135,6 +135,17 @@ static inline void _assert(int cond, const char *msg, const char *default_msg, */ #define assert_equal(a, b, msg) assert((a) == (b), msg, #a " not equal to " #b) +/** + * @brief Assert that @a a does not equal @a b + * + * @a a and @a b won't be converted and will be compared directly. + * + * @param a Value to compare + * @param b Value to compare + * @param msg Optional message to print if the assertion fails + */ +#define assert_not_equal(a, b, msg) assert((a) != (b), msg, #a " equal to " #b) + /** * @brief Assert that @a a equals @a b *