From 528ef3ca933b7cbbbd2e7dde8b1863bbed91947c Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 1 Aug 2014 07:35:34 +0000 Subject: add assertions for division NaN git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_fixnum.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/ruby/test_fixnum.rb') 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 -- cgit v1.2.3