Sha256: 765032a4ee68cdb03d69e0c5d86b8b681659d5f73043d28826adecca3f26396c
Contents?: true
Size: 961 Bytes
Versions: 1
Compression:
Stored size: 961 Bytes
Contents
###### ##### #### ###### ## ## ## ## ## #### ## ## ## ## ## ## ## ##### #### ## require 'test/unit' require 'mega/ohash' class TC_OrderedHash < Test::Unit::TestCase def test01 hsh = OrderedHash.new hsh['z'] = 1 hsh['a'] = 2 hsh['c'] = 3 assert_equal( ['z','a','c'], hsh.keys ) end def test02 hsh = OrderedHash['z', 1, 'a', 2, 'c', 3] assert_equal( ['z','a','c'], hsh.keys ) end def test03 hsh = OrderedHash['a', 1, 'c', 2, 'z', 3] assert( hsh.push('end', 15) ) assert_equal( 15, hsh['end'] ) assert( ! hsh.push('end', 30) ) assert( hsh.unshift('begin', 50) ) assert_equal( 50, hsh['begin'] ) assert( ! hsh.unshift('begin', 60) ) assert_equal( ["begin", "a", "c", "z", "end"], hsh.keys ) assert_equal( ["end", 15], hsh.pop ) assert_equal( ["begin", "a", "c", "z"], hsh.keys ) assert_equal( ["begin", 50], hsh.shift ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mega-0.3.1 | test/tc_ohash.rb |