test: Write two test networks to the database
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 5 Jan 2018 16:35:46 +0000 (16:35 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 5 Jan 2018 16:35:46 +0000 (16:35 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/test-network.c

index a573463..40a6d32 100644 (file)
@@ -97,7 +97,7 @@ int main(int argc, char** argv) {
                exit(EXIT_FAILURE);
 
        struct loc_network* network3;
-       err = loc_writer_add_network(writer, &network3, "2001:db8:1::/48");
+       err = loc_writer_add_network(writer, &network3, "2001:db8::/64");
        if (err) {
                fprintf(stderr, "Could not add network\n");
                exit(EXIT_FAILURE);
@@ -106,6 +106,16 @@ int main(int argc, char** argv) {
        // Set country code
        loc_network_set_country_code(network3, "XX");
 
+       struct loc_network* network4;
+       err = loc_writer_add_network(writer, &network4, "2001:db8:ffff::/64");
+       if (err) {
+               fprintf(stderr, "Could not add network\n");
+               exit(EXIT_FAILURE);
+       }
+
+       // Set country code
+       loc_network_set_country_code(network4, "XY");
+
        FILE* f = fopen("test.db", "w");
        if (!f) {
                fprintf(stderr, "Could not open file for writing: %s\n", strerror(errno));
@@ -124,6 +134,7 @@ int main(int argc, char** argv) {
        loc_network_unref(network1);
        loc_network_unref(network2);
        loc_network_unref(network3);
+       loc_network_unref(network4);
        loc_network_tree_unref(tree);
        loc_unref(ctx);