summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Miller <icy.arctic.fox@gmail.com>2016-11-14 14:33:02 -0700
committerRomain Tartière <romain@blogreen.org>2017-08-30 09:13:22 +0200
commit5a089bda5a9ff670751162092bd5853c30044d74 (patch)
treebe0e5edb17703a0d9d2dddab66efc9d0f52643ae
parentf131450c187953ff3c4e20c9e7e8c0ce7070e224 (diff)
downloadipaddress-5a089bda5a9ff670751162092bd5853c30044d74.tar.gz
Add tests for unique_local?
-rw-r--r--test/ipaddress/ipv6_test.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ipaddress/ipv6_test.rb b/test/ipaddress/ipv6_test.rb
index e29cd40..cfff9e7 100644
--- a/test/ipaddress/ipv6_test.rb
+++ b/test/ipaddress/ipv6_test.rb
@@ -58,6 +58,22 @@ class IPv6Test < Minitest::Test
"ff80:03:02:01::",
"2001:db8::8:800:200c:417a",
"fe80::/63"]
+
+ @unique_local = [
+ "fc00::/7",
+ "fc00::/8",
+ "fd00::/8",
+ "fd12:3456:789a:1::1",
+ "fd12:3456:789a:1::/64",
+ "fc00::1"]
+
+ @not_unique_local = [
+ "fc00::/6",
+ "::",
+ "::1",
+ "fe80::",
+ "fe80::1",
+ "fe80::/64"]
end
@@ -240,6 +256,15 @@ class IPv6Test < Minitest::Test
end
end
+ def test_method_unique_local?
+ @unique_local.each do |addr|
+ assert_equal true, @klass.new(addr).unique_local?
+ end
+ @not_unique_local.each do |addr|
+ assert_equal false, @klass.new(addr).unique_local?
+ end
+ end
+
def test_method_network
@networks.each do |addr,net|
ip = @klass.new addr