mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* complex.c: uses f_real_p macro.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7d048a55ee
commit
803aafe7c4
4 changed files with 40 additions and 22 deletions
|
@ -105,6 +105,7 @@ class Complex_Test < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_new
|
||||
assert_instance_of(Complex, Complex.__send__(:new, 2,0.0))
|
||||
if defined?(Complex::Unify)
|
||||
assert_instance_of(Fixnum, Complex.__send__(:new, 2,0))
|
||||
else
|
||||
|
@ -172,6 +173,9 @@ class Complex_Test < Test::Unit::TestCase
|
|||
assert_equal(Complex.__send__(:new, 1),Complex(1))
|
||||
assert_equal(Complex.__send__(:new, 1),Complex('1'))
|
||||
assert_raise(ArgumentError){Complex(nil)}
|
||||
assert_raise(ArgumentError){Complex(Object.new)}
|
||||
assert_raise(ArgumentError){Complex()}
|
||||
assert_raise(ArgumentError){Complex(1,2,3)}
|
||||
end
|
||||
|
||||
def test_attr
|
||||
|
@ -1033,6 +1037,12 @@ class Complex_Test < Test::Unit::TestCase
|
|||
|
||||
end
|
||||
|
||||
def test_ruby19
|
||||
assert_raise(NoMethodError){ Complex.new(1) }
|
||||
assert_raise(NoMethodError){ Complex.new!(1) }
|
||||
assert_raise(NoMethodError){ Complex.reduce(1) }
|
||||
end
|
||||
|
||||
def test_fixed_bug
|
||||
if defined?(Rational) && !Rational.instance_variable_get('@RCS_ID')
|
||||
assert_equal(Complex(1), 1 ** Complex(1))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue