summaryrefslogtreecommitdiff
path: root/test/ruby/test_complex.rb
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-10 10:35:08 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-10 10:35:08 +0000
commit2e2fabc4335763199c69379502f8033d50f157a0 (patch)
tree11dbfb655c2f177ba151526e3e7d025580965f85 /test/ruby/test_complex.rb
parent6bf7dd725bf57dc6d52a7fe3353f70d061193d94 (diff)
* complex.c (nucomp_rationalize): calls rationalize of real part if
imaginary part is exactly zero. The patch is made by Marc-Andre Lafortune. fixes [Bug #5178] [ruby-core:38885] * test/ruby/test_complex.rb (test_rationalize): add a test for the above change. * complex.c (nucomp_to_r): fix RDoc comment. The patch is made by Marc-Andre Lafortune. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_complex.rb')
-rw-r--r--test/ruby/test_complex.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb
index 9bdcb3a356..7ff64927ac 100644
--- a/test/ruby/test_complex.rb
+++ b/test/ruby/test_complex.rb
@@ -13,6 +13,11 @@ class Complex_Test < Test::Unit::TestCase
@unify = $".grep(/(?:^|#{seps})mathn(?:\.(?:rb|so))?/).size != 0
end
+ def test_rationalize
+ assert_equal(1.quo(3), Complex(1/3.0, 0).rationalize, '[ruby-core:38885]')
+ assert_equal(1.quo(5), Complex(0.2, 0).rationalize, '[ruby-core:38885]')
+ end
+
def test_compsub
c = ComplexSub.__send__(:convert, 1)