diff options
Diffstat (limited to 'test/ruby/test_complex.rb')
-rw-r--r-- | test/ruby/test_complex.rb | 19 |
1 files changed, 19 insertions, 0 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) |