Permalink
Browse files

Merge branch 'master' of http://github.com/xsawyerx/net-ipaddress-min…

  • Loading branch information...
2 parents 34f5388 + 16af63f commit 97e3749a386549109001cc2df7db81cace378f80 @Tlousky committed Jun 10, 2010
Showing with 29 additions and 0 deletions.
  1. +29 −0 t/invert.t
View
@@ -0,0 +1,29 @@
+#!perl
+
+# checking that invertion works the way we think it should
+
+use strict;
+use warnings;
+use Test::More tests => 4;
+use Net::IPAddress::Minimal 'invert_ip';
+
+my $ip_a = '7.91.205.21';
+my $ip_num = 123456789;
+
+{
+ no warnings qw/redefine once/;
+
+ *Net::IPAddress::Minimal::num_to_ip = sub {
+ cmp_ok( scalar @_, '==', 1, 'correct number of params num_to_ip()' );
+ cmp_ok( $_[0], '==', $ip_num, 'correct param num_to_ip()' );
+ };
+
+ *Net::IPAddress::Minimal::ip_to_num = sub {
+ cmp_ok( scalar @_, '==', 1, 'correct number of params ip_to_num()' );
+ is( $_[0], $ip_a, 'correct param ip_to_num()' );
+ };
+}
+
+invert_ip($ip_a);
+invert_ip($ip_num);
+

0 comments on commit 97e3749

Please sign in to comment.