]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
tests: Try adding an invalid network
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 21 Oct 2020 13:19:44 +0000 (13:19 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 21 Oct 2020 13:19:44 +0000 (13:19 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/test-network.c

index d38f13dd74605bc6cbfd039ef98b09e054b2422b..e908b57b8383ae23fe9f4e71f89465955bbe0249 100644 (file)
@@ -160,6 +160,14 @@ int main(int argc, char** argv) {
        // Set ASN
        loc_network_set_asn(network4, 1024);
 
+       // Try adding an invalid network
+       struct loc_network* network;
+       err = loc_writer_add_network(writer, &network, "xxxx:xxxx::/32");
+       if (err != -EINVAL) {
+               fprintf(stderr, "It was possible to add an invalid network (err = %d)\n", err);
+               exit(EXIT_FAILURE);
+       }
+
        FILE* f = tmpfile();
        if (!f) {
                fprintf(stderr, "Could not open file for writing: %s\n", strerror(errno));