kqueue: workaround lack of RSTRUCT* macros on Rubinius
[sleepy_penguin.git] / test / test_signalfd_siginfo.rb
blob6b82d80269da529c4d51128573d410e11ffb6652
1 require 'test/unit'
2 $-w = true
3 require 'sleepy_penguin'
5 class TestSignalFDSigInfo < Test::Unit::TestCase
6   include SleepyPenguin
8   def test_members
9     members = SignalFD::SigInfo::MEMBERS
10     assert_equal 16, members.size
11     a = SignalFD::SigInfo.new
12     members.each { |k| assert_equal 0, a.__send__(k) }
13   end
15   def test_equality
16     a = SignalFD::SigInfo.new
17     b = SignalFD::SigInfo.new
18     assert_equal a, b
20     c = Class.new(SignalFD::SigInfo).new
21     assert_equal a, c
22     assert c != c.to_hash
23   end
25   def test_to_hash
26     hash = SignalFD::SigInfo.new.to_hash
27     assert_instance_of Hash, hash
28     members = SignalFD::SigInfo::MEMBERS
29     assert_equal members.size, hash.size
30     members.each { |k| assert_equal 0, hash[k] }
31   end
32 end if defined?(SleepyPenguin::SignalFD)