diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-10 12:09:57 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-10 12:09:57 +0000 |
commit | 98d3eca7fc092e0237f6cfd06bb5cf58d3796d36 (patch) | |
tree | c7d8c95cbcb3c0a0954a4eb4ab05a2469d3da5e9 /test | |
parent | 7be3cdbc0443e007ab5aa294d216e086c8a8af7e (diff) | |
download | ruby-98d3eca7fc092e0237f6cfd06bb5cf58d3796d36.tar.gz |
* ext/socket/option.c (sockopt_s_bool): new method.
(sockopt_bool): new method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/socket/test_sockopt.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/socket/test_sockopt.rb b/test/socket/test_sockopt.rb new file mode 100644 index 0000000000..06575f9cc3 --- /dev/null +++ b/test/socket/test_sockopt.rb @@ -0,0 +1,17 @@ +require 'test/unit' +require 'socket' + +class TestSockOpt < Test::Unit::TestCase + def test_bool + opt = Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, true) + assert_equal(1, opt.int) + opt = Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, false) + assert_equal(0, opt.int) + opt = Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 0) + assert_equal(false, opt.bool) + opt = Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 1) + assert_equal(true, opt.bool) + opt = Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 2) + assert_equal(true, opt.bool) + end +end |