[前][次][番号順一覧][スレッド一覧]

ruby-changes:12641

From: mame <ko1@a...>
Date: Sun, 2 Aug 2009 17:41:12 +0900 (JST)
Subject: [ruby-changes:12641] Ruby:r24354 (trunk): * test/ruby/test_rand.rb: add tests for Random#float's rejection

mame	2009-08-02 17:40:52 +0900 (Sun, 02 Aug 2009)

  New Revision: 24354

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24354

  Log:
    * test/ruby/test_rand.rb: add tests for Random#float's rejection
      against Infinity and NaN.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_rand.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 24353)
+++ ChangeLog	(revision 24354)
@@ -1,3 +1,8 @@
+Sun Aug  2 16:53:19 2009  Yusuke Endoh  <mame@t...>
+
+	* 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  <nobu@r...>
 
 	* random.c (rand_int): prevent from GC.
Index: test/ruby/test_rand.rb
===================================================================
--- test/ruby/test_rand.rb	(revision 24353)
+++ test/ruby/test_rand.rb	(revision 24354)
@@ -354,6 +354,9 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]