From bb5ca6546defea56658eec81edae3626a181e64e Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Sat, 27 Mar 2010 16:51:25 +0000 Subject: Tests: add macros to test for string equality --- tests/tests.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/tests.h b/tests/tests.h index 46b260d2..aaa3b101 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -60,4 +60,16 @@ fail_unless(__tmp1 != __tmp2, "%s:%i: " #what " is equal to " #to "(%p)", __func__, __LINE__, (void*)__tmp2); \ } +#define check_str_equals(what, to) \ +{ typeof(what) __tmp; \ + __tmp = (what); \ + fail_unless(g_strcmp0(__tmp, to) == 0, "%s:%i: " #what " (%s) is not equal to %s", __func__, __LINE__, __tmp, to); \ +} + +#define check_str_not_equals(what, to) \ +{ typeof(what) __tmp; \ + __tmp = (what); \ + fail_unless(g_strcmp0(__tmp, to) != 0, "%s:%i: " #what " is equal to %s", __func__, __LINE__, to); \ +} + #endif /*__TESTS_H__ */ -- cgit