mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* complex.c (nucomp_s_convert): accepts complex
value (Complex(a,b) as a+bi). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b452a519c9
commit
d965e99b04
4 changed files with 31 additions and 27 deletions
|
@ -158,6 +158,9 @@ class Complex_Test < Test::Unit::TestCase
|
|||
c = Complex(0,Complex(1))
|
||||
assert_equal(Complex.__send__(:new, 0,1), c)
|
||||
|
||||
c = Complex(Complex(1,1),Complex(1))
|
||||
assert_equal(Complex.__send__(:new, 1,2), c)
|
||||
|
||||
c = 5.re
|
||||
assert_equal(Complex.__send__(:new, 5,0), c)
|
||||
|
||||
|
@ -169,7 +172,7 @@ class Complex_Test < Test::Unit::TestCase
|
|||
|
||||
c = Complex(2,0).im
|
||||
assert_equal(Complex.__send__(:new, 0,2), c)
|
||||
assert_raise(ArgumentError){Complex(1,2).im}
|
||||
assert_equal(Complex.__send__(:new, -2,1), Complex(1,2).im)
|
||||
|
||||
c = Complex::I
|
||||
assert_equal(Complex.__send__(:new, 0,1), c)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue