mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #1078 from mattn/test_mruby-random
Add test for mruby-random
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
##
|
||||
# Random Test
|
||||
|
||||
assert("Random#srand") do
|
||||
r1 = Random.new(123)
|
||||
r2 = Random.new(123)
|
||||
r1.rand == r2.rand
|
||||
end
|
||||
|
||||
assert("Kernel::srand") do
|
||||
srand(234)
|
||||
r1 = rand
|
||||
srand(234)
|
||||
r2 = rand
|
||||
r1 == r2
|
||||
end
|
||||
|
||||
assert("fixnum") do
|
||||
rand(3).class == Fixnum
|
||||
end
|
||||
|
||||
assert("float") do
|
||||
rand.class == Float
|
||||
end
|
||||
Reference in New Issue
Block a user