diff --git a/exercises/practice/anagram/.meta/config.json b/exercises/practice/anagram/.meta/config.json index c9f8c1cb8..80743f737 100644 --- a/exercises/practice/anagram/.meta/config.json +++ b/exercises/practice/anagram/.meta/config.json @@ -9,6 +9,7 @@ "h-3-0", "hintjens", "JacobMikkelsen", + "jagdish-15", "kytrinyx", "lpil", "patricksjackson", diff --git a/exercises/practice/anagram/.meta/tests.toml b/exercises/practice/anagram/.meta/tests.toml index 06c698e91..d2fdc4ef2 100644 --- a/exercises/practice/anagram/.meta/tests.toml +++ b/exercises/practice/anagram/.meta/tests.toml @@ -47,6 +47,11 @@ description = "detects anagrams using case-insensitive possible matches" [7cc195ad-e3c7-44ee-9fd2-d3c344806a2c] description = "does not detect an anagram if the original word is repeated" +include = false + +[630abb71-a94e-4715-8395-179ec1df9f91] +description = "does not detect an anagram if the original word is repeated" +reimplements = "7cc195ad-e3c7-44ee-9fd2-d3c344806a2c" [9878a1c9-d6ea-4235-ae51-3ea2befd6842] description = "anagrams must use all letters exactly once" @@ -58,12 +63,15 @@ comment = "Reimplemented" [68934ed0-010b-4ef9-857a-20c9012d1ebf] description = "words are not anagrams of themselves" +reimplements = "85757361-4535-45fd-ac0e-3810d40debc1" [589384f3-4c8a-4e7d-9edc-51c3e5f0c90e] description = "words are not anagrams of themselves even if letter case is partially different" +reimplements = "85757361-4535-45fd-ac0e-3810d40debc1" [ba53e423-7e02-41ee-9ae2-71f91e6d18e6] description = "words are not anagrams of themselves even if letter case is completely different" +reimplements = "85757361-4535-45fd-ac0e-3810d40debc1" [a0705568-628c-4b55-9798-82e4acde51ca] description = "words other than themselves can be anagrams" @@ -72,3 +80,10 @@ comment = "Reimplemented" [33d3f67e-fbb9-49d3-a90e-0beb00861da7] description = "words other than themselves can be anagrams" +reimplements = "a0705568-628c-4b55-9798-82e4acde51ca" + +[a6854f66-eec1-4afd-a137-62ef2870c051] +description = "handles case of greek letters" + +[fd3509e5-e3ba-409d-ac3d-a9ac84d13296] +description = "different characters may have the same bytes" diff --git a/exercises/practice/anagram/test_anagram.c b/exercises/practice/anagram/test_anagram.c index 2afcf6cb4..6964c6d9c 100644 --- a/exercises/practice/anagram/test_anagram.c +++ b/exercises/practice/anagram/test_anagram.c @@ -186,12 +186,12 @@ static void test_does_not_detect_an_anagram_if_the_original_word_is_repeated(void) { TEST_IGNORE(); - char inputs[][MAX_STR_LEN] = { "go", "Go", "GO" }; + char inputs[][MAX_STR_LEN] = { "goGoGO" }; - char subject[] = { "orchestra" }; + char subject[] = { "go" }; candidates = build_candidates(*inputs, sizeof(inputs) / MAX_STR_LEN); - enum anagram_status expected[] = { NOT_ANAGRAM, NOT_ANAGRAM, NOT_ANAGRAM }; + enum anagram_status expected[] = { NOT_ANAGRAM }; find_anagrams(subject, &candidates); assert_correct_anagrams(&candidates, expected); @@ -271,6 +271,35 @@ static void test_words_other_than_themselves_can_be_anagrams(void) assert_correct_anagrams(&candidates, expected); } +static void test_handles_case_of_greek_letters(void) +{ + TEST_IGNORE(); + char inputs[][MAX_STR_LEN] = { "ΒΓΑ", "ΒΓΔ", "γβα", "αβγ" }; + + char subject[] = { "ΑΒΓ" }; + + candidates = build_candidates(*inputs, sizeof(inputs) / MAX_STR_LEN); + enum anagram_status expected[] = { IS_ANAGRAM, NOT_ANAGRAM, IS_ANAGRAM, + NOT_ANAGRAM }; + + find_anagrams(subject, &candidates); + assert_correct_anagrams(&candidates, expected); +} + +static void test_different_characters_may_have_the_same_bytes(void) +{ + TEST_IGNORE(); + char inputs[][MAX_STR_LEN] = { "€a" }; + + char subject[] = { "a⬂" }; + + candidates = build_candidates(*inputs, sizeof(inputs) / MAX_STR_LEN); + enum anagram_status expected[] = { NOT_ANAGRAM }; + + find_anagrams(subject, &candidates); + assert_correct_anagrams(&candidates, expected); +} + int main(void) { UNITY_BEGIN(); @@ -293,6 +322,8 @@ int main(void) RUN_TEST( test_words_are_not_anagrams_of_themselves_even_if_letter_case_is_completely_different); RUN_TEST(test_words_other_than_themselves_can_be_anagrams); + RUN_TEST(test_handles_case_of_greek_letters); + RUN_TEST(test_different_characters_may_have_the_same_bytes); return UNITY_END(); }