diff options
| author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-08-02 08:40:52 +0000 |
|---|---|---|
| committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-08-02 08:40:52 +0000 |
| commit | 0b57b686021fd5b89c06b22eca4669236afd65cf (patch) | |
| tree | 9e84e6d319e7b46854a2d0b565ae2632f526c624 /test/ruby | |
| parent | d9876a53b51d56257982821789e05a41d03f0bc5 (diff) | |
| download | ruby-0b57b686021fd5b89c06b22eca4669236afd65cf.tar.gz ruby-0b57b686021fd5b89c06b22eca4669236afd65cf.tar.xz ruby-0b57b686021fd5b89c06b22eca4669236afd65cf.zip | |
* test/ruby/test_rand.rb: add tests for Random#float's rejection
against Infinity and NaN.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_rand.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_rand.rb b/test/ruby/test_rand.rb index e20cf4e31..b932128e2 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 |
