]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
perl: Testsuite: Add tests for invalid address and address not in the database.
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 2 Oct 2019 17:07:53 +0000 (19:07 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 3 Oct 2019 18:43:58 +0000 (18:43 +0000)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/perl/t/Location.t

index b583af451dfde363df351027b2af105fd727b660..55a18f3c320c79bc76a2b2c9507d5fc751439aba 100644 (file)
@@ -36,3 +36,9 @@ ok($description eq "This is a geo location database", "Test 3 - Get Database Des
 
 my $country_code = &Location::lookup_country_code($db, $address);
 ok($country_code eq "DE", "Test 4 - Lookup country code for $address");
+
+$country_code = &Location::lookup_country_code($db, "1.1.1.1");
+if(defined($country_code)) { fail("Test 5 - Lookup country code for address not in Database."); }
+
+$country_code = &Location::lookup_country_code($db, "a.b.c.d");
+if(defined($country_code)) { fail("Test 6 - Lookup country code for invalid address.") }