mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
49bb43f662
Using the full path including the repo name.
68 lines
2.1 KiB
C
68 lines
2.1 KiB
C
#ifndef C_TOXCORE_AUTO_TESTS_CHECK_COMPAT_H
|
|
#define C_TOXCORE_AUTO_TESTS_CHECK_COMPAT_H
|
|
|
|
#include "../toxcore/ccompat.h"
|
|
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#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 };
|
|
|
|
static inline Suite *suite_create(const char *title)
|
|
{
|
|
printf("Running test suite: %s\n", title);
|
|
return nullptr;
|
|
}
|
|
|
|
static inline SRunner *srunner_create(Suite *s)
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
static inline void srunner_free(SRunner *s)
|
|
{
|
|
}
|
|
|
|
static inline void srunner_run_all(SRunner *r, int mode)
|
|
{
|
|
}
|
|
|
|
static inline int srunner_ntests_failed(SRunner *r)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
#define ck_assert(ok) do { \
|
|
if (!(ok)) { \
|
|
fprintf(stderr, "%s:%d: failed `%s'\n", __FILE__, __LINE__, #ok); \
|
|
abort(); \
|
|
} \
|
|
} 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"); \
|
|
abort(); \
|
|
} \
|
|
} while (0)
|
|
|
|
#define ck_abort_msg(...) do { \
|
|
fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
|
|
fprintf(stderr, __VA_ARGS__); \
|
|
fprintf(stderr, "\n"); \
|
|
abort(); \
|
|
} while (0)
|
|
|
|
#endif // C_TOXCORE_AUTO_TESTS_CHECK_COMPAT_H
|