Commit 4085de542efe4ded89586c943ec8476c757671a2

Authored by Georg Hopp
1 parent 58a2aba8

add new assertion macros

Showing 1 changed file with 9 additions and 0 deletions
... ... @@ -2,6 +2,7 @@
2 2 #define __RUNTEST_h__
3 3
4 4 #include <sys/types.h>
  5 +#include <string.h>
5 6
6 7
7 8 enum RESULT_TYPES {
... ... @@ -14,6 +15,14 @@ enum RESULT_TYPES {
14 15 #define ASSERT_NOT_NULL(value) if (NULL == (value)) return TEST_FAILED
15 16 #define ASSERT_EQUAL(val1,val2) if ((val1) != (val2)) return TEST_FAILED
16 17 #define ASSERT_NOT_EQUAL(val1,val2) if ((val1) == (val2)) return TEST_FAILED
  18 +#define ASSERT_MEM_EQUAL(val1,val2,size) \
  19 + if(0 != memcmp((val1), (val2), (size))) return TEST_FAILED
  20 +#define ASSERT_MEM_NOT_EQUAL(val1,val2,size) \
  21 + if(0 == memcmp((val1), (val2), (size))) return TEST_FAILED
  22 +#define ASSERT_STRING_EQUAL(val1,val2) \
  23 + if(0 != strcmp((val1), (val2))) return TEST_FAILED
  24 +#define ASSERT_STRING_NOT_EQUAL(val1,val2) \
  25 + if(0 == strcmp((val1), (val2))) return TEST_FAILED
17 26
18 27
19 28 typedef int (* const testfunc)(void);
... ...
Please register or login to post a comment