From dfd3d1fb295ad736b2bc2366a7bab49923793bb2 Mon Sep 17 00:00:00 2001 From: mame Date: Sun, 2 Aug 2009 08:40:52 +0000 Subject: [PATCH] * test/ruby/test_rand.rb: add tests for Random#float's rejection against Infinity and NaN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ test/ruby/test_rand.rb | 3 +++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 880e4d702f..2e4ac6b51d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Aug 2 16:53:19 2009 Yusuke Endoh + + * test/ruby/test_rand.rb: add tests for Random#float's rejection + against Infinity and NaN. + Sun Aug 2 14:20:43 2009 Nobuyoshi Nakada * random.c (rand_int): prevent from GC. diff --git a/test/ruby/test_rand.rb b/test/ruby/test_rand.rb index e20cf4e317..b932128e23 100644 --- a/test/ruby/test_rand.rb +++ b/test/ruby/test_rand.rb @@ -354,6 +354,9 @@ END assert_in_delta(1.0897663659937937, r.float(2), 0.0001) assert_in_delta(5.3704626067153264e+29, r.float(2**100), 10**25) + assert_raise(Errno::EDOM, Errno::ERANGE) { r.float(1.0 / 0.0) } + assert_raise(Errno::EDOM, Errno::ERANGE) { r.float(0.0 / 0.0) } + # is this intentional? assert_raise(TypeError) { r.float(1..2) } end