From patchwork Wed Oct 2 17:07:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 2461 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 46k2dr50k2z400h for ; Wed, 2 Oct 2019 17:08:16 +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 46k2dr4S7Xz3Ck; Wed, 2 Oct 2019 17:08:16 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 46k2dr24s1z2yLN; Wed, 2 Oct 2019 17:08:16 +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 46k2dp0gKcz2yWr; Wed, 2 Oct 2019 17:08:14 +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 46k2dn4Wz3z2Qh; Wed, 2 Oct 2019 17:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1570036094; 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: in-reply-to:in-reply-to:references:references; bh=avVGRfMXyFDMUfgmjv5ynX+06RZv845+9HLzu5yv9eo=; b=lXpFLpnjU9TLnm14JqqFt2YjmI/iFg+K5BFW/+CMjQJssSZiJP/Jo/FCIs8Gy76ODos3Y/ psLhssJqGNVfuNT+L5KbyUcRf6iH/trOv43JQqLzB63LWqzgGIG50YXJzh1GxWCZ7Sll1c +sGSRQ5/wktyD9Y8bvBGLd12oBmLUddNQSZ5pWZRO8wW3sqV6a3WV2Q9CGRgXAWvrOt183 LjbfLdBFZ5SukXao9pF1U8sh3yf2zZOQ22xYOf0v2Vi+YmksOLhoi3I89XEz7q2xHDz3KH Ky/seYfVOJgZ2kSuDDxoy0y3LEX2Gk1DMgzFveBixi9EGc5zLK9y9xhNkyIsmw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1570036094; 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: in-reply-to:in-reply-to:references:references; bh=avVGRfMXyFDMUfgmjv5ynX+06RZv845+9HLzu5yv9eo=; b=FKGSe50TOHTI3wfZH+M9Njskh28OKOVnWrIRivKbxz0gReT9PL0bS8fpb0cm8wWQeXcYjU kWrJ02GrbWQEKRDg== From: Stefan Schantl To: development@lists.ipfire.org, location@lists.ipfire.org Subject: [PATCH 2/2] perl: Testsuite: Add tests for invalid address and address not in the database. Date: Wed, 2 Oct 2019 19:07:53 +0200 Message-Id: <20191002170753.6738-2-stefan.schantl@ipfire.org> In-Reply-To: <20191002170753.6738-1-stefan.schantl@ipfire.org> References: <20191002170753.6738-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: location@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: location-bounces@lists.ipfire.org Sender: "Location" Signed-off-by: Stefan Schantl --- src/perl/t/Location.t | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/perl/t/Location.t b/src/perl/t/Location.t index b583af4..55a18f3 100644 --- a/src/perl/t/Location.t +++ b/src/perl/t/Location.t @@ -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.") }