summaryrefslogtreecommitdiff
path: root/test/ruby/test_enumerator.rb
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-06 17:11:51 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-06 17:11:51 +0000
commitba59365db9283b23b1a2dd9b91dac7303c798326 (patch)
tree4e8b3275d49a16539d6991d3d89843f02c060be5 /test/ruby/test_enumerator.rb
parent68c90c4a2d0b9431ad6f12ba12c91c7e3d65360d (diff)
* array.c (rb_ary_repeated_combination): Support for repeated_combination.size
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_enumerator.rb')
-rw-r--r--test/ruby/test_enumerator.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb
index 1c04a05bb0..93d46a6c23 100644
--- a/test/ruby/test_enumerator.rb
+++ b/test/ruby/test_enumerator.rb
@@ -450,6 +450,11 @@ class TestEnumerator < Test::Unit::TestCase
check_consistency_for_combinatorics(:repeated_permutation)
assert_equal 291733167875766667063796853374976,
(1..42).to_a.repeated_permutation(20).size # 42 ** 20
+
+ check_consistency_for_combinatorics(:repeated_combination)
+ assert_equal 28258808871162574166368460400,
+ (1..59).to_a.repeated_combination(42).size
+ # 1.upto(100).inject(:*) / 1.upto(42).inject(:*) / 1.upto(58).inject(:*)
end
end