aboutsummaryrefslogtreecommitdiffstats
path: root/test/socket/test_sockopt.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-20 15:51:33 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-20 15:51:33 +0000
commit5af92f6369f02318d57114342891b849b12d39e4 (patch)
treef7a8b7f61bdef6721c819d3cfc132cc56aed8c58 /test/socket/test_sockopt.rb
parentcbaa60c9b713f7645583166cbbceadfebc28e536 (diff)
downloadruby-5af92f6369f02318d57114342891b849b12d39e4.tar.gz
add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/socket/test_sockopt.rb')
-rw-r--r--test/socket/test_sockopt.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/socket/test_sockopt.rb b/test/socket/test_sockopt.rb
index d1f6f29c34..ee7ba9b9ff 100644
--- a/test/socket/test_sockopt.rb
+++ b/test/socket/test_sockopt.rb
@@ -43,6 +43,13 @@ class TestSocketOption < Test::Unit::TestCase
assert_equal(128, sockopt.ipv4_multicast_ttl)
end
+ def test_ipv4_multicast_ttl_size
+ expected_size = Socket.open(:INET, :DGRAM) {|s|
+ s.getsockopt(:IP, :MULTICAST_TTL).to_s.bytesize
+ }
+ assert_equal(expected_size, Socket::Option.ipv4_multicast_ttl(0).to_s.bytesize)
+ end
+
def test_unpack
sockopt = Socket::Option.new(:INET, :SOCKET, :KEEPALIVE, [1].pack("i"))
assert_equal([1], sockopt.unpack("i"))