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:00:50 UTC

svn commit: r1900653 - /spamassassin/trunk/t/cidrs.t

Author: hege
Date: Sat May  7 14:00:49 2022
New Revision: 1900653

URL: http://svn.apache.org/viewvc?rev=1900653&view=rev
Log:
Add some more tests. Seems NetAddr::IP has some bug handling stuff like 127.0.0.1/31 (I don't think it should match 127.0.0.0).

Modified:
    spamassassin/trunk/t/cidrs.t

Modified: spamassassin/trunk/t/cidrs.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/cidrs.t?rev=1900653&r1=1900652&r2=1900653&view=diff
==============================================================================
--- spamassassin/trunk/t/cidrs.t (original)
+++ spamassassin/trunk/t/cidrs.t Sat May  7 14:00:49 2022
@@ -8,7 +8,7 @@ use Test::More;
 
 use constant HAS_NET_CIDR => eval { require Net::CIDR::Lite; };
 
-my $tests = 53;
+my $tests = 62;
 $tests += 4 if (HAS_NET_CIDR);
 plan tests => $tests;
 
@@ -54,8 +54,20 @@ ok tryone "127.0.0.254", "127.";
 ok tryone "127.0.0.1", "127/8";
 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.1", "127.0.0.1/32";
+
+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.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";
+ok !tryone "127.0.0.18", "127.0.0.16/31";
+
 ok tryone "127.0.0.1", "10.", "11.", "127.0.0.1";
 ok tryone "127.0.0.1", "127.0.";
 ok tryone "127.0.0.1", "127.0.0.";