mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* complex.c (nucomp_eql_p): new.
* complex.c (nucomp_hash): should use hash values of the elements. * rational.c (nurat_hash): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0675246ba6
commit
05ac51d225
5 changed files with 35 additions and 9 deletions
|
@ -51,6 +51,7 @@ class Complex_Test < Test::Unit::TestCase
|
|||
|
||||
def test_hash
|
||||
assert_instance_of(Fixnum, Complex(1,2).hash)
|
||||
assert_instance_of(Fixnum, Complex(1.0,2.0).hash)
|
||||
|
||||
h = {}
|
||||
h[Complex(0)] = 0
|
||||
|
@ -63,6 +64,9 @@ class Complex_Test < Test::Unit::TestCase
|
|||
|
||||
h[Complex(0,0)] = 9
|
||||
assert_equal(4, h.size)
|
||||
|
||||
h[Complex(0.0,0.0)] = 9.0
|
||||
assert_equal(5, h.size)
|
||||
end
|
||||
|
||||
def test_freeze
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue