From: Valters Jansons Date: Mon, 7 Apr 2025 01:29:29 +0000 (+0300) Subject: tests: Ensure loc_database_lookup finds a match X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c0898d1dc3d441119d5560df938aff68a19f9e48;p=location%2Flibloc.git tests: Ensure loc_database_lookup finds a match Commit 9e72b8a modified the lookup function to return 0 even if no matches are found. As result, the test case could pass even if the database lookup did not find any matches. This commit restores the original intent of the test case, by adding a failure condition when `network1` is NULL. This is similar to how the subsequent test case was modified for the inverse condition. Signed-off-by: Michael Tremer --- diff --git a/src/test-network.c b/src/test-network.c index 0cac1a4..73062f4 100644 --- a/src/test-network.c +++ b/src/test-network.c @@ -351,7 +351,7 @@ int main(int argc, char** argv) { // Lookup an address in the subnet err = loc_database_lookup_from_string(db, "2001:db8::", &network1); - if (err) { + if (err || !network1) { fprintf(stderr, "Could not look up 2001:db8::\n"); exit(EXIT_FAILURE); }