Skip to content

Commit 7ad2b65

Browse files
committed
tests: add some edge tests
1 parent 00dbb52 commit 7ad2b65

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/string/anagram.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,19 @@ mod tests {
8989
single_char_same: ("z", "Z", Ok(true)),
9090
single_char_diff: ("g", "h", Ok(false)),
9191
valid_anagram_lowercase: ("cheater", "teacher", Ok(true)),
92-
valid_anagram_with_spaces: ("Madam Curie", "Radium came", Ok(true)),
92+
valid_anagram_with_spaces: ("madam curie", "radium came", Ok(true)),
9393
valid_anagram_mixed_cases: ("Satan", "Santa", Ok(true)),
94-
valid_anagram_awesome: ("Anna Madrigal", "A man and a girl", Ok(true)),
94+
valid_anagram_with_spaces_and_mixed_cases: ("Anna Madrigal", "A man and a girl", Ok(true)),
95+
new_york_times: ("New York Times", "monkeys write", Ok(true)),
96+
church_of_scientology: ("Church of Scientology", "rich chosen goofy cult", Ok(true)),
97+
mcdonalds_restaurants: ("McDonald's restaurants", "Uncle Sam's standard rot", Err(AnagramError::NonAlphabeticCharacter)),
98+
coronavirus: ("coronavirus", "carnivorous", Ok(true)),
99+
synonym_evil: ("evil", "vile", Ok(true)),
100+
synonym_gentleman: ("a gentleman", "elegant man", Ok(true)),
101+
antigram: ("restful", "fluster", Ok(true)),
102+
sentences: ("William Shakespeare", "I am a weakish speller", Ok(true)),
103+
part_of_speech_adj_to_verb: ("silent", "listen", Ok(true)),
104+
anagrammatized: ("Anagrams", "Ars magna", Ok(true)),
95105
non_anagram: ("rat", "car", Ok(false)),
96106
invalid_anagram_with_special_char: ("hello!", "world", Err(AnagramError::NonAlphabeticCharacter)),
97107
invalid_anagram_with_numeric_chars: ("test123", "321test", Err(AnagramError::NonAlphabeticCharacter)),

0 commit comments

Comments
 (0)