Newer
Older
NetAddr-IP / t / v4-cnew.t
@Luis Muñoz Luis Muñoz on 21 Oct 2014 503 bytes Import of LUISMUNOZ/NetAddr-IP-3.12 from CPAN.
  1. use NetAddr::IP;
  2.  
  3. # $Id: v4-cnew.t,v 1.2 2002/10/31 04:30:35 lem Exp $
  4.  
  5. my @subnets = (
  6. [ '127.1', '127.0.0.1/32' ],
  7. [ '127.1/16', '127.1.0.0/16' ],
  8. [ '10.10.10', '10.10.0.10/32' ],
  9. [ '10.10.10/24', '10.10.10.0/24' ],
  10. );
  11.  
  12. $| = 1;
  13.  
  14. print '1..', (scalar @subnets) , "\n";
  15.  
  16. my $count = 1;
  17.  
  18. for my $n (@subnets) {
  19. my $ip = new NetAddr::IP $n->[0];
  20. if ($ip eq $n->[1]) {
  21. print "ok $count\n";
  22. }
  23. else {
  24. print "not ok $count\n";
  25. }
  26.  
  27. ++ $count;
  28. }