Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
matsumotory committed Dec 28, 2012
1 parent c39798f commit 4e7e276
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 37 deletions.
11 changes: 7 additions & 4 deletions example/random.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
r = Random.new();

r.srand(10)
puts r.rand()
hoge = r.rand()
r.srand(20)
puts r.rand()
fuga = r.rand()
r.srand(10)
puts r.rand()
foo = r.rand()

100.times do |i|
puts hoge == fuga
puts hoge == foo

3.times do |i|
puts r.rand()
puts r.rand(0)
puts r.rand(10)
Expand Down
33 changes: 0 additions & 33 deletions test/ramdom.rb

This file was deleted.

16 changes: 16 additions & 0 deletions test/random.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
r = Random.new();

r.srand(10)
hoge = r.rand()
r.srand(20)
fuga = r.rand()
r.srand(10)
foo = r.rand()

assert('srand and rand 1') do
hoge != fuga
end

assert('srand and rand 2') do
hoge == foo
end

0 comments on commit 4e7e276

Please sign in to comment.