summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorbluemonk <ceresa@gmail.com>2011-05-10 21:16:35 +0200
committerbluemonk <ceresa@gmail.com>2011-05-10 21:16:35 +0200
commitdba60ba1b34db3d817ef20158e2cb2d7e2e3f34d (patch)
tree49d9666d4507358288c035dd475b5aa64346cdc3 /test
parentc95e3e6a5dde0aadc7d433efe372c282fbb3913b (diff)
downloadipaddress-dba60ba1b34db3d817ef20158e2cb2d7e2e3f34d.tar.gz
Added IPv6#network method, thanks to Leif Gensert (closes #12)
Diffstat (limited to 'test')
-rw-r--r--test/ipaddress/ipv6_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ipaddress/ipv6_test.rb b/test/ipaddress/ipv6_test.rb
index 84be76c..4c84e4b 100644
--- a/test/ipaddress/ipv6_test.rb
+++ b/test/ipaddress/ipv6_test.rb
@@ -32,6 +32,11 @@ class IPv6Test < Test::Unit::TestCase
@invalid_ipv6 = [":1:2:3:4:5:6:7",
":1:2:3:4:5:6:7"]
+
+ @networks = {
+ "2001:db8:1:1:1:1:1:1/32" => "2001:db8::/32",
+ "2001:db8:1:1:1:1:1::/32" => "2001:db8::/32",
+ "2001:db8::1/64" => "2001:db8::/64"}
@ip = @klass.new "2001:db8::8:800:200c:417a/64"
@network = @klass.new "2001:db8:8:800::/64"
@@ -186,6 +191,14 @@ class IPv6Test < Test::Unit::TestCase
assert_equal true, @klass.new("::1").loopback?
assert_equal false, @ip.loopback?
end
+
+ def test_method_network
+ @networks.each do |addr,net|
+ ip = @klass.new addr
+ assert_instance_of @klass, ip.network
+ assert_equal net, ip.network.to_string
+ end
+ end
def test_classmethod_expand
compressed = "2001:db8:0:cd30::"