unit: Support check v0.13.0 and later

Function name no longer needs to be fed separately when adding tests.

Also fix collision of non-static net_test variables in dhcp and netif
tests.
This commit is contained in:
Erik Ekman 2020-06-19 15:36:33 +02:00
parent 9b1056ef0e
commit ea111c511e
3 changed files with 12 additions and 2 deletions

View File

@ -9,7 +9,7 @@
#error "This tests needs LWIP_NETIF_EXT_STATUS_CALLBACK enabled"
#endif
struct netif net_test;
static struct netif net_test;
/* Setups/teardown functions */

View File

@ -18,7 +18,7 @@
#endif
struct netif net_test;
static struct netif net_test;
static const u8_t broadcast[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };

View File

@ -13,6 +13,7 @@
#define EXPECT_RETX(x, y) do { fail_unless(x); if(!(x)) { return y; }} while(0)
#define EXPECT_RETNULL(x) EXPECT_RETX(x, NULL)
#if (CHECK_MAJOR_VERSION == 0 && CHECK_MINOR_VERSION < 13)
typedef struct {
TFun func;
const char *name;
@ -24,6 +25,15 @@ typedef struct {
#define tcase_add_named_test(tc,tf) \
_tcase_add_test((tc),(tf).func,(tf).name,0, 0, 0, 1)
#else
/* From 0.13.0 check keeps track of the method name internally */
typedef const TTest * testfunc;
#define TESTFUNC(x) x
#define tcase_add_named_test(tc,tf) tcase_add_test(tc,tf)
#endif
/** typedef for a function returning a test suite */
typedef Suite* (suite_getter_fn)(void);