Преглед изворни кода

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.
Erik Ekman пре 5 година
родитељ
комит
ea111c511e
3 измењених фајлова са 12 додато и 2 уклоњено
  1. 1 1
      test/unit/core/test_netif.c
  2. 1 1
      test/unit/dhcp/test_dhcp.c
  3. 10 0
      test/unit/lwip_check.h

+ 1 - 1
test/unit/core/test_netif.c

@@ -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 */

+ 1 - 1
test/unit/dhcp/test_dhcp.c

@@ -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 };
 

+ 10 - 0
test/unit/lwip_check.h

@@ -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);