]> git.meshlink.io Git - meshlink/blobdiff - test/blackbox/run_blackbox_tests/test_cases_blacklist.c
Fix __warn_unused_result__, add more of it and fix the resulting warnings.
[meshlink] / test / blackbox / run_blackbox_tests / test_cases_blacklist.c
index 15f1131a8e16b8111df5fe6dd0db1c03d7834976..8f9a118cafa43ca0f9be5d211c2d4be650c0a266 100644 (file)
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
 /* Modify this to change the logging level of Meshlink */
 #define TEST_MESHLINK_LOG_LEVEL MESHLINK_DEBUG
 
@@ -62,6 +66,8 @@ void test_case_mesh_blacklist_01(void **state) {
 static bool received;
 
 static void receive(meshlink_handle_t *mesh, meshlink_node_t *src, const void *data, size_t len) {
+       (void)mesh;
+
        const char *msg = data;
        assert(len);
 
@@ -73,6 +79,8 @@ static void receive(meshlink_handle_t *mesh, meshlink_node_t *src, const void *d
 static bool bar_reachable;
 
 static void status_cb(meshlink_handle_t *mesh, meshlink_node_t *node, bool reachable) {
+       (void)mesh;
+
        if(!strcmp(node->name, "bar") && reachable) {
                bar_reachable = true;
        }
@@ -91,8 +99,8 @@ static void status_cb(meshlink_handle_t *mesh, meshlink_node_t *node, bool reach
     but when enabled foo node should not receive data
 */
 bool test_steps_mesh_blacklist_01(void) {
-       meshlink_destroy("blacklist_conf.1");
-       meshlink_destroy("blacklist_conf.2");
+       assert(meshlink_destroy("blacklist_conf.1"));
+       assert(meshlink_destroy("blacklist_conf.2"));
 
        // Open two new meshlink instance.
        meshlink_handle_t *mesh1 = meshlink_open("blacklist_conf.1", "foo", "blacklist", DEV_CLASS_BACKBONE);
@@ -128,7 +136,7 @@ bool test_steps_mesh_blacklist_01(void) {
        sleep(1);
        assert(received);
 
-       meshlink_blacklist(mesh1, bar);
+       assert(meshlink_blacklist(mesh1, bar));
 
        received = false;
        assert(meshlink_send(mesh2, foo, "test", 5));
@@ -138,8 +146,8 @@ bool test_steps_mesh_blacklist_01(void) {
        // Clean up.
        meshlink_close(mesh2);
        meshlink_close(mesh1);
-       meshlink_destroy("blacklist_conf.1");
-       meshlink_destroy("blacklist_conf.2");
+       assert(meshlink_destroy("blacklist_conf.1"));
+       assert(meshlink_destroy("blacklist_conf.2"));
        return true;
 }
 
@@ -158,7 +166,7 @@ void test_case_mesh_blacklist_02(void **state) {
     meshlink_blacklist API handles the invalid parameter when called by giving proper error number.
 */
 bool test_steps_mesh_blacklist_02(void) {
-       meshlink_destroy("blacklist_conf.3");
+       assert(meshlink_destroy("blacklist_conf.3"));
 
        // Open two new meshlink instance.
        meshlink_handle_t *mesh = meshlink_open("blacklist_conf.3", "foo", "blacklist", DEV_CLASS_BACKBONE);
@@ -168,12 +176,12 @@ bool test_steps_mesh_blacklist_02(void) {
        assert(node);
 
        // Passing NULL as mesh handle and node handle being some valid node handle
-       meshlink_blacklist(NULL, node);
+       assert(!meshlink_blacklist(NULL, node));
        assert_int_equal(meshlink_errno, MESHLINK_EINVAL);
 
        // Clean up.
        meshlink_close(mesh);
-       meshlink_destroy("blacklist_conf.3");
+       assert(meshlink_destroy("blacklist_conf.3"));
        return true;
 }
 
@@ -192,19 +200,19 @@ void test_case_mesh_blacklist_03(void **state) {
     meshlink_blacklist API handles the invalid parameter when called by giving proper error number.
 */
 bool test_steps_mesh_blacklist_03(void) {
-       meshlink_destroy("blacklist_conf.4");
+       assert(meshlink_destroy("blacklist_conf.4"));
 
        // Open two new meshlink instance.
        meshlink_handle_t *mesh = meshlink_open("blacklist_conf.4", "foo", "blacklist", DEV_CLASS_BACKBONE);
        assert(mesh != NULL);
 
        // Passing NULL as node handle and mesh handle being some valid mesh handle value
-       meshlink_blacklist(mesh, NULL);
+       assert(!meshlink_blacklist(mesh, NULL));
        assert_int_equal(meshlink_errno, MESHLINK_EINVAL);
 
        // Clean up.
        meshlink_close(mesh);
-       meshlink_destroy("blacklist_conf.4");
+       assert(meshlink_destroy("blacklist_conf.4"));
        return true;
 }