2018-02-06 05:38:58 +08:00
|
|
|
#ifndef CHECK_COMPAT_H
|
|
|
|
#define CHECK_COMPAT_H
|
|
|
|
|
|
|
|
#include "../toxcore/ccompat.h"
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdio.h>
|
2018-06-20 04:54:21 +08:00
|
|
|
#include <stdlib.h>
|
2018-02-06 05:38:58 +08:00
|
|
|
|
|
|
|
#define START_TEST(name) static void name(void)
|
|
|
|
#define END_TEST
|
|
|
|
|
|
|
|
#define DEFTESTCASE(NAME) test_##NAME()
|
|
|
|
#define DEFTESTCASE_SLOW(NAME, TIMEOUT) test_##NAME()
|
|
|
|
|
|
|
|
typedef struct Suite Suite;
|
|
|
|
typedef struct SRunner SRunner;
|
|
|
|
enum SRunMode { CK_NORMAL };
|
|
|
|
|
2018-02-23 10:22:38 +08:00
|
|
|
static inline Suite *suite_create(const char *title)
|
2018-02-06 05:38:58 +08:00
|
|
|
{
|
|
|
|
printf("Running test suite: %s\n", title);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2018-02-23 10:22:38 +08:00
|
|
|
static inline SRunner *srunner_create(Suite *s)
|
2018-02-06 05:38:58 +08:00
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2018-02-23 10:22:38 +08:00
|
|
|
static inline void srunner_free(SRunner *s)
|
2018-02-06 05:38:58 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-02-23 10:22:38 +08:00
|
|
|
static inline void srunner_run_all(SRunner *r, int mode)
|
2018-02-06 05:38:58 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-02-23 10:22:38 +08:00
|
|
|
static inline int srunner_ntests_failed(SRunner *r)
|
2018-02-06 05:38:58 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#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)
|
|
|
|
|
|
|
|
#endif // CHECK_COMPAT_H
|