Sha256: 7f2547bd7cc078b518609efad876d06fd924910eee7b8e9d2cd800199ebcf89a
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
# _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # # for lib/nano/enumerable/each_slice.rb # # Extracted Fri Oct 28 14:20:18 EDT 2005 # Unit Tools Reap Test Extractor # require 'nano/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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facets-0.9.0 | test/lib/nano/enumerable/test_each_slice.rb |