ruby-changes:32587
From: akr <ko1@a...>
Date: Tue, 21 Jan 2014 00:51:37 +0900 (JST)
Subject: [ruby-changes:32587] akr:r44666 (trunk): add a test.
akr 2014-01-21 00:51:33 +0900 (Tue, 21 Jan 2014) New Revision: 44666 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44666 Log: add a test. Modified files: trunk/test/socket/test_sockopt.rb Index: test/socket/test_sockopt.rb =================================================================== --- test/socket/test_sockopt.rb (revision 44665) +++ test/socket/test_sockopt.rb (revision 44666) @@ -43,6 +43,13 @@ class TestSocketOption < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/socket/test_sockopt.rb#L43 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")) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/