summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-03 12:19:54 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-03 12:19:54 +0000
commitbac1841a9382494fcc1bad5d982aa8677091a544 (patch)
tree0febeece7086cef71149270fee4580944e73bdd0 /test/ruby
parentb61ab11f4942c3fcf0458cf60f8a1064baf3a94c (diff)
* 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/ruby')
-rw-r--r--test/ruby/test_complex.rb19
-rw-r--r--test/ruby/test_rational.rb2
2 files changed, 20 insertions, 1 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb
index b0ab318..e5f2bfc 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 bbea2da..85545fe 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))