]> git.meshlink.io Git - meshlink/blobdiff - test/blackbox/run_blackbox_tests/test_cases_channel_open.c
Use blocking ADNS requests for most other hostname resolving.
[meshlink] / test / blackbox / run_blackbox_tests / test_cases_channel_open.c
index 0d5728f6d147c3193ac51a2cad11a14e599dfd57..9792aec561750ee44490372cc632a3203d781ebe 100644 (file)
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
 #include "execute_tests.h"
 #include "test_cases_channel_open.h"
 #include "../common/containers.h"
@@ -63,11 +67,6 @@ static void test_case_mesh_channel_open_01(void **state) {
        execute_test(test_steps_mesh_channel_open_01, state);
 }
 
-static void receive_cb(meshlink_handle_t *mesh, meshlink_channel_t *channel, const void *data, size_t len) {
-       (void)mesh;
-       (void)channel;
-}
-
 /* Test Steps for meshlink_channel_open Test Case # 1
 
     Test Steps:
@@ -79,8 +78,8 @@ static void receive_cb(meshlink_handle_t *mesh, meshlink_channel_t *channel, con
     meshlink_channel_open should open a channel by returning a channel handler
 */
 static bool test_steps_mesh_channel_open_01(void) {
-       meshlink_destroy("channels_conf.1");
-       meshlink_destroy("channels_conf.2");
+       assert(meshlink_destroy("channels_conf.1"));
+       assert(meshlink_destroy("channels_conf.2"));
 
        // Open two new meshlink instance.
        meshlink_handle_t *mesh1 = meshlink_open("channels_conf.1", "foo", "channels", DEV_CLASS_BACKBONE);
@@ -106,14 +105,14 @@ static bool test_steps_mesh_channel_open_01(void) {
        // Open a channel from foo to bar.
        meshlink_node_t *bar = meshlink_get_node(mesh1, "bar");
        assert(bar != NULL);
-       meshlink_channel_t *channel = meshlink_channel_open(mesh1, bar, 7000, receive_cb, NULL, 0);
+       meshlink_channel_t *channel = meshlink_channel_open(mesh1, bar, 7000, NULL, NULL, 0);
        assert_int_not_equal(channel, NULL);
 
        // Clean up.
        meshlink_close(mesh2);
        meshlink_close(mesh1);
-       meshlink_destroy("channels_conf.1");
-       meshlink_destroy("channels_conf.2");
+       assert(meshlink_destroy("channels_conf.1"));
+       assert(meshlink_destroy("channels_conf.2"));
        return true;
 }
 
@@ -133,8 +132,8 @@ static void test_case_mesh_channel_open_02(void **state) {
 
 /* Test Steps for meshlink_channel_open Test Case # 2*/
 static bool test_steps_mesh_channel_open_02(void) {
-       meshlink_destroy("channels_conf.3");
-       meshlink_destroy("channels_conf.4");
+       assert(meshlink_destroy("channels_conf.3"));
+       assert(meshlink_destroy("channels_conf.4"));
 
        // Open two new meshlink instance.
        meshlink_handle_t *mesh1 = meshlink_open("channels_conf.3", "foo", "channels", DEV_CLASS_BACKBONE);
@@ -167,8 +166,8 @@ static bool test_steps_mesh_channel_open_02(void) {
        // Clean up.
        meshlink_close(mesh2);
        meshlink_close(mesh1);
-       meshlink_destroy("channels_conf.3");
-       meshlink_destroy("channels_conf.4");
+       assert(meshlink_destroy("channels_conf.3"));
+       assert(meshlink_destroy("channels_conf.4"));
        return true;
 }
 
@@ -189,7 +188,7 @@ static void test_case_mesh_channel_open_03(void **state) {
     when called by giving proper error number.
 */
 static bool test_steps_mesh_channel_open_03(void) {
-       meshlink_destroy("channels_conf.5");
+       assert(meshlink_destroy("channels_conf.5"));
 
        // Open two new meshlink instance.
        meshlink_handle_t *mesh = meshlink_open("channels_conf.5", "foo", "channels", DEV_CLASS_BACKBONE);
@@ -203,7 +202,7 @@ static bool test_steps_mesh_channel_open_03(void) {
 
        // Clean up.
        meshlink_close(mesh);
-       meshlink_destroy("channels_conf.5");
+       assert(meshlink_destroy("channels_conf.5"));
        return true;
 }
 
@@ -224,7 +223,7 @@ static void test_case_mesh_channel_open_04(void **state) {
     when called by giving proper error number.
 */
 static bool test_steps_mesh_channel_open_04(void) {
-       meshlink_destroy("channels_conf.7");
+       assert(meshlink_destroy("channels_conf.7"));
 
        // Open two new meshlink instance.
        meshlink_handle_t *mesh = meshlink_open("channels_conf.7", "foo", "channels", DEV_CLASS_BACKBONE);
@@ -238,7 +237,7 @@ static bool test_steps_mesh_channel_open_04(void) {
 
        // Clean up.
        meshlink_close(mesh);
-       meshlink_destroy("channels_conf.7");
+       assert(meshlink_destroy("channels_conf.7"));
        return true;
 }