test/ipaddress/ipv6_test.rb in ipaddress-0.7.0 vs test/ipaddress/ipv6_test.rb in ipaddress-0.7.5
- old
+ new
@@ -104,10 +104,18 @@
@arr.each_with_index do |val,index|
assert_equal val, @ip[index]
end
end
+ def test_method_ipv4?
+ assert_equal false, @ip.ipv4?
+ end
+
+ def test_method_ipv6?
+ assert_equal true, @ip.ipv6?
+ end
+
def test_method_network?
assert_equal true, @network.network?
assert_equal false, @ip.network?
end
@@ -195,26 +203,10 @@
assert_not_equal compressed, @klass.compress("2001:0db8:0:cd3")
assert_not_equal compressed, @klass.compress("2001:0db8::cd30")
assert_not_equal compressed, @klass.compress("2001:0db8::cd3")
end
-# def test_classmethod_create_unpecified
-# unspec = @klass.create_unspecified
-# assert_equal "::", unspec.address
-# assert_equal 128, unspec.prefix
-# assert_equal true, unspec.unspecified?
-# assert_instance_of @klass, unspec.class
-# end
-
-# def test_classmethod_create_loopback
-# loopb = @klass.create_loopback
-# assert_equal "::1", loopb.address
-# assert_equal 128, loopb.prefix
-# assert_equal true, loopb.loopback?
-# assert_instance_of @klass, loopb.class
-# end
-
def test_classmethod_parse_data
str = " \001\r\270\000\000\000\000\000\b\b\000 \fAz"
ip = @klass.parse_data str
assert_instance_of @klass, ip
assert_equal "2001:0db8:0000:0000:0008:0800:200c:417a", ip.address
@@ -229,11 +221,11 @@
def test_classmethod_parse_hex
assert_equal @ip.to_s, @klass.parse_hex(@hex,64).to_s
end
-end # class IPv4Test
+end # class IPv6Test
class IPv6UnspecifiedTest < Test::Unit::TestCase
def setup
@klass = IPAddress::IPv6::Unspecified
@@ -257,10 +249,14 @@
assert_equal @s, @ip.to_s
assert_equal @str, @ip.to_string
assert_equal @string, @ip.to_string_uncompressed
assert_equal @u128, @ip.to_u128
end
+
+ def test_method_ipv6?
+ assert_equal true, @ip.ipv6?
+ end
end # class IPv6UnspecifiedTest
class IPv6LoopbackTest < Test::Unit::TestCase
@@ -287,10 +283,14 @@
assert_equal @s, @ip.to_s
assert_equal @str, @ip.to_string
assert_equal @string, @ip.to_string_uncompressed
assert_equal @u128, @ip.to_u128
end
+
+ def test_method_ipv6?
+ assert_equal true, @ip.ipv6?
+ end
end # class IPv6LoopbackTest
class IPv6MappedTest < Test::Unit::TestCase
@@ -341,9 +341,13 @@
assert_equal 128, @ip.prefix
assert_equal @s, @ip.to_s
assert_equal @str, @ip.to_string
assert_equal @string, @ip.to_string_uncompressed
assert_equal @u128, @ip.to_u128
+ end
+
+ def test_method_ipv6?
+ assert_equal true, @ip.ipv6?
end
def test_mapped?
assert_equal true, @ip.mapped?
end