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

ruby-changes:42924

From: nobu <ko1@a...>
Date: Sat, 14 May 2016 01:36:47 +0900 (JST)
Subject: [ruby-changes:42924] nobu:r54998 (trunk): test_rand.rb: tests for seeds

nobu	2016-05-14 01:36:41 +0900 (Sat, 14 May 2016)

  New Revision: 54998

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54998

  Log:
    test_rand.rb: tests for seeds
    
    * test/ruby/test_rand.rb: tests for Random.raw_seed and
      Random.new_seed.

  Modified files:
    trunk/test/ruby/test_rand.rb
Index: test/ruby/test_rand.rb
===================================================================
--- test/ruby/test_rand.rb	(revision 54997)
+++ test/ruby/test_rand.rb	(revision 54998)
@@ -549,4 +549,18 @@ END https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rand.rb#L549
       assert_equal(rand1, rand3)
     End
   end
+
+  def test_raw_seed
+    [0, 1, 100].each do |size|
+      v = Random.raw_seed(size)
+      assert_kind_of(String, v)
+      assert_equal(size, v.bytesize)
+    end
+  end
+
+  def test_new_seed
+    v = Random.new_seed
+    assert_kind_of(Integer, v)
+    assert_operator(v.size, :>=, 16)
+  end
 end

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

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