From bac1841a9382494fcc1bad5d982aa8677091a544 Mon Sep 17 00:00:00 2001 From: tadf Date: Fri, 3 Jul 2009 12:19:54 +0000 Subject: * 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 --- test/ruby/test_complex.rb | 19 +++++++++++++++++++ test/ruby/test_rational.rb | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'test') 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)) -- cgit v1.2.3