test: Fix network test for non-existant address
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 31 Jan 2018 00:31:41 +0000 (00:31 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 31 Jan 2018 00:31:41 +0000 (00:31 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/test-network.c

index b7b5120..a9f2f63 100644 (file)
@@ -155,18 +155,18 @@ int main(int argc, char** argv) {
                exit(EXIT_FAILURE);
        }
 
-       // Lookup an exact match
+       // Lookup an address in the subnet
        err = loc_database_lookup_from_string(db, "2001:db8::", &network1);
        if (err) {
-               fprintf(stderr, "Could not look up the given IP address\n");
+               fprintf(stderr, "Could not look up 2001:db8::\n");
                exit(EXIT_FAILURE);
        }
        loc_network_unref(network1);
 
-       // Lookup a non-exact match
+       // Lookup an address outside the subnet
        err = loc_database_lookup_from_string(db, "2001:db8:fffe:1::", &network1);
-       if (err) {
-               fprintf(stderr, "Could not look up the given IP address\n");
+       if (err == 0) {
+               fprintf(stderr, "Could look up 2001:db8:fffe:1::, but I shouldn't\n");
                exit(EXIT_FAILURE);
        }
        loc_network_unref(network1);