diff options
| author | Emiliano Lesende <[email protected]> | 2013-11-01 11:44:40 -0300 |
|---|---|---|
| committer | Emiliano Lesende <[email protected]> | 2013-11-01 11:44:40 -0300 |
| commit | d8cc37cdf95b72933ff3d8466b8ea3c4e3ff8010 (patch) | |
| tree | 15d493371ceec9a1fd6c4fc6d532aca8df88cc08 /mrbgems/mruby-random/test | |
| parent | 92825660ea94cde3b588ae0b1e4b0e9d311f718e (diff) | |
| download | mruby-d8cc37cdf95b72933ff3d8466b8ea3c4e3ff8010.tar.gz mruby-d8cc37cdf95b72933ff3d8466b8ea3c4e3ff8010.zip | |
Added shuffle and shuffle! to the Array class in the Random gem.
Diffstat (limited to 'mrbgems/mruby-random/test')
| -rw-r--r-- | mrbgems/mruby-random/test/random.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mrbgems/mruby-random/test/random.rb b/mrbgems/mruby-random/test/random.rb index 01d231d5c..b35acaafd 100644 --- a/mrbgems/mruby-random/test/random.rb +++ b/mrbgems/mruby-random/test/random.rb @@ -30,3 +30,17 @@ end assert("float") do rand.class == Float end + +assert("Array#shuffle") do + ary = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + shuffled = ary.shuffle + + ary == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and shuffled != ary and 10.times { |x| ary.include? x } +end + +assert('Array#shuffle!') do + ary = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + ary.shuffle! + + ary != [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and 10.times { |x| ary.include? x } +end
\ No newline at end of file |
