Commit 85aa96e3 authored by Stefan Schantl's avatar Stefan Schantl Committed by Michael Tremer

perl: Add tests to testsuite.

Signed-off-by: default avatarStefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 78cf3fa8
...@@ -8,10 +8,31 @@ ...@@ -8,10 +8,31 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 1; # Where to find the test database.
my $testdb = "../../testdata/test.db";
use Test::More tests => 5;
BEGIN { use_ok('Location') }; BEGIN { use_ok('Location') };
######################### #########################
# Insert your test code below, the Test::More module is use()ed here so read # Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script. # its man page ( perldoc Test::More ) for help writing this test script.
# Address which should be used for database lookup.
my $address = "2a07:1c44:5800::1";
# Connect to the database.
my $db = &Location::init("$testdb");
my $vendor = &Location::get_vendor($db);
ok($vendor eq "IPFire Project", "Test 1 - Get Database Vendor");
my $license = &Location::get_license($db);
ok($license eq "CC", "Test 2 - Get Database license");
my $description = &Location::get_description($db);
ok($description eq "This is a geo location database", "Test 3 - Get Database Description");
my $country_code = &Location::lookup_country_code($db, $address);
ok($country_code eq "DE", "Test 4 - Lookup country code for $address");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment