diff --git a/exercises/practice/anagram/.meta/generator.tpl b/exercises/practice/anagram/.meta/generator.tpl new file mode 100644 index 000000000..92b311b4e --- /dev/null +++ b/exercises/practice/anagram/.meta/generator.tpl @@ -0,0 +1,9 @@ +(ns anagram-test + (:require [clojure.test :refer [deftest testing is]] + anagram)) +{{#test_cases.findAnagrams}} +(deftest anagrams-for_test_{{idx}} + (testing {{string description}} + (is (= {{expected}} + (anagram/anagrams-for {{string input.subject}} {{input.candidates}}))))) +{{/test_cases.findAnagrams~}} diff --git a/exercises/practice/anagram/test/anagram_test.clj b/exercises/practice/anagram/test/anagram_test.clj index d8c1d53f2..e804bec04 100644 --- a/exercises/practice/anagram/test/anagram_test.clj +++ b/exercises/practice/anagram/test/anagram_test.clj @@ -2,92 +2,92 @@ (:require [clojure.test :refer [deftest testing is]] anagram)) -(deftest no-matches - (testing "No matches" +(deftest anagrams-for_test_1 + (testing "no matches" (is (= [] (anagram/anagrams-for "diaper" ["hello" "world" "zombies" "pants"]))))) -(deftest detects-two-anagrams - (testing "Detects two anagrams" - (is (= ["lemons", "melons"] - (anagram/anagrams-for "solemn" ["lemons", "cherry", "melons"]))))) +(deftest anagrams-for_test_2 + (testing "detects two anagrams" + (is (= ["lemons" "melons"] + (anagram/anagrams-for "solemn" ["lemons" "cherry" "melons"]))))) -(deftest does-not-detect-anagram-subsets - (testing "Does not detect anagram subsets" +(deftest anagrams-for_test_3 + (testing "does not detect anagram subsets" (is (= [] - (anagram/anagrams-for "good" ["dog", "goody"]))))) + (anagram/anagrams-for "good" ["dog" "goody"]))))) -(deftest detects-anagram - (testing "Detects anagram" +(deftest anagrams-for_test_4 + (testing "detects anagram" (is (= ["inlets"] - (anagram/anagrams-for "listen" ["enlists", "google", "inlets", "banana"]))))) + (anagram/anagrams-for "listen" ["enlists" "google" "inlets" "banana"]))))) -(deftest detects-three-anagrams - (testing "Detects three anagrams" - (is (= ["gallery", "regally", "largely"] - (anagram/anagrams-for "allergy" ["gallery", "ballerina", "regally", "clergy", "largely", "leading"]))))) +(deftest anagrams-for_test_5 + (testing "detects three anagrams" + (is (= ["gallery" "regally" "largely"] + (anagram/anagrams-for "allergy" ["gallery" "ballerina" "regally" "clergy" "largely" "leading"]))))) -(deftest detects-multiple-anagrams-with-different-case - (testing "Detects multiple anagrams with different case" - (is (= ["Eons", "ONES"] - (anagram/anagrams-for "nose" ["Eons", "ONES"]))))) +(deftest anagrams-for_test_6 + (testing "detects multiple anagrams with different case" + (is (= ["Eons" "ONES"] + (anagram/anagrams-for "nose" ["Eons" "ONES"]))))) -(deftest does-not-detect-non-anagrams-with-identical-checksum - (testing "Does not detect non-anagrams with identical checksum" +(deftest anagrams-for_test_7 + (testing "does not detect non-anagrams with identical checksum" (is (= [] (anagram/anagrams-for "mass" ["last"]))))) -(deftest detects-anagrams-case-insensitively - (testing "Detects anagrams case-insensitively" +(deftest anagrams-for_test_8 + (testing "detects anagrams case-insensitively" (is (= ["Carthorse"] - (anagram/anagrams-for "Orchestra" ["cashregister", "Carthorse", "radishes"]))))) + (anagram/anagrams-for "Orchestra" ["cashregister" "Carthorse" "radishes"]))))) -(deftest detects-anagrams-using-case-insensitive-subject - (testing "Detects anagrams using case-insensitive subject" +(deftest anagrams-for_test_9 + (testing "detects anagrams using case-insensitive subject" (is (= ["carthorse"] - (anagram/anagrams-for "Orchestra" ["cashregister", "carthorse", "radishes"]))))) + (anagram/anagrams-for "Orchestra" ["cashregister" "carthorse" "radishes"]))))) -(deftest detects-anagrams-using-case-insensitive-possible-matches - (testing "Detects anagrams using case-insensitive possible matches" +(deftest anagrams-for_test_10 + (testing "detects anagrams using case-insensitive possible matches" (is (= ["Carthorse"] - (anagram/anagrams-for "orchestra" ["cashregister", "Carthorse", "radishes"]))))) + (anagram/anagrams-for "orchestra" ["cashregister" "Carthorse" "radishes"]))))) -(deftest does-not-detect-anagram-if-original-word-is-repeated - (testing "Does not detect an anagram if the original word is repeated" +(deftest anagrams-for_test_11 + (testing "does not detect an anagram if the original word is repeated" (is (= [] (anagram/anagrams-for "go" ["goGoGO"]))))) -(deftest anagrams-must-use-all-letters-exactly-once - (testing "Anagrams must use all letters exactly once" +(deftest anagrams-for_test_12 + (testing "anagrams must use all letters exactly once" (is (= [] (anagram/anagrams-for "tapper" ["patter"]))))) -(deftest words-are-not-anagrams-of-themselves - (testing "Words are not anagrams of themselves" +(deftest anagrams-for_test_13 + (testing "words are not anagrams of themselves" (is (= [] (anagram/anagrams-for "BANANA" ["BANANA"]))))) -(deftest words-are-not-anagrams-of-themselves-even-if-letter-case-is-partially-different - (testing "Words are not anagrams of themselves even if letter case is partially different" +(deftest anagrams-for_test_14 + (testing "words are not anagrams of themselves even if letter case is partially different" (is (= [] (anagram/anagrams-for "BANANA" ["Banana"]))))) -(deftest words-are-not-anagrams-of-themselves-even-if-letter-case-is-completely-different - (testing "Words are not anagrams of themselves even if letter case is completely different" +(deftest anagrams-for_test_15 + (testing "words are not anagrams of themselves even if letter case is completely different" (is (= [] (anagram/anagrams-for "BANANA" ["banana"]))))) -(deftest words-other-than-themselves-can-be-anagrams - (testing "Words other than themselves can be anagrams" +(deftest anagrams-for_test_16 + (testing "words other than themselves can be anagrams" (is (= ["Silent"] - (anagram/anagrams-for "LISTEN" ["LISTEN", "Silent"]))))) + (anagram/anagrams-for "LISTEN" ["LISTEN" "Silent"]))))) -(deftest handles-greek-letters - (testing "Handles case of greek letters" - (is (= ["ΒΓΑ", "γβα"] - (anagram/anagrams-for "ΑΒΓ" ["ΒΓΑ", "ΒΓΔ", "γβα", "αβγ"]))))) +(deftest anagrams-for_test_17 + (testing "handles case of greek letters" + (is (= ["ΒΓΑ" "γβα"] + (anagram/anagrams-for "ΑΒΓ" ["ΒΓΑ" "ΒΓΔ" "γβα" "αβγ"]))))) -(deftest different-characters-may-have-same-bytes - (testing "Different characters may have the same bytes" +(deftest anagrams-for_test_18 + (testing "different characters may have the same bytes" (is (= [] (anagram/anagrams-for "a⬂" ["€a"])))))