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 // Start and stop the mesh.
32 // Make sure we can start and stop the mesh again.
37 // Close the mesh and open it again, now with a different name parameter.
40 assert(!mesh.open("basicpp_conf", "bar", "basicpp", DEV_CLASS_BACKBONE));
42 // Open it without giving a name.
44 assert(mesh.open("basicpp_conf", nullptr, "basicpp", DEV_CLASS_BACKBONE));
46 // Check that the name is ignored now, and that we still are "foo".
48 self = mesh.get_self();
50 assert(!strcmp(self->name, "foo"));
52 // Start and stop the mesh.
60 assert(meshlink::destroy("basicpp_conf"));
62 DIR *dir = opendir("basicpp_conf");
65 while((ent = readdir(dir))) {
66 assert(!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."));