Sha256: c8dbad619f15abc8afef6919368d93bd390cdffc0b9a769c3d9903d044469872
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'hamster/list' describe Hamster::List do [:maximum, :max].each do |method| describe "##{method}" do describe "doesn't run out of stack space on a really big" do before do @interval = Hamster.interval(0, 10000) end it "stream" do @list = @interval end it "list" do @list = @interval.reduce(Hamster.list) { |list, i| list.cons(i) } end after do @interval.send(method) end end describe "with a block" do [ [[], nil], [["A"], "A"], [["A", "B", "C"], "A"], ].each do |values, expected| describe "on #{values.inspect}" do before do @list = Hamster.list(*values) end it "returns #{expected.inspect}" do @list.send(method) { |maximum, item| maximum <=> item }.should == expected end end end end describe "without a block" do [ [[], nil], [["A"], "A"], [["A", "B", "C"], "C"], ].each do |values, expected| describe "on #{values.inspect}" do before do @list = Hamster.list(*values) end it "returns #{expected.inspect}" do @list.send(method).should == expected end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.1.16 | spec/hamster/list/maximum_spec.rb |