You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2022/05/07 14:41:14 UTC
svn commit: r1900658 - /spamassassin/trunk/t/cidrs.t
Author: hege
Date: Sat May 7 14:41:14 2022
New Revision: 1900658
URL: http://svn.apache.org/viewvc?rev=1900658&view=rev
Log:
Add few more tests
Modified:
spamassassin/trunk/t/cidrs.t
Modified: spamassassin/trunk/t/cidrs.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/cidrs.t?rev=1900658&r1=1900657&r2=1900658&view=diff
==============================================================================
--- spamassassin/trunk/t/cidrs.t (original)
+++ spamassassin/trunk/t/cidrs.t Sat May 7 14:41:14 2022
@@ -8,7 +8,7 @@ use Test::More;
use constant HAS_NET_CIDR => eval { require Net::CIDR::Lite; };
-my $tests = 62;
+my $tests = 72;
$tests += 4 if (HAS_NET_CIDR);
plan tests => $tests;
@@ -56,13 +56,27 @@ ok tryone "127.0.0.1", "127.0/16";
ok tryone "127.0.0.1", "127.0.0/24";
ok tryone "127.0.0.0", "127.0.0.0/24";
ok tryone "127.0.0.255", "127.0.0.0/24";
+
+ok !tryone "127.0.0.0", "127.0.0.1/32";
ok tryone "127.0.0.1", "127.0.0.1/32";
+ok !tryone "127.0.0.2", "127.0.0.1/32";
+
+ok tryone "127.0.0.0", "127.0.0.0/31";
+ok tryone "127.0.0.1", "127.0.0.0/31";
+ok !tryone "127.0.0.2", "127.0.0.0/31";
+ok !tryone "127.0.0.3", "127.0.0.0/31";
+# This probably misbehaves because it's not an "even" CIDR
ok tryone "127.0.0.0", "127.0.0.1/31"; # NetAddr::IP bug? Should NOT match?
ok tryone "127.0.0.1", "127.0.0.1/31";
ok !tryone "127.0.0.2", "127.0.0.1/31"; # NetAddr::IP bug? Should match?
ok !tryone "127.0.0.3", "127.0.0.1/31";
+ok !tryone "127.0.0.1", "127.0.0.2/31";
+ok tryone "127.0.0.2", "127.0.0.2/31";
+ok tryone "127.0.0.3", "127.0.0.2/31";
+ok !tryone "127.0.0.4", "127.0.0.2/31";
+
ok !tryone "127.0.0.15", "127.0.0.16/31";
ok tryone "127.0.0.16", "127.0.0.16/31";
ok tryone "127.0.0.17", "127.0.0.16/31";