8 #include "meshlink-tiny++.h"
13 assert(meshlink::destroy("basicpp_conf"));
15 // Open a new meshlink instance.
18 meshlink::mesh mesh("basicpp_conf", "foo", "basicpp", DEV_CLASS_BACKBONE);
19 assert(mesh.isOpen());
21 // Check that our own node exists.
23 meshlink::node *self = mesh.get_self();
25 assert(!strcmp(self->name, "foo"));
27 // Disable local discovery.
29 mesh.enable_discovery(false);
31 // Start and stop the mesh.
36 // Make sure we can start and stop the mesh again.
41 // Close the mesh and open it again, now with a different name parameter.
44 assert(!mesh.open("basicpp_conf", "bar", "basicpp", DEV_CLASS_BACKBONE));
46 // Open it without giving a name.
48 assert(mesh.open("basicpp_conf", nullptr, "basicpp", DEV_CLASS_BACKBONE));
50 // Check that the name is ignored now, and that we still are "foo".
52 self = mesh.get_self();
54 assert(!strcmp(self->name, "foo"));
56 // Start and stop the mesh.
58 mesh.enable_discovery(false);
66 assert(meshlink::destroy("basicpp_conf"));
68 DIR *dir = opendir("basicpp_conf");
71 while((ent = readdir(dir))) {
72 assert(!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."));