summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Mackintosh <m@zyp.io>2015-03-22 23:53:32 -0400
committerMike Mackintosh <m@zyp.io>2015-03-22 23:53:32 -0400
commit6bf73cfccf4f3b0b17fa8926b47ee26710527ea0 (patch)
tree0fb6a460dfeb6812c09f8a8ed25869d785e0c695 /test
parent09bde2a5ef66884ab63f8649a15514840c03dd83 (diff)
downloadipaddress-6bf73cfccf4f3b0b17fa8926b47ee26710527ea0.tar.gz
added #to range and fixed #40
Diffstat (limited to 'test')
-rw-r--r--test/ipaddress/ipv4_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ipaddress/ipv4_test.rb b/test/ipaddress/ipv4_test.rb
index e0b37b8..4680898 100644
--- a/test/ipaddress/ipv4_test.rb
+++ b/test/ipaddress/ipv4_test.rb
@@ -64,6 +64,11 @@ class IPv4Test < Minitest::Test
"10.1.1.1" => 8,
"150.1.1.1" => 16,
"200.1.1.1" => 24 }
+
+ @in_range = {
+ "10.32.0.1" => ["10.32.0.253", 253],
+ "192.0.0.0" => ["192.1.255.255", 131072]
+ }
end
@@ -551,6 +556,14 @@ class IPv4Test < Minitest::Test
assert_equal x.split(256).length, 256
end
end
+
+ def test_in_range
+ @in_range.each do |s,d|
+ ip = @klass.new(s)
+ assert_equal ip.to(d[0]).length, d[1]
+ end
+ end
+
end # class IPv4Test