about summary refs log tree commit
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-06-06 19:23:35 -0700
committerEric Wong <normalperson@yhbt.net>2011-06-06 19:23:35 -0700
commit5e580a48a930fff71bcfded65616dcfd9c17e19c (patch)
tree294e110c2b14d6a87b3b855052fb6e9a6a7cc7e5
parentcbead61ab6ff9094aed0b5ee2a1628b8e9af09d8 (diff)
downloadrpatricia-5e580a48a930fff71bcfded65616dcfd9c17e19c.tar.gz
test_ipv6: improve tests for ipv6
We need to ensure IPv4-mapped-IPv6 addresses work.
-rw-r--r--test/test_ipv6.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/test_ipv6.rb b/test/test_ipv6.rb
index 7bf95c2..f16ab65 100644
--- a/test/test_ipv6.rb
+++ b/test/test_ipv6.rb
@@ -8,6 +8,15 @@ class TestIPv6 < Test::Unit::TestCase
     node = t.add('1234:567::/35', 'hello world')
     assert_kind_of Patricia::Node, node
     assert_equal 'hello world', node.data
-    t.match_best('1234:567::/128').data
+    assert_equal 'hello world', t.match_best('1234:567::/128').data
+  end
+
+  def test_ipv4_mapped_ipv6
+    t = Patricia.new :AF_INET6
+    assert_equal :AF_INET6, t.family
+    node = t.add('::ffff:10.0.0.0/8', 'hello world')
+    assert_kind_of Patricia::Node, node
+    assert_equal 'hello world', node.data
+    assert_equal 'hello world', t.match_best('::ffff:10.0.0.1').data
   end
 end