]> git.meshlink.io Git - meshlink/blobdiff - test/trio.c
Add an --enable-install-tests option to configure.
[meshlink] / test / trio.c
index 0a494c28e3d36f0c2fa8f2f953ee6a0df709a615..fbf7255c0b30aeadd1bdbb02a45a3fd23650061e 100644 (file)
@@ -5,8 +5,10 @@
 #include <unistd.h>
 #include <errno.h>
 #include <assert.h>
+#include <sys/time.h>
 
 #include "meshlink.h"
+#include "devtools.h"
 #include "utils.h"
 
 static void log_cb(meshlink_handle_t *mesh, meshlink_log_level_t level, const char *text) {
@@ -75,11 +77,17 @@ int main(int argc, char *argv[]) {
        assert_after(meshlink_get_node(mesh[1], name[2]), 5);
        assert_after(meshlink_get_node(mesh[2], name[1]), 5);
 
-       // Send a packet
+       // Send a packet, expect it is received
 
        meshlink_set_receive_cb(mesh[1], receive_cb);
        assert_after((meshlink_send(mesh[2], meshlink_get_node(mesh[2], name[1]), "Hello", 5), received), 15);
 
+       // Check that the second and third node have autoconnected to each other
+
+       devtool_edge_t *edges = NULL;
+       size_t nedges = 0;
+       assert_after((edges = devtool_get_all_edges(mesh[1], edges, &nedges), nedges == 3), 15);
+
        // Stop the first node
 
        meshlink_stop(mesh[0]);