mirror of https://github.com/yandex/odyssey.git
29 lines
497 B
C
29 lines
497 B
C
#ifndef MACHINARIUM_TEST_H
|
|
#define MACHINARIUM_TEST_H
|
|
|
|
/*
|
|
* machinarium.
|
|
*
|
|
* cooperative multitasking engine.
|
|
*/
|
|
|
|
#define machinarium_test(function) \
|
|
do { \
|
|
fprintf(stdout, "%s: ", #function); \
|
|
fflush(stdout); \
|
|
(function)(); \
|
|
fprintf(stdout, "ok\n"); \
|
|
} while (0);
|
|
|
|
#define test(expression) \
|
|
do { \
|
|
if (! (expression)) { \
|
|
fprintf(stdout, "fail (%s:%d) %s\n", \
|
|
__FILE__, __LINE__, #expression); \
|
|
fflush(stdout); \
|
|
abort(); \
|
|
} \
|
|
} while (0);
|
|
|
|
#endif
|