Added bool type assert
This commit is contained in:
1 parent
9eb8d5f682
commit
e37b54fc62
1 file changed
+33
@@ -38,6 +38,7 @@
|
|||||||
* - float
|
* - float
|
||||||
* - double
|
* - double
|
||||||
* - ptr
|
* - ptr
|
||||||
|
* - bool (only for equals and not_equals)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -369,6 +370,22 @@
|
|||||||
\
|
\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define cmc_assert_equals__Bool(expected, actual) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
const char *str = #actual; \
|
||||||
|
bool expected_ = (expected); \
|
||||||
|
bool actual_ = (actual); \
|
||||||
|
\
|
||||||
|
if ((expected_) != (actual_)) \
|
||||||
|
{ \
|
||||||
|
fprintf(stderr, \
|
||||||
|
"Assertion Failed at %s:%s:%u for { %s }: Expected: %d Actual: %d\n", \
|
||||||
|
__FILE__, __func__, __LINE__, str, expected_, actual_); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define cmc_assert_not_equals_int8_t(not_expected, actual) \
|
#define cmc_assert_not_equals_int8_t(not_expected, actual) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
@@ -593,6 +610,22 @@
|
|||||||
\
|
\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define cmc_assert_not_equals__Bool(expected, actual) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
const char *str = #actual; \
|
||||||
|
bool expected_ = (expected); \
|
||||||
|
bool actual_ = (actual); \
|
||||||
|
\
|
||||||
|
if ((expected_) != (actual_)) \
|
||||||
|
{ \
|
||||||
|
fprintf(stderr, \
|
||||||
|
"Assertion Failed at %s:%s:%u for { %s }: Not Expected: %d Actual: %d\n", \
|
||||||
|
__FILE__, __func__, __LINE__, str, expected_, actual_); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define cmc_assert_greater_int8_t(boundary, actual) \
|
#define cmc_assert_greater_int8_t(boundary, actual) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
|
|||||||
Reference in new issue
Block a user