Newer
Older
NetAddr-IP / Lite / t / over-qq.t
@Luis Muñoz Luis Muñoz on 21 Oct 2014 754 bytes Import of LUISMUNOZ/NetAddr-IP-4.001 from CPAN.
  1. use NetAddr::IP::Lite;
  2.  
  3. my @addr = ('10.0.0.0/8', '192.168.0.0/16', '127.0.0.1/32');
  4.  
  5. $| = 1;
  6.  
  7. print "1..", 5 * scalar @addr, "\n";
  8.  
  9. my $count = 1;
  10.  
  11. for my $a (@addr) {
  12. my $ip = new NetAddr::IP::Lite $a;
  13. if ($a eq "$ip") {
  14. print "ok $count\n";
  15. }
  16. else {
  17. print "not ok $count\n";
  18. }
  19. ++ $count;
  20.  
  21. if ($a eq $ip) {
  22. print "ok $count\n";
  23. }
  24. else {
  25. print "not ok $count\n";
  26. }
  27. ++ $count;
  28.  
  29. if ($ip eq $a) {
  30. print "ok $count\n";
  31. }
  32. else {
  33. print "not ok $count\n";
  34. }
  35. ++ $count;
  36.  
  37. if ($ip eq $ip) {
  38. print "ok $count\n";
  39. }
  40. else {
  41. print "not ok $count\n";
  42. }
  43. ++ $count;
  44.  
  45. if ($ip == $ip) {
  46. print "ok $count\n";
  47. }
  48. else {
  49. print "not ok $count\n";
  50. }
  51. ++ $count;
  52.  
  53. }