Skip to content

Instantly share code, notes, and snippets.

@lakshminarayanan
Created October 5, 2012 09:29
Show Gist options
  • Save lakshminarayanan/3838918 to your computer and use it in GitHub Desktop.
Save lakshminarayanan/3838918 to your computer and use it in GitHub Desktop.
Anagram test
require 'turn/autorun'
class AnagramTest < MiniTest::Unit::TestCase
def test_simple_match
assert 'ABBA'.anagram? 'BABA'
end
def test_non_match
refute 'ABBA'.anagram? 'BAB'
end
def test_multi_word_match
assert 'Eleven Plus Two'.anagram? 'Twelve Plus One'
end
def test_multi_word_non_match
refute 'Debit Card'.anagram? 'Bad Debit'
end
def test_another_multi_word_match
assert 'Woman Hitler'.anagram? 'Mother in Law'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment