]> git.meshlink.io Git - meshlink/blobdiff - test/basicpp.cpp
Don't use assert() to check the results of pthread_*() calls.
[meshlink] / test / basicpp.cpp
index ff49e3d428f749e9d7d9845c6176d494ed47782f..c0550ecf71027e07f1de4cb5f751138c3536419d 100644 (file)
@@ -9,7 +9,7 @@
 
 using namespace std;
 
-int main() {
+int main(void) {
        assert(meshlink::destroy("basicpp_conf"));
 
        // Open a new meshlink instance.
@@ -41,11 +41,14 @@ int main() {
                // Close the mesh and open it again, now with a different name parameter.
 
                mesh.close();
-               assert(mesh.open("basicpp_conf", "bar", "basicpp", DEV_CLASS_BACKBONE));
+               assert(!mesh.open("basicpp_conf", "bar", "basicpp", DEV_CLASS_BACKBONE));
+
+               // Open it without giving a name.
+
+               assert(mesh.open("basicpp_conf", nullptr, "basicpp", DEV_CLASS_BACKBONE));
 
                // Check that the name is ignored now, and that we still are "foo".
 
-               assert(!mesh.get_node("bar"));
                self = mesh.get_self();
                assert(self);
                assert(!strcmp(self->name, "foo"));