summaryrefslogtreecommitdiff
path: root/test/ipaddress/ipv4_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ipaddress/ipv4_test.rb')
-rw-r--r--test/ipaddress/ipv4_test.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ipaddress/ipv4_test.rb b/test/ipaddress/ipv4_test.rb
index 56a78d0..f39d686 100644
--- a/test/ipaddress/ipv4_test.rb
+++ b/test/ipaddress/ipv4_test.rb
@@ -74,6 +74,22 @@ class IPv4Test < Minitest::Test
"10.32.0.1" => ["10.32.0.253", 253],
"192.0.0.0" => ["192.1.255.255", 131072]
}
+
+ @link_local = [
+ "169.254.0.0",
+ "169.254.255.255",
+ "169.254.12.34",
+ "169.254.0.0/16",
+ "169.254.0.0/17"]
+
+ @not_link_local = [
+ "127.0.0.1",
+ "127.0.1.1",
+ "192.168.0.100",
+ "169.255.0.0",
+ "169.254.0.0/15",
+ "0.0.0.0",
+ "255.255.255.255"]
end
@@ -310,6 +326,15 @@ class IPv4Test < Minitest::Test
assert_equal false, @klass.new("192.0.0.2/24").private?
end
+ def test_method_link_local?
+ @link_local.each do |addr|
+ assert_equal true, @klass.new(addr).link_local?
+ end
+ @not_link_local.each do |addr|
+ assert_equal false, @klass.new(addr).link_local?
+ end
+ end
+
def test_method_octet
assert_equal 172, @ip[0]
assert_equal 16, @ip[1]