diff --git a/exercises/practice/anagram/.meta/tests.toml b/exercises/practice/anagram/.meta/tests.toml index 0b78a782..30687597 100644 --- a/exercises/practice/anagram/.meta/tests.toml +++ b/exercises/practice/anagram/.meta/tests.toml @@ -45,12 +45,36 @@ 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" [85757361-4535-45fd-ac0e-3810d40debc1] description = "words are not anagrams of themselves (case-insensitive)" +include = false + +[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" +include = false + +[33d3f67e-fbb9-49d3-a90e-0beb00861da7] +description = "words other than themselves can be anagrams" +reimplements = "a0705568-628c-4b55-9798-82e4acde51ca" + diff --git a/exercises/practice/anagram/src/anagram.lfe b/exercises/practice/anagram/src/anagram.lfe index e69de29b..8b84a893 100644 --- a/exercises/practice/anagram/src/anagram.lfe +++ b/exercises/practice/anagram/src/anagram.lfe @@ -0,0 +1,4 @@ +(defmodule anagram + (export (find 2))) + + ; Please implement the find function diff --git a/exercises/practice/anagram/test/anagram-tests.lfe b/exercises/practice/anagram/test/anagram-tests.lfe index c41f06f1..6772f308 100644 --- a/exercises/practice/anagram/test/anagram-tests.lfe +++ b/exercises/practice/anagram/test/anagram-tests.lfe @@ -5,40 +5,57 @@ (include-lib "ltest/include/ltest-macros.lfe") (deftest no-matches - (is-equal () (anagram:find "diaper" '("hello" "world" "zombies" "pants")))) - -(deftest detect-simple-anagram - (is-equal '("tan") (anagram:find "ant" '("tan" "stand" "at")))) - -(deftest does-not-confuse-different-duplicates - (is-equal () (anagram:find "galea" '("eagle")))) - -(deftest eliminate-angram-subsets - (is-equal () (anagram:find "good" '("dog" "goody")))) - -(deftest detect-anagram - (is-equal - '("inlets") - (anagram:find "listen" '("enlists" "google" "inlets" "banana")))) - -(deftest multiple-anagrams - (is-equal - '("gallery" "regally" "largely") - (anagram:find - "allergy" - '("gallery" "ballerina" "regally" "clergy" "largely" "leading")))) - -(deftest case-insensitive-subject - (is-equal - '("carthorse") - (anagram:find "Orchestra" '("cashregister" "carthorse" "radishes")))) - -(deftest case-insensitive-candidate - (is-equal - '("Carthorse") - (anagram:find "Orchestra" '("cashregister" "Carthorse" "radishes")))) - -(deftest does-not-detect-a-word-as-its-own-anagram - (is-equal - '("cron") - (anagram:find "corn" '("corn" "dark" "Corn" "rank" "CORN" "cron" "park")))) + (is-equal '() + (anagram:find "diaper" '("hello" "world" "zombies" "pants")))) + +(deftest detects-two-anagrams + (is-equal '("lemons" "melons") + (anagram:find "solemn" '("lemons" "cherry" "melons")))) + +(deftest does-not-detect-anagram-subsets + (is-equal '() (anagram:find "good" '("dog" "goody")))) + +(deftest detects-anagram + (is-equal '("inlets") + (anagram:find "listen" '("enlists" "google" "inlets" "banana")))) + +(deftest detects-three-anagrams + (is-equal '("gallery" "regally" "largely") + (anagram:find "allergy" + '("gallery" "ballerina" "regally" "clergy" "largely" "leading")))) + +(deftest detects-multiple-anagrams-with-different-case + (is-equal '("Eons" "ONES") (anagram:find "nose" '("Eons" "ONES")))) + +(deftest does-not-detect-non-anagrams-with-identical-checksum + (is-equal '() (anagram:find "mass" '("last")))) + +(deftest detects-anagrams-case-insensitively + (is-equal '("Carthorse") + (anagram:find "Orchestra" '("cashregister" "Carthorse" "radishes")))) + +(deftest detects-anagrams-using-case-insensitive-subject + (is-equal '("carthorse") + (anagram:find "Orchestra" '("cashregister" "carthorse" "radishes")))) + +(deftest detects-anagrams-using-case-insensitive-possible-matches + (is-equal '("Carthorse") + (anagram:find "orchestra" '("cashregister" "Carthorse" "radishes")))) + +(deftest does-not-detect-an-anagram-if-the-original-word-is-repeated + (is-equal '() (anagram:find "go" '("goGoGO")))) + +(deftest anagrams-must-use-all-letters-exactly-once + (is-equal '() (anagram:find "tapper" '("patter")))) + +(deftest words-are-not-anagrams-of-themselves + (is-equal '() (anagram:find "BANANA" '("BANANA")))) + +(deftest words-are-not-anagrams-of-themselves-even-if-letter-case-is-partially-different + (is-equal '() (anagram:find "BANANA" '("Banana")))) + +(deftest words-are-not-anagrams-of-themselves-even-if-letter-case-is-completely-different + (is-equal '() (anagram:find "BANANA" '("banana")))) + +(deftest words-other-than-themselves-can-be-anagrams + (is-equal '("Silent") (anagram:find "LISTEN" '("LISTEN" "Silent"))))