]> git.meshlink.io Git - meshlink/blobdiff - test/blackbox/run_blackbox_tests/test_cases_get_all_nodes.c
Fix __warn_unused_result__, add more of it and fix the resulting warnings.
[meshlink] / test / blackbox / run_blackbox_tests / test_cases_get_all_nodes.c
index 8b885a73fba46b08c55f5219b4664a0e3993603d..6fd409bb27e82d009147bbdaf841655d2d668dab 100644 (file)
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
 #include "execute_tests.h"
 #include "test_cases.h"
 #include "../common/containers.h"
@@ -40,8 +44,6 @@ static void test_case_get_all_nodes_02(void **state);
 static bool test_get_all_nodes_02(void);
 static void test_case_get_all_nodes_03(void **state);
 static bool test_get_all_nodes_03(void);
-static void test_case_get_all_nodes_04(void **state);
-static bool test_get_all_nodes_04(void);
 
 /* State structure for get_all_nodes Test Case #1 */
 static black_box_state_t test_case_get_all_nodes_01_state = {
@@ -73,8 +75,8 @@ static void test_case_get_all_nodes_01(void **state) {
     Obtaining list of nodes in the mesh at the given instance
 */
 static bool test_get_all_nodes_01(void) {
-       meshlink_destroy("getnodeconf1");
-       meshlink_destroy("getnodeconf2");
+       assert(meshlink_destroy("getnodeconf1"));
+       assert(meshlink_destroy("getnodeconf2"));
        meshlink_set_log_cb(NULL, TEST_MESHLINK_LOG_LEVEL, meshlink_callback_logger);
 
        /* Create meshlink instance for NUT */
@@ -106,8 +108,8 @@ static bool test_get_all_nodes_01(void) {
 
        meshlink_close(mesh1);
        meshlink_close(mesh2);
-       meshlink_destroy("getnodeconf1");
-       meshlink_destroy("getnodeconf2");
+       assert(meshlink_destroy("getnodeconf1"));
+       assert(meshlink_destroy("getnodeconf2"));
 
        return true;
 }
@@ -128,11 +130,11 @@ static void test_case_get_all_nodes_02(void **state) {
     Error reported correctly by returning NULL
 */
 static bool test_get_all_nodes_02(void) {
-       meshlink_node_t **nodes = NULL;
        size_t nmemb = 0;
 
-       meshlink_node_t **node = meshlink_get_all_nodes(NULL, nodes, &nmemb);
-       assert_int_equal(nodes, NULL);
+       meshlink_node_t **nodes = meshlink_get_all_nodes(NULL, NULL, &nmemb);
+       assert_null(nodes);
+       assert_int_equal(nmemb, NULL);
 
        return true;
 }
@@ -160,7 +162,7 @@ static bool test_get_all_nodes_03(void) {
        assert_int_equal(nodes, NULL);
 
        meshlink_close(mesh_handle);
-       meshlink_destroy("getallnodesconf");
+       assert(meshlink_destroy("getallnodesconf"));
 
        return true;
 }