test: allow unit tests to be skipped

This commit is contained in:
Miroslav Lichvar 2018-09-27 09:31:13 +02:00
parent 3e876d4218
commit 91dbe3c6c2
2 changed files with 16 additions and 0 deletions

View file

@ -33,6 +33,13 @@ TST_Fail(int line)
exit(1);
}
void
TST_Skip(int line)
{
printf("SKIP (on line %d)\n", line);
exit(0);
}
int
main(int argc, char **argv)
{

View file

@ -33,7 +33,16 @@ extern void test_unit(void);
} \
} while (0)
#define TEST_REQUIRE(expr) \
do { \
if (!(expr)) { \
TST_Skip(__LINE__); \
exit(0); \
} \
} while (0)
extern void TST_Fail(int line);
extern void TST_Skip(int line);
extern void TST_SuspendLogging(void);
extern void TST_ResumeLogging(void);