2018-09-10 03:54:05 +08:00
|
|
|
#ifndef C_TOXCORE_AUTO_TESTS_CHECK_COMPAT_H
|
|
|
|
#define C_TOXCORE_AUTO_TESTS_CHECK_COMPAT_H
|
2018-02-06 05:38:58 +08:00
|
|
|
|
|
|
|
#include "../toxcore/ccompat.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2018-06-20 04:54:21 +08:00
|
|
|
#include <stdlib.h>
|
2018-02-06 05:38:58 +08:00
|
|
|
|
|
|
|
#define ck_assert(ok) do { \
|
|
|
|
if (!(ok)) { \
|
|
|
|
fprintf(stderr, "%s:%d: failed `%s'\n", __FILE__, __LINE__, #ok); \
|
2018-08-26 21:18:43 +08:00
|
|
|
abort(); \
|
2018-02-06 05:38:58 +08:00
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define ck_assert_msg(ok, ...) do { \
|
|
|
|
if (!(ok)) { \
|
|
|
|
fprintf(stderr, "%s:%d: failed `%s': ", __FILE__, __LINE__, #ok); \
|
|
|
|
fprintf(stderr, __VA_ARGS__); \
|
|
|
|
fprintf(stderr, "\n"); \
|
2018-08-26 21:18:43 +08:00
|
|
|
abort(); \
|
2018-02-06 05:38:58 +08:00
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define ck_abort_msg(...) do { \
|
|
|
|
fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
|
|
|
|
fprintf(stderr, __VA_ARGS__); \
|
|
|
|
fprintf(stderr, "\n"); \
|
2018-08-26 21:18:43 +08:00
|
|
|
abort(); \
|
2018-02-06 05:38:58 +08:00
|
|
|
} while (0)
|
|
|
|
|
2018-09-10 03:54:05 +08:00
|
|
|
#endif // C_TOXCORE_AUTO_TESTS_CHECK_COMPAT_H
|