diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-03 12:19:54 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-03 12:19:54 +0000 |
commit | bac1841a9382494fcc1bad5d982aa8677091a544 (patch) | |
tree | 0febeece7086cef71149270fee4580944e73bdd0 /test | |
parent | b61ab11f4942c3fcf0458cf60f8a1064baf3a94c (diff) | |
download | ruby-bac1841a9382494fcc1bad5d982aa8677091a544.tar.gz |
* rational.c: renamed equal_p to eqeq_p.
* complex.c: ditto.
* complex.c (nucomp_equal_p): added.
Complex(NaN).equal?(Complex(NaN)) should return true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_complex.rb | 19 | ||||
-rw-r--r-- | test/ruby/test_rational.rb | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb index b0ab318df8..e5f2bfc2ef 100644 --- a/test/ruby/test_complex.rb +++ b/test/ruby/test_complex.rb @@ -489,6 +489,18 @@ class Complex_Test < Test::Unit::TestCase end def test_equal + unless @unify + assert_equal(true, Complex(1,0).equal?(Complex(1))) + assert_equal(false, Complex(1,0).equal?(Complex(1.0))) + if (0.0/0).nan? + nan = 0.0/0 + assert_equal(true, Complex(nan).equal?(Complex(nan))) + assert_equal(false, Complex(nan).equal?(nan)) + end + end + end + + def test_eqeq assert(Complex(1,0) == Complex(1)) assert(Complex(-1,0) == Complex(-1)) @@ -891,6 +903,13 @@ class Complex_Test < Test::Unit::TestCase assert_equal(0, 1.0.angle) assert_equal(0, 1.0.phase) + if (0.0/0).nan? + nan = 0.0/0 + assert(nan.arg.equal?(nan)) + assert(nan.angle.equal?(nan)) + assert(nan.phase.equal?(nan)) + end + assert_equal(Math::PI, -1.arg) assert_equal(Math::PI, -1.angle) assert_equal(Math::PI, -1.phase) diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb index bbea2da83c..85545fea6b 100644 --- a/test/ruby/test_rational.rb +++ b/test/ruby/test_rational.rb @@ -697,7 +697,7 @@ class Rational_Test < Test::Unit::TestCase assert_equal(nil, Rational(0) <=> 'foo') end - def test_equal + def test_eqeq assert(Rational(1,1) == Rational(1)) assert(Rational(-1,1) == Rational(-1)) |