summaryrefslogtreecommitdiff
path: root/test/socket
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-31 17:37:55 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-31 17:37:55 +0000
commita78e45b5fe018f98e03e4bbf8e036822349980cb (patch)
treec477d1df6a10f5b906411bb7fed315581990e5cd /test/socket
parent1db209763a70b825db775e684ef3a21a6b5b9757 (diff)
* 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
Diffstat (limited to 'test/socket')
-rw-r--r--test/socket/test_sockopt.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/socket/test_sockopt.rb b/test/socket/test_sockopt.rb
index d3c831e..b23e44d 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('#<Socket::Option: INET IP MULTICAST_LOOP 128>', 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('#<Socket::Option: INET IP MULTICAST_TTL 128>', 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"))