Sha256: b8f51a3ace8c4fb8a843844c72e88984ddcf6c05eaf1f3869ba542fe5cf44775
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
# _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # # for lib/mega/enumerable_args.rb # # Extracted Fri Oct 28 14:20:18 EDT 2005 # Unit Tools Reap Test Extractor # require 'mega/enumerable_args.rb' require 'test/unit' # fixture class PlusArray include EnumerableArgs def initialize(arr) @arr = arr end def each(n=0) @arr.each{ |e| yield(e+n) } end end class TC_Enumerable < Test::Unit::TestCase def test_collect t = PlusArray.new([1,2,3]) assert_equal( [5,6,7], t.collect(4){ |e| e } ) end def test_each_slice t = PlusArray.new([1,2,3,4]) a = [] t.each_slice(4){ |e,f| a << [e,f] } assert_equal( [[5,6],[7,8]], a ) end def test_grep # TODO end def test_to_a t = PlusArray.new([1,2,3]) assert_equal( [5,6,7], t.to_a(4) ) end def test_min t = PlusArray.new([1,2,3]) assert_equal( 5, t.min(4) ) end def test_max t = PlusArray.new([1,2,3]) assert_equal( 7, t.max(4) ) end def test_include? t = PlusArray.new([1,2,3]) assert( t.include?(7,4) ) end def test_select t = PlusArray.new([1,2,3]) assert_equal( [6], t.select(4){ |x| x == 6 } ) end def test_reject t = PlusArray.new([1,2,3]) assert_equal( [5,7], t.reject(4){ |x| x == 6 } ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facets-0.9.0 | test/lib/mega/test_enumerable_args.rb |