Newer
Older
NetAddr-IP / Lite / t / constants.t
@Michael Robinton Michael Robinton on 21 Oct 2014 499 bytes Import of MIKER/NetAddr-IP-4.017 from CPAN.
  1.  
  2. #use diagnostics;
  3. use Test::More tests => 15;
  4. use NetAddr::IP::Lite qw(Zeros Zero Ones V4mask V4net);
  5.  
  6. my %const = (
  7. '0::' => Zeros,
  8. '::' => Zero,
  9. 'FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF' => Ones,
  10. 'FFFF:FFFF:FFFF:FFFF:FFFF:FFFF::' => V4mask,
  11. '::FFFF:FFFF' => V4net,
  12. );
  13.  
  14. my($ip,$rv);
  15. foreach (sort keys %const) {
  16. ok(($ip = new NetAddr::IP::Lite($_)),"netaddr $_");
  17. ok($ip->{addr} eq $const{$_},"match $_");
  18. ok(($rv = length($const{$_})) == 16, "length $_ is $rv");
  19. }