summaryrefslogtreecommitdiff
path: root/test/ruby/test_complex.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_complex.rb')
-rw-r--r--test/ruby/test_complex.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb
index 74d6d5dd8a..39a02044fa 100644
--- a/test/ruby/test_complex.rb
+++ b/test/ruby/test_complex.rb
@@ -505,6 +505,14 @@ class Complex_Test < Test::Unit::TestCase
end
end
+ def test_coerce
+ assert_equal([Complex(2),Complex(1)], Complex(1).coerce(2))
+ assert_equal([Complex(2.2),Complex(1)], Complex(1).coerce(2.2))
+ assert_equal([Complex(Rational(2)),Complex(1)],
+ Complex(1).coerce(Rational(2)))
+ assert_equal([Complex(2),Complex(1)], Complex(1).coerce(Complex(2)))
+ end
+
def test_unify
if @unify
assert_instance_of(Fixnum, Complex(1,2) + Complex(-1,-2))