7 #include "meshlink++.h"
12 // Open a new meshlink instance.
14 assert(meshlink::destroy("basicpp_conf"));
15 meshlink::mesh mesh("basicpp_conf", "foo", "basicpp", DEV_CLASS_BACKBONE);
16 assert(mesh.isOpen());
18 // Check that our own node exists.
20 meshlink::node *self = mesh.get_self();
22 assert(!strcmp(self->name, "foo"));
24 // Disable local discovery.
26 mesh.enable_discovery(false);
28 // Start and stop the mesh.
33 // Make sure we can start and stop the mesh again.
38 // Close the mesh and open it again, now with a different name parameter.
41 assert(mesh.open("basicpp_conf", "bar", "basicpp", DEV_CLASS_BACKBONE));
43 // Check that the name is ignored now, and that we still are "foo".
45 assert(!mesh.get_node("bar"));
46 self = mesh.get_self();
48 assert(!strcmp(self->name, "foo"));
50 // Start and stop the mesh.
52 mesh.enable_discovery(false);
57 assert(meshlink::destroy("basicpp_conf"));
58 assert(access("basic.conf", F_OK) == -1 && errno == ENOENT);