3 ms·
I'm not very familiar with C and macros so it took me a while to realize that this line: mu_assert("error, bar != 5", bar == 5); will return out of the func
by crescentfresh 8y ago
I'm not very familiar with C and macros so it took me a while to realize that this line:
mu_assert("error, bar != 5", bar == 5);
will return out of the function before reaching the next line.
For anyone else like me, I put together the "inlined" version of the code to help me understand what is happening:
#include <stdio.h>
#include "minunit.h"
int tests_run = 0;
int foo = 7;
static char * test_foo() {
do {
if (!(foo == 7))
return "error, foo != 7";
} while (0);
return 0;
}
static char * all_tests() {
do {
char *message = test_foo();
tests_run++;
if (message)
return message;
} while (0);
// ... more tests here
return 0;
}