ReactOS 0.4.16-dev-336-gb667d82
lwip_check.h
Go to the documentation of this file.
1#ifndef LWIP_HDR_LWIP_CHECK_H
2#define LWIP_HDR_LWIP_CHECK_H
3
4/* Common header file for lwIP unit tests using the check framework */
5
6#include <config.h>
7#include <check.h>
8#include <stdlib.h>
9
10#define FAIL_RET() do { fail(); return; } while(0)
11#define EXPECT(x) fail_unless(x)
12#define EXPECT_RET(x) do { fail_unless(x); if(!(x)) { return; }} while(0)
13#define EXPECT_RETX(x, y) do { fail_unless(x); if(!(x)) { return y; }} while(0)
14#define EXPECT_RETNULL(x) EXPECT_RETX(x, NULL)
15
16#if (CHECK_MAJOR_VERSION == 0 && CHECK_MINOR_VERSION < 13)
17typedef struct {
18 TFun func;
19 const char *name;
20} testfunc;
21
22#define TESTFUNC(x) {(x), "" # x "" }
23
24/* Modified function from check.h, supplying function name */
25#define tcase_add_named_test(tc,tf) \
26 _tcase_add_test((tc),(tf).func,(tf).name,0, 0, 0, 1)
27
28#else
29/* From 0.13.0 check keeps track of the method name internally */
30typedef const TTest * testfunc;
31
32#define TESTFUNC(x) x
33
34#define tcase_add_named_test(tc,tf) tcase_add_test(tc,tf)
35#endif
36
38typedef Suite* (suite_getter_fn)(void);
39
41Suite* create_suite(const char* name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown);
42
43#ifdef LWIP_UNITTESTS_LIB
44int lwip_unittests_run(void)
45#endif
46
47/* helper functions */
48#define SKIP_POOL(x) (1 << x)
49#define SKIP_HEAP (1 << MEMP_MAX)
50void lwip_check_ensure_no_alloc(unsigned int skip);
51
52#endif /* LWIP_HDR_LWIP_CHECK_H */
#define skip(...)
Definition: atltest.h:64
Suite * create_suite(const char *name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown)
void lwip_check_ensure_no_alloc(unsigned int skip)
Suite *() suite_getter_fn(void)
Definition: lwip_check.h:38
static struct test_info tests[]
static void teardown(void)
Definition: enum_files.c:130
static BOOL setup(void)
Definition: enum_files.c:97
Definition: name.c:39
const char * name
Definition: lwip_check.h:19
TFun func
Definition: lwip_check.h:18