Skip to content

Instantly share code, notes, and snippets.

@douglasnomizo
Created December 10, 2014 05:55
Show Gist options
  • Select an option

  • Save douglasnomizo/bc59be1747e971a68f0e to your computer and use it in GitHub Desktop.

Select an option

Save douglasnomizo/bc59be1747e971a68f0e to your computer and use it in GitHub Desktop.
require 'rspec'
require './tuple'
# f(“()”) -> true
# f(“(1,2,988)”) -> true
# f(“(1,23,(4,5),076)”) -> true
describe 'tuple' do
it "can be empty" do
expect(TupleValidation.is_tuple?("()")).to eq(true)
end
it "can have many digits" do
expect(TupleValidation.is_tuple?("(1,2,988)")).to eq(true)
end
it "can contain other tuples" do
expect(TupleValidation.is_tuple?("“(1,23,(4,5),076)”")).to be(true)
end
it "should have the same number of opening and closing parenthesis" do
expect(TupleValidation.is_tuple?("())")).to eq(false)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment