Skip to content

Commit

Permalink
Add test for mruby-random
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Mar 27, 2013
1 parent d9e15a0 commit 00326ba
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions mrbgems/mruby-random/test/random.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
##
# 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
r = rand(3)
r.to_i == r
end

0 comments on commit 00326ba

Please sign in to comment.