-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHW3Tests.rb
34 lines (28 loc) · 956 Bytes
/
HW3Tests.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require 'test/unit'
require './HW3'
class TestAnagrams < Test::Unit::TestCase
def test_integration_anagrams
input = ['cars', 'for', 'potatoes', 'racs', 'four','scar', 'creams', 'scream']
output = combine_anagrams(input)
assert output.include? ["cars", "racs", "scar"]
assert output.include? ["four"]
assert output.include? ["for"]
assert output.include? ["potatoes"]
assert output.include? ["creams", "scream"]
end
def test_finds_a_simple_anagram
input = ["cars", "scar"]
output = [["cars", "scar"]]
assert_equal combine_anagrams(input), output
end
def test_does_not_match_words_that_are_not_anagrams
input = ["cars", "word"]
output = [["word"], ["cars"]]
assert_equal combine_anagrams(input), output
end
def test_can_handle_repeats
input = ["A", "a", "B", "b", "c", "d"]
output = [["A", "a"], ["B", "b"], ["c"], ["d"]]
assert_equal combine_anagrams(input), output
end
end