block -> va_args
having them as blocks causes issues when a struct with values is initialized inside the block, because the compiler treats the comma in the struct defenition as seperate arguments.
This commit is contained in:
parent
25b0e92ed0
commit
c1c3e87444
4
test.h
4
test.h
@ -36,7 +36,7 @@ static test_func_t test_functions[MAX_TEST_FUNCS];
|
||||
return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; \
|
||||
}
|
||||
|
||||
#define TEST(NAME, BLOCK) \
|
||||
#define TEST(NAME, ...) \
|
||||
static int test_##NAME(); \
|
||||
__attribute__((constructor)) static void register_test_##NAME() { \
|
||||
if (total < MAX_TEST_FUNCS) { \
|
||||
@ -50,7 +50,7 @@ static test_func_t test_functions[MAX_TEST_FUNCS];
|
||||
printf("\ntest_" #NAME "\n"); \
|
||||
int total_assert = 0; \
|
||||
int total_success = 0; \
|
||||
BLOCK \
|
||||
__VA_ARGS__ \
|
||||
printf("\t(%d/%d) passed (%d) failed\n", total_success, total_assert, total_assert - total_success); \
|
||||
return (total_assert == total_success); \
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user