]> git.meshlink.io Git - meshlink/blobdiff - test/blackbox/run_blackbox_tests/test_cases_join.c
Fix __warn_unused_result__, add more of it and fix the resulting warnings.
[meshlink] / test / blackbox / run_blackbox_tests / test_cases_join.c
index 9df001aff2bce4a5da5efb9fbdd3545e123c98c7..865528574f6c8bdec4f16087cb0ad76eb4e38a8a 100644 (file)
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
 #include "execute_tests.h"
 #include "test_cases_join.h"
 #include "../common/containers.h"
@@ -39,8 +43,6 @@ static void test_case_meshlink_join_02(void **state);
 static bool test_meshlink_join_02(void);
 static void test_case_meshlink_join_03(void **state);
 static bool test_meshlink_join_03(void);
-static void test_case_meshlink_join_04(void **state);
-static bool test_meshlink_join_04(void);
 
 /* State structure for join Test Case #1 */
 static black_box_state_t test_case_join_01_state = {
@@ -84,8 +86,8 @@ static void test_case_meshlink_join_01(void **state) {
     NUT joins relay using the invitation generated.
 */
 static bool test_meshlink_join_01(void) {
-       meshlink_destroy("join_conf.1");
-       meshlink_destroy("join_conf.2");
+       assert(meshlink_destroy("join_conf.1"));
+       assert(meshlink_destroy("join_conf.2"));
 
        // Create node instances
        meshlink_handle_t *mesh1 = meshlink_open("join_conf.1", "nut", "test", DEV_CLASS_STATIONARY);
@@ -99,8 +101,8 @@ static bool test_meshlink_join_01(void) {
        meshlink_set_node_status_cb(mesh1, status_callback);
 
        // Inviting nut
-       meshlink_start(mesh2);
-       char *invitation = meshlink_invite(mesh2, "nut");
+       assert(meshlink_start(mesh2));
+       char *invitation = meshlink_invite(mesh2, NULL, "nut");
        assert(invitation);
 
        // Joining Node-Under-Test with relay
@@ -114,8 +116,8 @@ static bool test_meshlink_join_01(void) {
        free(invitation);
        meshlink_close(mesh1);
        meshlink_close(mesh2);
-       meshlink_destroy("join_conf.1");
-       meshlink_destroy("join_conf.2");
+       assert(meshlink_destroy("join_conf.1"));
+       assert(meshlink_destroy("join_conf.2"));
 
        return true;
 }
@@ -134,14 +136,14 @@ static void test_case_meshlink_join_02(void **state) {
     report error accordingly when NULL is passed as mesh handle argument
 */
 static bool test_meshlink_join_02(void) {
-       meshlink_destroy("join_conf.3");
+       assert(meshlink_destroy("join_conf.3"));
 
        // Create node instances
        meshlink_handle_t *mesh1 = meshlink_open("join_conf.3", "nut", "test", DEV_CLASS_STATIONARY);
        assert(mesh1 != NULL);
        meshlink_set_log_cb(mesh1, TEST_MESHLINK_LOG_LEVEL, meshlink_callback_logger);
 
-       char *invitation = meshlink_invite(mesh1, "nodex");
+       char *invitation = meshlink_invite(mesh1, NULL, "nodex");
 
        /* meshlink_join called with NULL as mesh handle and with valid invitation */
        bool ret = meshlink_join(NULL, invitation);
@@ -149,7 +151,7 @@ static bool test_meshlink_join_02(void) {
 
        free(invitation);
        meshlink_close(mesh1);
-       meshlink_destroy("join_conf.3");
+       assert(meshlink_destroy("join_conf.3"));
 
        return true;
 }
@@ -169,7 +171,7 @@ static void test_case_meshlink_join_03(void **state) {
     Report error accordingly when NULL is passed as invite argument
 */
 static bool test_meshlink_join_03(void) {
-       meshlink_destroy("joinconf.4");
+       assert(meshlink_destroy("joinconf.4"));
        meshlink_set_log_cb(NULL, TEST_MESHLINK_LOG_LEVEL, meshlink_callback_logger);
 
        /* Create meshlink instance */
@@ -182,7 +184,7 @@ static bool test_meshlink_join_03(void) {
        assert_int_equal(ret, false);
 
        meshlink_close(mesh_handle);
-       meshlink_destroy("joinconf.4");
+       assert(meshlink_destroy("joinconf.4"));
        return true;
 }