From 5a089bda5a9ff670751162092bd5853c30044d74 Mon Sep 17 00:00:00 2001
From: Michael Miller <icy.arctic.fox@gmail.com>
Date: Mon, 14 Nov 2016 14:33:02 -0700
Subject: [PATCH] Add tests for unique_local?

---
 test/ipaddress/ipv6_test.rb | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

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
-- 
GitLab