minor: OrderedHash hash algorithm fix
This commit is contained in:
parent
28227f8ac6
commit
329af9e685
|
@ -120,7 +120,7 @@ class OrderedHash < Hash
|
|||
code = 37 * code + key.hash
|
||||
code = 37 * code + value.hash
|
||||
end
|
||||
code
|
||||
code & 0x7fffffff
|
||||
end
|
||||
|
||||
def eql?(o)
|
||||
|
|
|
@ -19,6 +19,12 @@ class OrderedHashTest < Test::Unit::TestCase
|
|||
assert_equal a, b
|
||||
end
|
||||
|
||||
def test_hash_code
|
||||
o = OrderedHash.new
|
||||
o['number'] = 50
|
||||
assert o.hash
|
||||
end
|
||||
|
||||
def test_empty
|
||||
assert_equal [], OrderedHash.new.keys
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue