1 #ifndef __LWIP_CHECK_H__
2 #define __LWIP_CHECK_H__
4 /* Common header file for lwIP unit tests using the check framework */
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)
16 /** typedef for a function returning a test suite */
17 typedef Suite* (suite_getter_fn)(void);
19 /** Create a test suite */
20 static Suite* create_suite(const char* name, TFun *tests, size_t num_tests, SFun setup, SFun teardown)
23 Suite *s = suite_create(name);
25 for(i = 0; i < num_tests; i++) {
27 TCase *tc_core = tcase_create("Core");
28 if ((setup != NULL) || (teardown != NULL)) {
29 tcase_add_checked_fixture(tc_core, setup, teardown);
31 tcase_add_test(tc_core, tests[i]);
32 suite_add_tcase(s, tc_core);
37 #endif /* __LWIP_CHECK_H__ */