2018-04-04 14:35:50 +00:00
|
|
|
#ifndef ODYSSEY_TEST_H
|
|
|
|
#define ODYSSEY_TEST_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Odyssey.
|
|
|
|
*
|
|
|
|
* Scalable PostgreSQL connection pooler.
|
|
|
|
*/
|
|
|
|
|
2018-06-10 09:40:42 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2018-04-04 14:35:50 +00:00
|
|
|
#define odyssey_test(function) \
|
|
|
|
do { \
|
|
|
|
fprintf(stdout, "%s: ", #function); \
|
|
|
|
fflush(stdout); \
|
|
|
|
(function)(); \
|
|
|
|
fprintf(stdout, "ok\n"); \
|
|
|
|
} while (0);
|
|
|
|
|
|
|
|
#define test(expression) \
|
|
|
|
do { \
|
|
|
|
if (! (expression)) { \
|
2018-06-10 09:40:42 +00:00
|
|
|
fprintf(stdout, "fail (%s:%d) with error \"%s\" (%d) %s\n", \
|
|
|
|
__FILE__, __LINE__, strerror(errno), errno, #expression); \
|
2018-04-04 14:35:50 +00:00
|
|
|
fflush(stdout); \
|
|
|
|
abort(); \
|
|
|
|
} \
|
|
|
|
} while (0);
|
|
|
|
|
|
|
|
#endif /* ODYSSEY_TEST_H */
|