summaryrefslogtreecommitdiff
path: root/test/ruby/test_fixnum.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_fixnum.rb')
-rw-r--r--test/ruby/test_fixnum.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_fixnum.rb b/test/ruby/test_fixnum.rb
index c86cba3b7c..8b2cf2e256 100644
--- a/test/ruby/test_fixnum.rb
+++ b/test/ruby/test_fixnum.rb
@@ -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