exercism

Exercism solutions.
git clone git://code.dwrz.net/exercism
Log | Files | Refs

anagram-test.el (1570B)


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