From mboxrd@z Thu Jan  1 00:00:00 1970
From: Stefan Schantl <stefan.schantl@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH] perl: Add tests to testsuite.
Date: Tue, 01 Oct 2019 08:15:54 +0200
Message-ID: <20191001061554.4647-1-stefan.schantl@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============3609244319248521231=="
List-Id: <development.lists.ipfire.org>

--===============3609244319248521231==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
---
 src/perl/t/Location.t | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/perl/t/Location.t b/src/perl/t/Location.t
index a68c094..aef15c3 100644
--- a/src/perl/t/Location.t
+++ b/src/perl/t/Location.t
@@ -8,10 +8,31 @@
 use strict;
 use warnings;
=20
-use Test::More tests =3D> 1;
+# Where to find the test database.
+my $testdb =3D "../../testdata/test.db";
+
+use Test::More tests =3D> 5;
 BEGIN { use_ok('Location') };
=20
 #########################
=20
 # 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.
+
+# Address which should be used for database lookup.
+my $address =3D "2a07:1c44:5800::1";
+
+# Connect to the database.
+my $db =3D &Location::init("$testdb");
+
+my $vendor =3D &Location::get_vendor($db);
+ok($vendor eq "IPFire Project", "Test 1 - Get Database Vendor");
+
+my $license =3D &Location::get_license($db);
+ok($license eq "CC", "Test 2 - Get Database license");
+
+my $description =3D &Location::get_description($db);
+ok($description eq "This is a geo location database", "Test 3 - Get Database=
 Description");
+
+my $country_code =3D &Location::lookup_country_code($db, $address);
+ok($country_code eq "DE", "Test 4 - Lookup country code for $address");
--=20
2.20.1


--===============3609244319248521231==--