4 class TestRaindrops < Test::Unit::TestCase
7 @rw = Raindrops::Struct.new(:r, :w)
8 assert @rw.kind_of?(Class)
11 TMP = Raindrops::Struct.new(:r, :w)
16 assert_equal 1, tmp.incr_r
18 assert_equal({ :r => 1, :w => 0 }, tmp.to_hash)
20 assert_equal 1, tmp[0]
21 assert_equal 0, tmp[1]
22 assert_equal [ :r, :w ], TMP::MEMBERS
27 assert_equal({ :r => 5, :w => 6 }, tmp.to_hash)
33 assert_equal({ :r => 5, :w => 6 }, b.to_hash)
34 assert_nothing_raised { 4.times { b.decr_r } }
35 assert_equal({ :r => 1, :w => 6 }, b.to_hash)
36 assert_equal({ :r => 5, :w => 6 }, a.to_hash)
39 class Foo < Raindrops::Struct.new(:a, :b, :c, :d)
50 assert_equal [0, 0, 0, 0], Foo.new.to_ary
51 assert_equal "world", Foo.new.hello