fix(test): improve testing macros
This commit is contained in:
parent
945343daa0
commit
edbe9ba3b8
1 changed files with 15 additions and 14 deletions
5
test.c
5
test.c
|
|
@ -12,12 +12,13 @@
|
|||
tests \
|
||||
_tests_passed += _tests; \
|
||||
printf("%s: %d/%d tests passed\n", name, _tests_passed, _tests); \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
#define it(message, test) do { \
|
||||
_tests++; \
|
||||
if (!(test)) { \
|
||||
printf("%s %s FAILED\n", _test_name, message); \
|
||||
printf("%s %s FAILED @ %s:%d\n", _test_name, message, __FILE__, __LINE__); \
|
||||
printf(" -> test condition: (%s)\n", #test); \
|
||||
_tests_passed--; \
|
||||
} \
|
||||
} while (0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue