blob: 1fa4a94e1d1edd9aeeb9490eb329e783e3a30cf3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
;;; anagram-test.el --- Tests for Anagram (exercism)
;;; Commentary:
;;; Code:
(load-file "anagram.el")
(ert-deftest no-matches ()
(should (equal '() (anagrams-for
"diaper"
'("hello" "world" "zombies" "pants")))))
(ert-deftest detect-simple-anagram ()
(should (equal '("tan") (anagrams-for
"ant"
'("tan" "stand" "at")))))
(ert-deftest does-not-confuse-different-duplicates ()
(should (equal '() (anagrams-for
"galea"
'("eagle")))))
(ert-deftest eliminate-anagram-subsets ()
(should (equal '() (anagrams-for
"good"
'("dog" "goody")))))
(ert-deftest detect-anagram ()
(should (equal '("inlets") (anagrams-for
"listen"
'("enlists" "google" "inlets" "banana")))))
(ert-deftest multiple-anagrams ()
(should (equal '("gallery" "regally" "largely")
(anagrams-for
"allergy"
'("gallery" "ballerina" "regally" "clergy" "largely" "leading")))))
(ert-deftest case-insensitive-anagrams ()
(should (equal '("Carthorse")
(anagrams-for
"Orchestra"
'("cashregister" "Carthorse" "radishes")))))
(ert-deftest word-is-not-own-anagram ()
(should (equal '()
(anagrams-for
"banana"
'("banana")))))
(provide 'anagram-test)
;;; anagram-test.el ends here
|