|
15 | 15 | ;; Define and enter a new FiveAM test-suite
|
16 | 16 | (def-suite* atbash-cipher-suite)
|
17 | 17 |
|
18 |
| -(test encode-no (is (equal "ml" (atbash-cipher:encode "no")))) |
| 18 | +(def-suite* encode :in atbash-cipher-suite) |
19 | 19 |
|
20 | 20 | (test encode-yes (is (equal "bvh" (atbash-cipher:encode "yes"))))
|
21 | 21 |
|
| 22 | +(test encode-no (is (equal "ml" (atbash-cipher:encode "no")))) |
| 23 | + |
22 | 24 | (test encode-omg (is (equal "lnt" (atbash-cipher:encode "OMG"))))
|
23 | 25 |
|
24 |
| -(test encode-o-m-g (is (equal "lnt" (atbash-cipher:encode "O M G")))) |
| 26 | +(test encode-spaces (is (equal "lnt" (atbash-cipher:encode "O M G")))) |
25 | 27 |
|
26 |
| -(test encode-long-word |
27 |
| - (is (equal "nrmwy oldrm tob" (atbash-cipher:encode "mindblowingly")))) |
| 28 | +(test encode-mindblowingly |
| 29 | + (is (equal "nrmwy oldrm tob" (atbash-cipher:encode "mindblowingly")))) |
28 | 30 |
|
29 | 31 | (test encode-numbers
|
30 | 32 | (is
|
31 | 33 | (equal "gvhgr mt123 gvhgr mt"
|
32 | 34 | (atbash-cipher:encode "Testing, 1 2 3, testing."))))
|
33 | 35 |
|
34 |
| -(test encode-sentence |
35 |
| - (is (equal "gifgs rhurx grlm" (atbash-cipher:encode "Truth is fiction.")))) |
| 36 | +(test encode-deep-thought |
| 37 | + (is (equal "gifgs rhurx grlm" (atbash-cipher:encode "Truth is fiction.")))) |
36 | 38 |
|
37 |
| -(test encode-all-the-things |
| 39 | +(test encode-all-the-letters |
38 | 40 | (let ((plaintext "The quick brown fox jumps over the lazy dog.")
|
39 | 41 | (cipher "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt"))
|
40 | 42 | (is (equal cipher (atbash-cipher:encode plaintext)))))
|
41 | 43 |
|
| 44 | +(def-suite* decode :in atbash-cipher-suite) |
| 45 | + |
| 46 | +(test decode-exercism |
| 47 | + (is (equal "exercism" (atbash-cipher:decode "vcvix rhn")))) |
| 48 | + |
| 49 | +(test decode-a-sentence |
| 50 | + (is (equal "anobstacleisoftenasteppingstone" |
| 51 | + (atbash-cipher:decode "zmlyh gzxov rhlug vmzhg vkkrm thglm v")))) |
| 52 | + |
| 53 | +(test decode-numbers |
| 54 | + (is (equal "testing123testing" (atbash-cipher:decode "gvhgr mt123 gvhgr mt")))) |
| 55 | + |
| 56 | +(test decode-all-the-letters |
| 57 | + (is (equal "thequickbrownfoxjumpsoverthelazydog" |
| 58 | + (atbash-cipher:decode "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt")))) |
| 59 | + |
| 60 | +(test decode-with-too-many-spaces |
| 61 | + (is (equal "exercism" |
| 62 | + (atbash-cipher:decode "vc vix r hn")))) |
| 63 | + |
| 64 | +(test decode-with-no-spaces |
| 65 | + (is (equal "anobstacleisoftenasteppingstone" |
| 66 | + (atbash-cipher:decode "zmlyhgzxovrhlugvmzhgvkkrmthglmv")))) |
| 67 | + |
42 | 68 | (defun run-tests (&optional (test-or-suite 'atbash-cipher-suite))
|
43 | 69 | "Provides human readable results of test run. Default to entire suite."
|
44 | 70 | (run! test-or-suite))
|
0 commit comments