diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-05 22:55:35 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-05 22:55:35 +0000 |
commit | 803aafe7c4cc5e0117c33d34fcc1fe3adc6370fd (patch) | |
tree | 69a988ef3c9e55adc280fd51d65930a48ea42c2f /test | |
parent | 7d048a55eea828ed5265a265c9151048a1bd8820 (diff) |
* complex.c: uses f_real_p macro.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_complex.rb | 10 | ||||
-rw-r--r-- | test/ruby/test_rational.rb | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb index b797ec10d0..207422ff00 100644 --- a/test/ruby/test_complex.rb +++ b/test/ruby/test_complex.rb @@ -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)) diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb index c5855a0345..3002155267 100644 --- a/test/ruby/test_rational.rb +++ b/test/ruby/test_rational.rb @@ -209,6 +209,8 @@ class Rational_Test < Test::Unit::TestCase assert_raise(ArgumentError){Rational(nil)} assert_raise(ArgumentError){Rational('')} assert_raise(ArgumentError){Rational(Object.new)} + assert_raise(ArgumentError){Rational()} + assert_raise(ArgumentError){Rational(1,2,3)} end def test_attr @@ -1067,6 +1069,11 @@ class Rational_Test < Test::Unit::TestCase assert_equal(0.25, Rational(1,2).fdiv(2)) end + def test_ruby19 + assert_raise(NoMethodError){ Rational.new(1) } + assert_raise(NoMethodError){ Rational.new!(1) } + end + def test_fixed_bug if defined?(Rational::Unify) assert_instance_of(Fixnum, Rational(1,2) ** 0) # mathn's bug |