Skip to content
Snippets Groups Projects
Commit 2edbae88 authored by Alan Somers's avatar Alan Somers Committed by Romain Tartière
Browse files

Add IPv6#link_local?

parent 7f68225c
Branches
No related tags found
No related merge requests found
......@@ -397,6 +397,13 @@ module IPAddress;
@compressed
end
#
# Returns true if the address is a link local address
#
def link_local?
@groups[0] == 0xfe80
end
#
# Returns true if the address is an unspecified address
#
......
......@@ -200,6 +200,12 @@ class IPv6Test < Minitest::Test
assert_equal "1::1", @klass.new("1:0:0:0:0:0:0:1").compressed
end
def test_method_link_local?
assert_equal true, @klass.new("fe80::1").link_local?
assert_equal true, @klass.new("fe80:ffff::1").link_local?
assert_equal false, @klass.new("fe81::1").link_local?
end
def test_method_unspecified?
assert_equal true, @klass.new("::").unspecified?
assert_equal false, @ip.unspecified?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment