summaryrefslogtreecommitdiff
path: root/test/ipaddress/ipv6_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ipaddress/ipv6_test.rb')
-rw-r--r--test/ipaddress/ipv6_test.rb40
1 files changed, 19 insertions, 21 deletions
diff --git a/test/ipaddress/ipv6_test.rb b/test/ipaddress/ipv6_test.rb
index 3ae51b3..fdfcbea 100644
--- a/test/ipaddress/ipv6_test.rb
+++ b/test/ipaddress/ipv6_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'
-class IPv6Test < Test::Unit::TestCase
+class IPv6Test < Minitest::Test
def setup
@klass = IPAddress::IPv6
@@ -53,15 +53,12 @@ class IPv6Test < Test::Unit::TestCase
def test_initialize
assert_instance_of @klass, @ip
- @valid_ipv6.keys.each do |ip|
- assert_nothing_raised {@klass.new ip}
- end
@invalid_ipv6.each do |ip|
- assert_raise(ArgumentError) {@klass.new ip}
+ assert_raises(ArgumentError) {@klass.new ip}
end
assert_equal 64, @ip.prefix
- assert_raise(ArgumentError) {
+ assert_raises(ArgumentError) {
@klass.new "::10.1.1.1"
}
end
@@ -307,18 +304,18 @@ class IPv6Test < Test::Unit::TestCase
compressed = "2001:db8:0:cd30::"
expanded = "2001:0db8:0000:cd30:0000:0000:0000:0000"
assert_equal expanded, @klass.expand(compressed)
- assert_not_equal expanded, @klass.expand("2001:0db8:0::cd3")
- assert_not_equal expanded, @klass.expand("2001:0db8::cd30")
- assert_not_equal expanded, @klass.expand("2001:0db8::cd3")
+ refute_equal expanded, @klass.expand("2001:0db8:0::cd3")
+ refute_equal expanded, @klass.expand("2001:0db8::cd30")
+ refute_equal expanded, @klass.expand("2001:0db8::cd3")
end
def test_classmethod_compress
compressed = "2001:db8:0:cd30::"
expanded = "2001:0db8:0000:cd30:0000:0000:0000:0000"
assert_equal compressed, @klass.compress(expanded)
- 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")
+ refute_equal compressed, @klass.compress("2001:0db8:0::cd3")
+ refute_equal compressed, @klass.compress("2001:0db8::cd30")
+ refute_equal compressed, @klass.compress("2001:0db8::cd3")
end
def test_classmethod_parse_data
@@ -339,9 +336,15 @@ class IPv6Test < Test::Unit::TestCase
assert_equal @ip.to_s, @klass.parse_hex(@hex,64).to_s
end
+ def test_group_updates
+ ip = @klass.new("2001:db8::8:800:200c:417a/64")
+ ip[2] = '1234'
+ assert_equal "2001:db8:4d2:0:8:800:200c:417a/64", ip.to_string
+ end
+
end # class IPv6Test
-class IPv6UnspecifiedTest < Test::Unit::TestCase
+class IPv6UnspecifiedTest < Minitest::Test
def setup
@klass = IPAddress::IPv6::Unspecified
@@ -354,7 +357,6 @@ class IPv6UnspecifiedTest < Test::Unit::TestCase
end
def test_initialize
- assert_nothing_raised {@klass.new}
assert_instance_of @klass, @ip
end
@@ -375,7 +377,7 @@ class IPv6UnspecifiedTest < Test::Unit::TestCase
end # class IPv6UnspecifiedTest
-class IPv6LoopbackTest < Test::Unit::TestCase
+class IPv6LoopbackTest < Minitest::Test
def setup
@klass = IPAddress::IPv6::Loopback
@@ -388,7 +390,6 @@ class IPv6LoopbackTest < Test::Unit::TestCase
end
def test_initialize
- assert_nothing_raised {@klass.new}
assert_instance_of @klass, @ip
end
@@ -408,7 +409,7 @@ class IPv6LoopbackTest < Test::Unit::TestCase
end # class IPv6LoopbackTest
-class IPv6MappedTest < Test::Unit::TestCase
+class IPv6MappedTest < Minitest::Test
def setup
@klass = IPAddress::IPv6::Mapped
@@ -434,14 +435,11 @@ class IPv6MappedTest < Test::Unit::TestCase
end
def test_initialize
- assert_nothing_raised {@klass.new("::172.16.10.1")}
assert_instance_of @klass, @ip
@valid_mapped.each do |ip, u128|
- assert_nothing_raised {@klass.new ip}
assert_equal u128, @klass.new(ip).to_u128
end
@valid_mapped_ipv6.each do |ip, u128|
- assert_nothing_raised {@klass.new ip}
assert_equal u128, @klass.new(ip).to_u128
end
end
@@ -468,5 +466,5 @@ class IPv6MappedTest < Test::Unit::TestCase
def test_mapped?
assert_equal true, @ip.mapped?
end
-
+
end # class IPv6MappedTest