Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lwip_check.h Source File

lwip_check.h

00001 #ifndef LWIP_HDR_LWIP_CHECK_H
00002 #define LWIP_HDR_LWIP_CHECK_H
00003 
00004 /* Common header file for lwIP unit tests using the check framework */
00005 
00006 #include <config.h>
00007 #include <check.h>
00008 #include <stdlib.h>
00009 
00010 #define FAIL_RET() do { fail(); return; } while(0)
00011 #define EXPECT(x) fail_unless(x)
00012 #define EXPECT_RET(x) do { fail_unless(x); if(!(x)) { return; }} while(0)
00013 #define EXPECT_RETX(x, y) do { fail_unless(x); if(!(x)) { return y; }} while(0)
00014 #define EXPECT_RETNULL(x) EXPECT_RETX(x, NULL)
00015 
00016 typedef struct {
00017   TFun func;
00018   const char *name;
00019 } testfunc;
00020 
00021 #define TESTFUNC(x) {(x), "" # x "" }
00022 
00023 /* Modified function from check.h, supplying function name */
00024 #define tcase_add_named_test(tc,tf) \
00025    _tcase_add_test((tc),(tf).func,(tf).name,0, 0, 0, 1)
00026 
00027 /** typedef for a function returning a test suite */
00028 typedef Suite* (suite_getter_fn)(void);
00029 
00030 /** Create a test suite */
00031 Suite* create_suite(const char* name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown);
00032 
00033 #ifdef LWIP_UNITTESTS_LIB
00034 int lwip_unittests_run(void)
00035 #endif
00036 
00037 #endif /* LWIP_HDR_LWIP_CHECK_H */