Skip to content

Instantly share code, notes, and snippets.

@JessicaGillan
Last active November 28, 2016 15:54
Show Gist options
  • Save JessicaGillan/a0f3ba62676968aef98aaebdf37659f2 to your computer and use it in GitHub Desktop.
Save JessicaGillan/a0f3ba62676968aef98aaebdf37659f2 to your computer and use it in GitHub Desktop.
Day 1, 2015 spec
describe "floor_finder" do
it "starts Santa on the ground floor (floor 0)" do
expect(floor_finder).to eq 0
end
it "moves up one floor for '('" do
expect(floor_finder('(')).to eq 1
end
it "moves down one floor for ')'" do
expect(floor_finder(')')).to eq -1
end
it "can parse a set of directions" do
expect(floor_finder('(())')).to eq 0
expect(floor_finder('()()')).to eq 0
expect(floor_finder('(((')).to eq 3
expect(floor_finder('(()(()(')).to eq 3
expect(floor_finder('))(((((')).to eq 3
expect(floor_finder('())')).to eq -1
expect(floor_finder('))(')).to eq -1
expect(floor_finder(')))')).to eq -3
expect(floor_finder(')())())')).to eq -3
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment