]> git.meshlink.io Git - meshlink/commitdiff
Check that importing the same data twice is fine, but importing garbage is not.
authorGuus Sliepen <guus@meshlink.io>
Sun, 23 Feb 2020 00:47:11 +0000 (01:47 +0100)
committerGuus Sliepen <guus@meshlink.io>
Sun, 23 Feb 2020 00:47:11 +0000 (01:47 +0100)
test/import-export.c

index bffe0fc49cabfd9aae8b8022b723106c43122a63..392f1dac18753eebfea70db506c591a48801e464 100644 (file)
@@ -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;