mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_rand.rb: tests for seeds
* test/ruby/test_rand.rb: tests for Random.raw_seed and Random.new_seed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d009cebf0f
commit
fc9bc88390
1 changed files with 14 additions and 0 deletions
|
@ -549,4 +549,18 @@ END
|
||||||
assert_equal(rand1, rand3)
|
assert_equal(rand1, rand3)
|
||||||
End
|
End
|
||||||
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue