Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating tests for Anagram #1036

Merged
merged 4 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions exercises/practice/anagram/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"h-3-0",
"hintjens",
"JacobMikkelsen",
"jagdish-15",
"kytrinyx",
"lpil",
"patricksjackson",
Expand Down
19 changes: 19 additions & 0 deletions exercises/practice/anagram/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -72,3 +80,14 @@ 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"
include = false
comment = "track decision to only handle ASCII strings for this exercise"

[fd3509e5-e3ba-409d-ac3d-a9ac84d13296]
description = "different characters may have the same bytes"
include = false
comment = "track decision to only handle ASCII strings for this exercise"
6 changes: 3 additions & 3 deletions exercises/practice/anagram/test_anagram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down