Sha256: fa60e245617f1471abbad72cfd42380857ed258e020414be7f931cdee2aa70ed
Contents?: true
Size: 841 Bytes
Versions: 1
Compression:
Stored size: 841 Bytes
Contents
require 'test/unit' require 'carat/orderedhash' 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 |
---|---|
carats-0.3.0 | test/tc_orderedhash.rb |