]> git.meshlink.io Git - meshlink/blobdiff - test/blackbox/run_blackbox_tests/test_cases_get_all_nodes_by_dev_class.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_by_dev_class.c
index e32fb36c48e717b9495bf801b01609e5463b598a..f3c73a923b1fe678053648bfe182c6a75c899d5e 100644 (file)
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
 #include "execute_tests.h"
 #include "test_cases_get_all_nodes_by_dev_class.h"
 #include "../common/containers.h"
@@ -208,15 +212,15 @@ static void test_case_mesh_get_node_by_dev_class_02(void **state) {
 static bool test_steps_mesh_get_node_by_dev_class_02(void) {
        meshlink_node_t **nodes;
        size_t nnodes = 0;
-       int i;
-       meshlink_destroy("getnodeconf.1");
+
+       assert(meshlink_destroy("getnodeconf.1"));
 
        /* Create meshlink instance for NUT */
        meshlink_handle_t *mesh_nut = meshlink_open("getnodeconf.1", "nut", "node_sim", DEV_CLASS_STATIONARY);
        assert(mesh_nut);
        meshlink_set_log_cb(mesh_nut, TEST_MESHLINK_LOG_LEVEL, log_message);
 
-       nodes = meshlink_get_all_nodes_by_dev_class(mesh_nut, _DEV_CLASS_MAX + 10, NULL, &nnodes);
+       nodes = meshlink_get_all_nodes_by_dev_class(mesh_nut, DEV_CLASS_COUNT + 10, NULL, &nnodes);
        assert_int_equal(nodes, NULL);
        assert_int_not_equal(meshlink_errno, 0);
 
@@ -229,7 +233,7 @@ static bool test_steps_mesh_get_node_by_dev_class_02(void) {
        assert_int_not_equal(meshlink_errno, 0);
 
        meshlink_close(mesh_nut);
-       meshlink_destroy("getnodeconf.1");
+       assert(meshlink_destroy("getnodeconf.1"));
        return true;
 }
 
@@ -248,7 +252,7 @@ static void test_case_mesh_get_node_dev_class_01(void **state) {
     meshlink_get_node_dev_class API should return DEV_CLASS_STATIONARY device class
 */
 static bool test_steps_mesh_get_node_dev_class_01(void) {
-       meshlink_destroy("getnodeconf.1");
+       assert(meshlink_destroy("getnodeconf.1"));
 
        /* Create meshlink instance for NUT */
        meshlink_handle_t *mesh_nut = meshlink_open("getnodeconf.1", "nut", "node_sim", DEV_CLASS_STATIONARY);
@@ -263,7 +267,7 @@ static bool test_steps_mesh_get_node_dev_class_01(void) {
        assert_int_equal(dev_class, DEV_CLASS_STATIONARY);
 
        meshlink_close(mesh_nut);
-       meshlink_destroy("getnodeconf.1");
+       assert(meshlink_destroy("getnodeconf.1"));
        return true;
 }
 
@@ -283,7 +287,7 @@ static void test_case_mesh_get_node_dev_class_02(void **state) {
     meshlink_errno.
 */
 static bool test_steps_mesh_get_node_dev_class_02(void) {
-       meshlink_destroy("getnodeconf.1");
+       assert(meshlink_destroy("getnodeconf.1"));
 
        /* Create meshlink instance for NUT */
        meshlink_handle_t *mesh_nut = meshlink_open("getnodeconf.1", "nut", "node_sim", DEV_CLASS_STATIONARY);
@@ -303,17 +307,19 @@ static bool test_steps_mesh_get_node_dev_class_02(void) {
        assert_int_not_equal(meshlink_errno, 0);
 
        meshlink_close(mesh_nut);
-       meshlink_destroy("getnodeconf.1");
+       assert(meshlink_destroy("getnodeconf.1"));
        return true;
 }
 
 static int black_box_setup_test_case(void **state) {
+       (void)state;
+
        fprintf(stderr, "Destroying confbases\n");
-       meshlink_destroy("getnodeconf.1");
-       meshlink_destroy("getnodeconf.2");
-       meshlink_destroy("getnodeconf.3");
-       meshlink_destroy("getnodeconf.4");
-       meshlink_destroy("getnodeconf.5");
+       assert(meshlink_destroy("getnodeconf.1"));
+       assert(meshlink_destroy("getnodeconf.2"));
+       assert(meshlink_destroy("getnodeconf.3"));
+       assert(meshlink_destroy("getnodeconf.4"));
+       assert(meshlink_destroy("getnodeconf.5"));
        meshlink_set_log_cb(NULL, TEST_MESHLINK_LOG_LEVEL, meshlink_callback_logger);
        meshlink_errno = MESHLINK_OK;