Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ranges question

  • Loading branch information...
commit f83b42b0cdcd8ae81d2fe149f4cb29125914f10c 1 parent 1cf7b6e
@urbanautomaton urbanautomaton authored
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]
Please sign in to comment.
Something went wrong with that request. Please try again.