From patchwork Wed Oct 2 17:25:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 2466 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 46k32H4K51z3yqJ for ; Wed, 2 Oct 2019 17:25:59 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 46k32G369rz3B4; Wed, 2 Oct 2019 17:25:58 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 46k32G1BjMz2yt6; Wed, 2 Oct 2019 17:25:58 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 46k32D4CBhz2yWr; Wed, 2 Oct 2019 17:25:56 +0000 (UTC) Received: from tuxedo.stevee (213162068236.public.t-mobile.at [213.162.68.236]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 46k32D1pP7z2KQ; Wed, 2 Oct 2019 17:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1570037156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=4szFaCctm2QJgIoyjWQ1eAZzjJAcw/B+DZPugoEhRis=; b=i+udPEqG7nI4K+jBDx/j15RTU0TYHOZywpuqhuJ0xUkQrsVYH49q2GF8R89nDOOHaKWqh/ Jll/JpRmYwvKc3iETGLwZssQwRi2hC87Xy2q6GaIz/uTU5zJRj90MhIW/AVJ8R3QovHoa5 4Efo+/S4Jr1XQatTjnJBDbFuy8deGpzux+a38nlH/O+rKweOpHhJNzf58h7yYuH9zgIAnY FYrq5KzfsmmMBNBNiPwwBYXEpElDhZU7Bz1vbc3JMEPp0wN6OLezbhBnF5u49CPLFiSIBc 3u0g4lmbQOXoVG6FOWYcAgI1x8tQUib9e3qu5lIp9xoy7W2gjCBhKMJPQpbGiw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1570037156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=4szFaCctm2QJgIoyjWQ1eAZzjJAcw/B+DZPugoEhRis=; b=6VX1OEx9FfZGXjL08RbY3+reIWlnyUD5kPM8Xqp4ZeIFiegKuAASfXUP6OOzGCa4IMMBjb Z0CjlBJBT3ukXFDw== From: Stefan Schantl To: development@lists.ipfire.org, location@lists.ipfire.org Subject: [PATCHv2] perl: Testsuite: Add tests for lookup_asn() Date: Wed, 2 Oct 2019 19:25:51 +0200 Message-Id: <20191002172551.12455-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=stevee smtp.mailfrom=stefan.schantl@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Stefan Schantl --- src/perl/t/Location.t | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/perl/t/Location.t b/src/perl/t/Location.t index 55a18f3..fd43946 100644 --- a/src/perl/t/Location.t +++ b/src/perl/t/Location.t @@ -11,7 +11,7 @@ use warnings; # Where to find the test database. my $testdb = $ENV{'database'}; -use Test::More tests => 5; +use Test::More tests => 6; BEGIN { use_ok('Location') }; ######################### @@ -42,3 +42,12 @@ if(defined($country_code)) { fail("Test 5 - Lookup country code for address not $country_code = &Location::lookup_country_code($db, "a.b.c.d"); if(defined($country_code)) { fail("Test 6 - Lookup country code for invalid address.") } + +my $as_number = &Location::lookup_asn($db, $address); +ok($as_number eq "204867", "Test 7 - Lookup Autonomous System Number for $address."); + +$as_number = &Location::lookup_asn($db, "1.1.1.1"); +if(defined($as_number)) { fail("Test 8 - Lookup Autonomous System Number for address not in Database.") } + +$as_number = &Location::lookup_asn($db, "a.b.c.d"); +if(defined($as_number)) { fail("Test 9 - Lookup Autonomous System Number for invalid address.") }