summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-07 04:14:57 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-07 04:14:57 +0000
commitfa161103263f001ba009cecfbc25ed336757ede7 (patch)
tree0677b0d96fbcc241b80054a32859f4c8131438c5 /test
parentf7b3f1c528260e50db430a0dcd3678d447308d89 (diff)
* bignum.c (rb_big_fdiv): flo.fdiv(NaN) should result NaN.
* numeric.c (num_quo): renamed and moved from bignum.c. [ruby-dev:34582] * bignum.c (rb_big_fdiv): update RDoc description * rational.c (nurat_s_new_m): small refactoring. * bignum.c (rb_big2dbl): no need for forceful warning when converting to float. overflow is a nature of float values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_bignum.rb4
-rw-r--r--test/ruby/test_numeric.rb11
2 files changed, 3 insertions, 12 deletions
diff --git a/test/ruby/test_bignum.rb b/test/ruby/test_bignum.rb
index 7d8409a449..d2d6f1f2cf 100644
--- a/test/ruby/test_bignum.rb
+++ b/test/ruby/test_bignum.rb
@@ -263,14 +263,14 @@ class TestBignum < Test::Unit::TestCase
assert_equal(T32.to_f, T32.quo(1.0))
assert_equal(T32.to_f, T32.quo(T_ONE))
- assert_raise(ArgumentError) { T32.quo("foo") }
+ assert_raise(TypeError) { T32.quo("foo") }
assert_equal(1024**1024, (1024**1024).quo(1))
assert_equal(1024**1024, (1024**1024).quo(1.0))
assert_equal(1024**1024*2, (1024**1024*2).quo(1))
inf = 1 / 0.0; nan = inf / inf
- assert_raise(FloatDomainError) { (1024**1024*2).quo(nan) }
+ assert((1024**1024*2).quo(nan).nan?)
end
def test_pow
diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb
index 8f478bd2c6..584139a7f8 100644
--- a/test/ruby/test_numeric.rb
+++ b/test/ruby/test_numeric.rb
@@ -51,16 +51,7 @@ class TestNumeric < Test::Unit::TestCase
end
def test_quo
- DummyNumeric.class_eval do
- def /(x); :div; end
- end
-
- assert_equal(:div, DummyNumeric.new.quo(0))
-
- ensure
- DummyNumeric.class_eval do
- remove_method :/
- end
+ assert_raise(ArgumentError) {DummyNumeric.new.quo(1)}
end
def test_divmod