Class | ExtensionsTest |
In: |
test/extensionsTest.rb
|
Parent: | Test::Unit::TestCase |
# File test/extensionsTest.rb, line 26 def testEachAfter res = Array.new @array.eachAfter(2) { |x| res << x } assert_equal([ 3, 4 ], res) res = Array.new @array.eachAfter(4) { |x| res << x } assert_equal(true, res.empty?) end
# File test/extensionsTest.rb, line 20 def testFoldLeft assert_equal(6, [ 1, 2, 3 ].foldLeft(Proc.new { |a,b| a + b })) assert_equal(false, [ false, false, false ].foldLeft(Proc.new { |a,b| a & b })) assert_equal(true, [ false, true, false ].foldLeft(Proc.new { |a,b| a | b })) end