Sha256: d6d98e0b000a0e8b347c8831dab9d9be3854384a2c3b180a01782b926e37e584
Contents?: true
Size: 630 Bytes
Versions: 4
Compression:
Stored size: 630 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Hamster::List do describe "#reduce" do it "initially returns memo" do Hamster::List.new.reduce(0).should == 0 end describe "with values" do before do @list = Hamster::List.new.cons(1).cons(2).cons(3).cons(4) end it "works with an initial value" do @list.reduce(0) { |memo, i| memo + i }.should == 10 end it "defaults to the first item in the list" do pending do @list.reduce { |memo, i| memo + i }.should == 10 end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems