Skip to content

Commit c249275

Browse files
marko213arcuru
authored andcommitted
Anagram - update tests to specification version 1.5.0 (#297)
Adds two test cases for differently cased words.
1 parent 70eaf41 commit c249275

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

exercises/anagram/anagram_test.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using namespace std;
55

6-
// Anagram exercise test case data version 1.4.0
6+
// Anagram exercise test case data version 1.5.0
77

88
TEST_CASE("no_matches")
99
{
@@ -59,6 +59,15 @@ TEST_CASE("detects_three_anagrams")
5959
REQUIRE(expected == matches);
6060
}
6161

62+
TEST_CASE("detects_multiple_anagrams_with_different_case")
63+
{
64+
auto subject = anagram::anagram("nose");
65+
auto matches = subject.matches({"Eons", "ONES"});
66+
vector<string> expected{"Eons", "ONES"};
67+
68+
REQUIRE(expected == matches);
69+
}
70+
6271
TEST_CASE("does_not_detect_non_anagrams_with_identical_checksum")
6372
{
6473
auto subject = anagram::anagram("mass");
@@ -121,4 +130,13 @@ TEST_CASE("words_are_not_anagrams_of_themselves_case_insensitive")
121130

122131
REQUIRE(expected == matches);
123132
}
133+
134+
TEST_CASE("words_other_than_themselves_can_be_anagrams")
135+
{
136+
auto subject = anagram::anagram("LISTEN");
137+
auto matches = subject.matches({"Listen", "Silent", "LISTEN"});
138+
vector<string> expected{"Silent"};
139+
140+
REQUIRE(expected == matches);
141+
}
124142
#endif

0 commit comments

Comments
 (0)