From: Guus Sliepen Date: Sat, 1 Nov 2014 21:06:40 +0000 (+0100) Subject: Fix compilation error in the basic C++ test. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=6b21c4293b372e17b2468529a901b8a521acd670;p=meshlink Fix compilation error in the basic C++ test. --- diff --git a/test/basicpp.cpp b/test/basicpp.cpp index 548812c0..34c0bacb 100644 --- a/test/basicpp.cpp +++ b/test/basicpp.cpp @@ -8,15 +8,12 @@ using namespace std; int main(int argc, char *argv[]) { // Open a new meshlink instance. - meshlink::mesh *mesh = meshlink::open("basicpp_conf", "foo", "basicpp", DEV_CLASS_BACKBONE); - if(!mesh) { - cerr << "Could not initialize configuration for foo\n"; - return 1; - } + meshlink::mesh mesh; + mesh.open("basicpp_conf", "foo", "basicpp", DEV_CLASS_BACKBONE); // Check that our own node exists. - meshlink::node *self = mesh->get_node("foo"); + meshlink::node *self = mesh.get_node("foo"); if(!self) { cerr << "Foo does not know about itself\n"; return 1; @@ -28,38 +25,34 @@ int main(int argc, char *argv[]) { // Start and stop the mesh. - if(!mesh->start()) { + if(!mesh.start()) { cerr << "Foo could not start\n"; return 1; } - mesh->stop(); + mesh.stop(); // Make sure we can start and stop the mesh again. - if(!mesh->start()) { + if(!mesh.start()) { cerr << "Foo could not start twice\n"; return 1; } - mesh->stop(); + mesh.stop(); // Close the mesh and open it again, now with a different name parameter. - meshlink::close(mesh); + mesh.close(); // Check that the name is ignored now, and that we still are "foo". - mesh = meshlink::open("basic_conf", "bar", "basicpp", DEV_CLASS_BACKBONE); - if(!mesh) { - cerr << "Could not open configuration for foo a second time\n"; - return 1; - } + mesh.open("basic_conf", "bar", "basicpp", DEV_CLASS_BACKBONE); - if(mesh->get_node("bar")) { + if(mesh.get_node("bar")) { cerr << "Foo knows about bar, it shouldn't\n"; return 1; } - self = mesh->get_node("foo"); + self = mesh.get_node("foo"); if(!self) { cerr << "Foo doesn't know about itself the second time\n"; return 1; @@ -71,15 +64,12 @@ int main(int argc, char *argv[]) { // Start and stop the mesh. - if(!mesh->start()) { + if(!mesh.start()) { cerr << "Foo could not start a third time\n"; return 1; } - mesh->stop(); - - // That's it. - meshlink::close(mesh); + mesh.stop(); return 0; }