diff options
author | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-07 04:49:34 +0000 |
---|---|---|
committer | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-07 04:49:34 +0000 |
commit | a288ff502ed5267898fd8e38d291c611befe7f0b (patch) | |
tree | c78a91f6b59683908919643c4e0e6b6f775749b8 /test/ruby/test_complex.rb | |
parent | 72ad092960c413b6a5687c552747b20a5ed78b22 (diff) |
complex.c (f_divide): canonicalize a quotient
Cannonicalize resultant real and imaginary parts when complex number
divided by non-complex number.
[Fix GH-2065] [Bug #15505] [ruby-core:90891]
From: Joe Peric <peric.joe@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_complex.rb')
-rw-r--r-- | test/ruby/test_complex.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb index 4aa3eda1d4..80d1dc7e55 100644 --- a/test/ruby/test_complex.rb +++ b/test/ruby/test_complex.rb @@ -427,11 +427,13 @@ class Complex_Test < Test::Unit::TestCase assert_equal(Complex(Rational(3,2),Rational(3)), c / Rational(2,3)) c = Complex(1) - r = c / c - assert_instance_of(Complex, r) - assert_equal(1, r) - assert_predicate(r.real, :integer?) - assert_predicate(r.imag, :integer?) + [ 1, Rational(1), c ].each do |d| + r = c / d + assert_instance_of(Complex, r) + assert_equal(1, r) + assert_predicate(r.real, :integer?) + assert_predicate(r.imag, :integer?) + end end def test_quo |