Sha256: 72acf7641f1d71efdcfa5320c0b65b753a7ab3a8c5d9b400d38b045227f9809e
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
# _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # # for lib/facets/core/enumerable/each_slice.rb # # Extracted Tue Jul 25 10:07:15 EDT 2006 # Unit Tools Reap Test Extractor # require 'facets/core/enumerable/each_slice.rb' require 'test/unit' class TCEnumerable < Test::Unit::TestCase def test_each_slice x = [] [1,2,3,4].each_slice{ |a,b| x << [a,b] } o = [[1,2],[3,4]] assert_equal( o, x ) x = [] [1,2,3,4,5].each_by{ |a,b,c| x << [a,b,c] } o = [[1,2,3],[4,5,nil]] assert_equal( o, x ) x = [] [1,2,3,4].each_slice(2){ |a,b| x << [a,b] } o = [[1,2],[3,4]] assert_equal( o, x ) x = [] [1,2,3,4,5,6,7,8].each_slice(4){ |*a| x << a } o = [[1,2,3,4],[5,6,7,8]] assert_equal( o, x ) x = [] [1,2,3,4,5,6].each_slice(3){ |*a| x << a } o = [[1,2,3],[4,5,6]] assert_equal( o, x ) a = [1,2,3,4,5,6] r = [] a.each_slice(2){ |x,y| r << [x,y] } assert_equal( [[1,2],[3,4],[5,6]], r ) r = [] a.each_slice(3){ |*e| r << e } assert_equal( [[1,2,3],[4,5,6]], r ) end end class TC02 < Test::Unit::TestCase def test_each_by x = [] [1,2,3,4].each_by(2){ |a,b| x << [a,b] } o = [[1,2],[3,4]] assert_equal( o, x ) x = [] [1,2,3,4,5].each_by(3){ |*a| x << a } o = [[1,2,3],[4,5]] assert_equal( o, x ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
facets-1.7.0 | test/lib/facets/core/enumerable/test_each_slice.rb |
facets-1.7.30 | test/lib/facets/core/enumerable/test_each_slice.rb |