summaryrefslogtreecommitdiff
path: root/test/ruby/test_array.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_array.rb')
-rw-r--r--test/ruby/test_array.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 42553d1932..7258b22a5b 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1518,9 +1518,13 @@ class TestArray < Test::Unit::TestCase
end
end
- def test_choice
+ def test_sample
100.times do
- assert([0, 1, 2].include?([2, 1, 0].choice))
+ assert([0, 1, 2].include?([2, 1, 0].sample))
+ samples = [2, 1, 0].sample(2)
+ samples.each{|sample|
+ assert([0, 1, 2].include?(sample))
+ }
end
end