]> git.ipfire.org Git - people/ms/libloc.git/blobdiff - src/test-network.c
export: Skip writing any subnets
[people/ms/libloc.git] / src / test-network.c
index 364099d51d8fc2064f962f8f5e849a2fd067b8c3..c49c3ef4038a23c56bb75d136d275ced3b40fbc9 100644 (file)
@@ -95,6 +95,19 @@ int main(int argc, char** argv) {
        size_t nodes = loc_network_tree_count_nodes(tree);
        printf("The tree has %zu nodes\n", nodes);
 
+       // Check subnet function
+       err = loc_network_is_subnet_of(network1, network2);
+       if (err != 0) {
+               fprintf(stderr, "Subnet check 1 failed: %d\n", err);
+               exit(EXIT_FAILURE);
+       }
+
+       err = loc_network_is_subnet_of(network2, network1);
+       if (err != 1) {
+               fprintf(stderr, "Subnet check 2 failed: %d\n", err);
+               exit(EXIT_FAILURE);
+       }
+
        // Create a database
        struct loc_writer* writer;
        err = loc_writer_new(ctx, &writer, NULL, NULL);