X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=test%2Fimport-export.c;h=5d37146fd09502d8711f70a592033124462c8879;hp=bffe0fc49cabfd9aae8b8022b723106c43122a63;hb=3febbb4453f5c6b0286e7e3c68a5dbcec975b6fd;hpb=be83b0af60449c7b35d17d97f2e6dc12f611e831 diff --git a/test/import-export.c b/test/import-export.c index bffe0fc4..5d37146f 100644 --- a/test/import-export.c +++ b/test/import-export.c @@ -43,8 +43,8 @@ int main() { // Import and export both side's data - assert(meshlink_add_address(mesh1, "localhost")); - assert(meshlink_add_address(mesh2, "localhost")); + assert(meshlink_set_canonical_address(mesh1, meshlink_get_self(mesh1), "localhost", NULL)); + assert(meshlink_set_canonical_address(mesh2, meshlink_get_self(mesh2), "localhost", NULL)); char *data = meshlink_export(mesh1); assert(data); @@ -55,9 +55,15 @@ int main() { data = meshlink_export(mesh2); assert(data); + assert(meshlink_import(mesh1, data)); + + // Check that importing twice is fine assert(meshlink_import(mesh1, data)); free(data); + // Check that importing garbage is not fine + assert(!meshlink_import(mesh1, "Garbage\n")); + // Check that foo knows bar, but that it is not reachable. time_t last_reachable;