# _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # # for lib/facet/openobject.rb # # Extracted Wed Jan 25 10:52:51 EST 2006 # Unit Tools Reap Test Extractor # require 'facet/openobject.rb' require 'test/unit' class TC01 < Test::Unit::TestCase def test_01_001 f0 = OpenObject.new f0[:a] = 1 assert_equal( [1], f0.to_a ) assert_equal( {:a=>1}, f0.to_h ) end def test_01_002 f0 = OpenObject.new( {:a=>1} ) f0[:b] = 2 assert_equal( {:a=>1,:b=>2}, f0.to_h ) end end class TC02 < Test::Unit::TestCase def test_02_001 f0 = OpenObject.new( :f0=>"f0" ) h0 = { :h0=>"h0" } assert_equal( OpenObject.new( :f0=>"f0", :h0=>"h0" ), f0.__merge__( h0 ) ) assert_equal( {:f0=>"f0", :h0=>"h0"}, h0.merge( f0 ) ) end def test_02_002 f1 = OpenObject.new( :f1=>"f1" ) h1 = { :h1=>"h1" } f1.__update__( h1 ) h1.update( f1 ) assert_equal( OpenObject.new( :f1=>"f1", :h1=>"h1" ), f1 ) assert_equal( {:f1=>"f1", :h1=>"h1"}, h1 ) end end class TC03 < Test::Unit::TestCase def test_01_001 fo = OpenObject.new 99.times{ |i| fo.__send__( "n#{i}=", 1 ) } 99.times{ |i| assert_equal( 1, fo.__send__( "n#{i}" ) ) } end end