Browse files

Ranges question

  • Loading branch information...
1 parent 1cf7b6e commit f83b42b0cdcd8ae81d2fe149f4cb29125914f10c @urbanautomaton urbanautomaton committed May 9, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 spec/golf_spec.rb
View
15 spec/golf_spec.rb
@@ -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]

0 comments on commit f83b42b

Please sign in to comment.