diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-04 14:41:55 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-04 14:41:55 +0000 |
commit | c660d846edcf2f7dda9c2edf7f2c9f6ab6aa97d7 (patch) | |
tree | 1ee5c1229f0d37c9af26d2f4178edf209e720aa1 /test | |
parent | 74cac98dab6f9e18a2212cb673cfc092c757f8fb (diff) | |
download | ruby-c660d846edcf2f7dda9c2edf7f2c9f6ab6aa97d7.tar.gz |
* enum.c (nmin_filter): Fix limit value.
patch by Helder Pereira.
[Bug #11471] [ruby-core:70477]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_enum.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb index 10692e687d..4a6aa5e36e 100644 --- a/test/ruby/test_enum.rb +++ b/test/ruby/test_enum.rb @@ -289,6 +289,8 @@ class TestEnumerable < Test::Unit::TestCase assert_equal(%w[albatross dog], ary.min(2)) assert_equal(%w[dog horse], ary.min(2) {|a,b| a.length <=> b.length }) + assert_equal([13, 14], [20, 32, 32, 21, 30, 25, 29, 13, 14].min(2)) + assert_equal([2, 4, 6, 7], [2, 4, 8, 6, 7].min(4)) end def test_max @@ -303,6 +305,7 @@ class TestEnumerable < Test::Unit::TestCase assert_equal(%w[horse dog], ary.max(2)) assert_equal(%w[albatross horse], ary.max(2) {|a,b| a.length <=> b.length }) + assert_equal([3, 2], [0, 0, 0, 0, 0, 0, 1, 3, 2].max(2)) end def test_minmax @@ -325,6 +328,7 @@ class TestEnumerable < Test::Unit::TestCase assert_equal("dog", a.min_by {|x| x.length }) assert_equal(3, [2,3,1].min_by {|x| -x }) assert_equal(%w[dog horse], a.min_by(2) {|x| x.length }) + assert_equal([13, 14], [20, 32, 32, 21, 30, 25, 29, 13, 14].min_by(2) {|x| x}) end def test_max_by @@ -335,6 +339,7 @@ class TestEnumerable < Test::Unit::TestCase assert_equal("albatross", a.max_by {|x| x.length }) assert_equal(1, [2,3,1].max_by {|x| -x }) assert_equal(%w[albatross horse], a.max_by(2) {|x| x.length }) + assert_equal([3, 2], [0, 0, 0, 0, 0, 0, 1, 3, 2].max_by(2) {|x| x}) end def test_minmax_by |