summaryrefslogtreecommitdiff
path: root/auto_tests/check_compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests/check_compat.h')
-rw-r--r--auto_tests/check_compat.h74
1 files changed, 66 insertions, 8 deletions
diff --git a/auto_tests/check_compat.h b/auto_tests/check_compat.h
index e4fde89f..755dea81 100644
--- a/auto_tests/check_compat.h
+++ b/auto_tests/check_compat.h
@@ -1,8 +1,66 @@
1#ifdef _MSC_VER 1#ifndef CHECK_COMPAT_H
2#define pid_t int 2#define CHECK_COMPAT_H
3// #include <libcompat.h> 3
4#endif 4#include "../toxcore/ccompat.h"
5#include <check.h> 5
6#ifdef _MSC_VER 6#include <stdbool.h>
7#undef pid_t 7#include <stdio.h>
8#endif 8
9#define START_TEST(name) static void name(void)
10#define END_TEST
11
12#define DEFTESTCASE(NAME) test_##NAME()
13#define DEFTESTCASE_SLOW(NAME, TIMEOUT) test_##NAME()
14
15typedef struct Suite Suite;
16typedef struct SRunner SRunner;
17enum SRunMode { CK_NORMAL };
18
19Suite *suite_create(const char *title)
20{
21 printf("Running test suite: %s\n", title);
22 return nullptr;
23}
24
25SRunner *srunner_create(Suite *s)
26{
27 return nullptr;
28}
29
30void srunner_free(SRunner *s)
31{
32}
33
34void srunner_run_all(SRunner *r, int mode)
35{
36}
37
38int srunner_ntests_failed(SRunner *r)
39{
40 return 0;
41}
42
43#define ck_assert(ok) do { \
44 if (!(ok)) { \
45 fprintf(stderr, "%s:%d: failed `%s'\n", __FILE__, __LINE__, #ok); \
46 exit(EXIT_FAILURE); \
47 } \
48} while (0)
49
50#define ck_assert_msg(ok, ...) do { \
51 if (!(ok)) { \
52 fprintf(stderr, "%s:%d: failed `%s': ", __FILE__, __LINE__, #ok); \
53 fprintf(stderr, __VA_ARGS__); \
54 fprintf(stderr, "\n"); \
55 exit(EXIT_FAILURE); \
56 } \
57} while (0)
58
59#define ck_abort_msg(...) do { \
60 fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
61 fprintf(stderr, __VA_ARGS__); \
62 fprintf(stderr, "\n"); \
63 exit(EXIT_FAILURE); \
64} while (0)
65
66#endif // CHECK_COMPAT_H