From a78e45b5fe018f98e03e4bbf8e036822349980cb Mon Sep 17 00:00:00 2001 From: naruse Date: Fri, 31 May 2013 17:37:55 +0000 Subject: * ext/socket/option.c (sockopt_s_byte): constructor of the sockopt whose value's is byte. * ext/socket/option.c (sockopt_byte): getter for above. * ext/socket/option.c (inspect_byte): inspect for above. * ext/socket/option.c (sockopt_s_ip_multicast_loop): constructor of the sockopt whose optname is IP_MULTICAST_LOOP. * ext/socket/option.c (sockopt_ip_multicast_loop): getter for above. * ext/socket/option.c (sockopt_s_ip_multicast_ttl): constructor of the sockopt whose optname is IP_MULTICAST_TTL. * ext/socket/option.c (sockopt_ip_multicast_ttl): getter for above. * ext/socket/option.c (sockopt_inspect): use above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/socket/test_sockopt.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/socket') diff --git a/test/socket/test_sockopt.rb b/test/socket/test_sockopt.rb index d3c831ed79..b23e44dc26 100644 --- a/test/socket/test_sockopt.rb +++ b/test/socket/test_sockopt.rb @@ -25,6 +25,24 @@ class TestSocketOption < Test::Unit::TestCase assert_equal(true, opt.bool) end + def test_ip_multicast_loop + sockopt = Socket::Option.ip_multicast_loop(128) + assert_equal('#', sockopt.inspect) + assert_equal(Socket::AF_INET, sockopt.family) + assert_equal(Socket::IPPROTO_IP, sockopt.level) + assert_equal(Socket::IP_MULTICAST_LOOP, sockopt.optname) + assert_equal(128, sockopt.ip_multicast_loop) + end + + def test_ip_multicast_ttl + sockopt = Socket::Option.ip_multicast_ttl(128) + assert_equal('#', sockopt.inspect) + assert_equal(Socket::AF_INET, sockopt.family) + assert_equal(Socket::IPPROTO_IP, sockopt.level) + assert_equal(Socket::IP_MULTICAST_TTL, sockopt.optname) + assert_equal(128, sockopt.ip_multicast_ttl) + end + def test_unpack sockopt = Socket::Option.new(:INET, :SOCKET, :KEEPALIVE, [1].pack("i")) assert_equal([1], sockopt.unpack("i")) -- cgit v1.2.3