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 | 40e31a4c26735671b58e4586c063d99c504cf1d7 (patch) | |
tree | c7d8c95cbcb3c0a0954a4eb4ab05a2469d3da5e9 /test | |
parent | fd8dd2ff7b4b9c30a3104ecff19ff60838e6b0df (diff) | |
download | ruby-40e31a4c26735671b58e4586c063d99c504cf1d7.tar.gz ruby-40e31a4c26735671b58e4586c063d99c504cf1d7.tar.xz ruby-40e31a4c26735671b58e4586c063d99c504cf1d7.zip |
* ext/socket/option.c (sockopt_s_bool): new method.
(sockopt_bool): new method.
git-svn-id: http://svn.ruby-lang.org/repos/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 000000000..06575f9cc --- /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 |