Newer
Older
NetAddr-IP / Lite / t / pathological.t
@Luis Muñoz Luis Muñoz on 21 Oct 2014 383 bytes Import of LUISMUNOZ/NetAddr-IP-4.001 from CPAN.
  1.  
  2. #use diagnostics;
  3. use NetAddr::IP::Lite;
  4.  
  5. END {print "1..1\nnot ok 1\n" unless $test};
  6.  
  7. $| = 1;
  8.  
  9. $test = 1;
  10. sub ok() {
  11. print 'ok ',$test++,"\n";
  12. }
  13.  
  14. my @addrs = # pathological cases should fail
  15. qw( ::foo
  16. ::f00/129
  17. ::f00/150
  18. );
  19.  
  20. print '1..',(scalar @addrs),"\n";
  21.  
  22. my $ip;
  23. foreach(@addrs) {
  24. print "expected undef, got: $ip\nnot "
  25. if ($ip = new NetAddr::IP::Lite($_));
  26. &ok;
  27. }