mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
add assertions for division NaN
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4514516b22
commit
528ef3ca93
2 changed files with 22 additions and 2 deletions
|
@ -74,6 +74,7 @@ class TestFixnum < Test::Unit::TestCase
|
|||
assert_equal(-0x4000000000000001, 0xc000000000000003/(-3))
|
||||
assert_equal(0x40000000, (-0x40000000)/(-1), "[ruby-dev:31210]")
|
||||
assert_equal(0x4000000000000000, (-0x4000000000000000)/(-1))
|
||||
assert_raise(FloatDomainError) { 2.div(Float::NAN).nan? }
|
||||
end
|
||||
|
||||
def test_mod
|
||||
|
@ -101,6 +102,7 @@ class TestFixnum < Test::Unit::TestCase
|
|||
assert_equal(r, a.modulo(b))
|
||||
}
|
||||
}
|
||||
assert_raise(FloatDomainError) { 2.divmod(Float::NAN) }
|
||||
end
|
||||
|
||||
def test_not
|
||||
|
@ -305,4 +307,9 @@ class TestFixnum < Test::Unit::TestCase
|
|||
assert_raise(ZeroDivisionError, bug5713) { 0 ** -big }
|
||||
assert_raise(ZeroDivisionError, bug5713) { 0 ** Rational(-2,3) }
|
||||
end
|
||||
|
||||
def test_remainder
|
||||
assert_equal(1, 5.remainder(4))
|
||||
assert_predicate(4.remainder(Float::NAN), :nan?)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue