test: Added definition to make default testing less verbose
TEST_VERBOSE is a preprocesser directive which TEST is dependent on. By default it is 0, in which case TEST simply fails if the condition is not true. Otherwise, a full log (as done previously) is made.
This commit is contained in:
15
test/test.h
15
test/test.h
@@ -10,7 +10,12 @@
|
|||||||
|
|
||||||
#include <alisp/alisp.h>
|
#include <alisp/alisp.h>
|
||||||
|
|
||||||
|
#ifndef TEST_VERBOSE
|
||||||
|
#define TEST_VERBOSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TEST_PASSED() printf("\t[%s]: Passed\n", __func__)
|
#define TEST_PASSED() printf("\t[%s]: Passed\n", __func__)
|
||||||
|
#if TEST_VERBOSE
|
||||||
#define TEST(COND, ...) \
|
#define TEST(COND, ...) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
@@ -30,6 +35,16 @@
|
|||||||
assert(0); \
|
assert(0); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
#else
|
||||||
|
#define TEST(COND, ...) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if (!(COND)) \
|
||||||
|
{ \
|
||||||
|
assert(0); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct TestFn
|
typedef struct TestFn
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user