Skip to content

Commit

Permalink
Ranges question
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Coffey committed May 9, 2011
1 parent 1cf7b6e commit f83b42b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spec/golf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@
end


describe ".hole7" do
it "should collapse consecutive numbers to a range" do
Golf.hole7([1,2,3]).should eql ["1-3"]
end

it "should keep separate ranges distinct" do
Golf.hole7([1,2,3,5,6,7,100,101]).should eql ["1-3","5-7","100-101"]
end

it "should show isolated digits on their own" do
Golf.hole7([1,2,3,5,10,11,12]).should eql ["1-3","5","10-12"]
end
end


describe ".hole8" do
it "should give the first N numbers of the fibonacci sequence" do
Golf.hole8(5).should eql [1,1,2,3,5]
Expand Down

0 comments on commit f83b42b

Please sign in to comment.