summaryrefslogtreecommitdiff
path: root/test/ruby/test_bignum.rb
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-18 17:03:16 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-18 17:03:16 +0000
commit77f3fc305491dab95b02d9d60c5f883f9e5b05df (patch)
tree49f0968711489a5de54aec13d6d5dc4c09d6ea87 /test/ruby/test_bignum.rb
parent34b93543fcac01b1342a9eb084a4ef16f86b5a16 (diff)
* test/ruby/test_array.rb: add some tests (for coverage).
* test/ruby/test_bignum.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_bignum.rb')
-rw-r--r--test/ruby/test_bignum.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_bignum.rb b/test/ruby/test_bignum.rb
index 8c496a36e6..cba935f121 100644
--- a/test/ruby/test_bignum.rb
+++ b/test/ruby/test_bignum.rb
@@ -175,6 +175,8 @@ class TestBignum < Test::Unit::TestCase
def test_to_f
assert_nothing_raised { T31P.to_f.to_i }
assert_raise(FloatDomainError) { (1024**1024).to_f.to_i }
+ assert_equal(1, (2**50000).to_f.infinite?)
+ assert_equal(-1, (-(2**50000)).to_f.infinite?)
end
def test_cmp
@@ -414,4 +416,15 @@ class TestBignum < Test::Unit::TestCase
assert_in_delta(1.0, @fmax2.fdiv(@fmax2), 0.01)
end
+ def test_float_fdiv
+ b = 1E+300.to_i
+ assert_equal(b, (b ** 2).fdiv(b))
+ assert(@big.fdiv(0.0 / 0.0).nan?)
+ end
+
+ def test_obj_fdiv
+ o = Object.new
+ def o.coerce(x); [x, 2**100]; end
+ assert_equal((2**200).to_f, (2**300).fdiv(o))
+ end
end