From c0898d1dc3d441119d5560df938aff68a19f9e48 Mon Sep 17 00:00:00 2001 From: Valters Jansons Date: Mon, 7 Apr 2025 04:29:29 +0300 Subject: [PATCH] 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 --- src/test-network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } -- 2.47.3