|
1 | 1 | (ns pig-latin-test
|
2 |
| - (:require [clojure.test :refer [deftest is]] |
| 2 | + (:require [clojure.test :refer [deftest testing is]] |
3 | 3 | pig-latin))
|
4 | 4 |
|
5 |
| -;; ay is added to words that start with vowels |
| 5 | +(deftest translate_test_1 |
| 6 | + (testing "ay is added to words that start with vowels ▶ word beginning with a" |
| 7 | + (is (= "appleay" (pig-latin/translate "apple"))))) |
6 | 8 |
|
7 |
| -(deftest word-beginning-with-a |
8 |
| - (is (= "appleay" |
9 |
| - (pig-latin/translate "apple")))) |
| 9 | +(deftest translate_test_2 |
| 10 | + (testing "ay is added to words that start with vowels ▶ word beginning with e" |
| 11 | + (is (= "earay" (pig-latin/translate "ear"))))) |
10 | 12 |
|
11 |
| -(deftest word-beginning-with-e |
12 |
| - (is (= "earay" |
13 |
| - (pig-latin/translate "ear")))) |
| 13 | +(deftest translate_test_3 |
| 14 | + (testing "ay is added to words that start with vowels ▶ word beginning with i" |
| 15 | + (is (= "iglooay" (pig-latin/translate "igloo"))))) |
14 | 16 |
|
15 |
| -(deftest word-beginning-with-i |
16 |
| - (is (= "iglooay" |
17 |
| - (pig-latin/translate "igloo")))) |
| 17 | +(deftest translate_test_4 |
| 18 | + (testing "ay is added to words that start with vowels ▶ word beginning with o" |
| 19 | + (is (= "objectay" (pig-latin/translate "object"))))) |
18 | 20 |
|
19 |
| -(deftest word-beginning-with-o |
20 |
| - (is (= "objectay" |
21 |
| - (pig-latin/translate "object")))) |
| 21 | +(deftest translate_test_5 |
| 22 | + (testing "ay is added to words that start with vowels ▶ word beginning with u" |
| 23 | + (is (= "underay" (pig-latin/translate "under"))))) |
22 | 24 |
|
23 |
| -(deftest word-beginning-with-u |
24 |
| - (is (= "underay" |
25 |
| - (pig-latin/translate "under")))) |
| 25 | +(deftest translate_test_6 |
| 26 | + (testing "ay is added to words that start with vowels ▶ word beginning with a vowel and followed by a qu" |
| 27 | + (is (= "equalay" (pig-latin/translate "equal"))))) |
26 | 28 |
|
27 |
| -(deftest word-beginning-with-a-vowel-and-followed-by-a-qu |
28 |
| - (is (= "equalay" |
29 |
| - (pig-latin/translate "equal")))) |
| 29 | +(deftest translate_test_7 |
| 30 | + (testing "first letter and ay are moved to the end of words that start with consonants ▶ word beginning with p" |
| 31 | + (is (= "igpay" (pig-latin/translate "pig"))))) |
30 | 32 |
|
31 |
| -;; first letter and ay are moved to the end of words that start with consonants |
| 33 | +(deftest translate_test_8 |
| 34 | + (testing "first letter and ay are moved to the end of words that start with consonants ▶ word beginning with k" |
| 35 | + (is (= "oalakay" (pig-latin/translate "koala"))))) |
32 | 36 |
|
33 |
| -(deftest word-beginning-with-p |
34 |
| - (is (= "igpay" |
35 |
| - (pig-latin/translate "pig")))) |
| 37 | +(deftest translate_test_9 |
| 38 | + (testing "first letter and ay are moved to the end of words that start with consonants ▶ word beginning with x" |
| 39 | + (is (= "enonxay" (pig-latin/translate "xenon"))))) |
36 | 40 |
|
37 |
| -(deftest word-beginning-with-k |
38 |
| - (is (= "oalakay" |
39 |
| - (pig-latin/translate "koala")))) |
| 41 | +(deftest translate_test_10 |
| 42 | + (testing "first letter and ay are moved to the end of words that start with consonants ▶ word beginning with q without a following u" |
| 43 | + (is (= "atqay" (pig-latin/translate "qat"))))) |
40 | 44 |
|
41 |
| -(deftest word-beginning-with-y |
42 |
| - (is (= "ellowyay" |
43 |
| - (pig-latin/translate "yellow")))) |
| 45 | +(deftest translate_test_11 |
| 46 | + (testing "first letter and ay are moved to the end of words that start with consonants ▶ word beginning with consonant and vowel containing qu" |
| 47 | + (is (= "iquidlay" (pig-latin/translate "liquid"))))) |
44 | 48 |
|
45 |
| -(deftest word-beginning-with-x |
46 |
| - (is (= "enonxay" |
47 |
| - (pig-latin/translate "xenon")))) |
| 49 | +(deftest translate_test_12 |
| 50 | + (testing "some letter clusters are treated like a single consonant ▶ word beginning with ch" |
| 51 | + (is (= "airchay" (pig-latin/translate "chair"))))) |
48 | 52 |
|
49 |
| -(deftest word-beginning-with-q-without-a-following-u |
50 |
| - (is (= "atqay" |
51 |
| - (pig-latin/translate "qat")))) |
| 53 | +(deftest translate_test_13 |
| 54 | + (testing "some letter clusters are treated like a single consonant ▶ word beginning with qu" |
| 55 | + (is (= "eenquay" (pig-latin/translate "queen"))))) |
52 | 56 |
|
53 |
| -;; some letter clusters are treated like a single consonant |
| 57 | +(deftest translate_test_14 |
| 58 | + (testing "some letter clusters are treated like a single consonant ▶ word beginning with qu and a preceding consonant" |
| 59 | + (is (= "aresquay" (pig-latin/translate "square"))))) |
54 | 60 |
|
55 |
| -(deftest word-beginning-with-ch |
56 |
| - (is (= "airchay" |
57 |
| - (pig-latin/translate "chair")))) |
| 61 | +(deftest translate_test_15 |
| 62 | + (testing "some letter clusters are treated like a single consonant ▶ word beginning with th" |
| 63 | + (is (= "erapythay" (pig-latin/translate "therapy"))))) |
58 | 64 |
|
59 |
| -(deftest word-beginning-with-qu |
60 |
| - (is (= "eenquay" |
61 |
| - (pig-latin/translate "queen")))) |
| 65 | +(deftest translate_test_16 |
| 66 | + (testing "some letter clusters are treated like a single consonant ▶ word beginning with thr" |
| 67 | + (is (= "ushthray" (pig-latin/translate "thrush"))))) |
62 | 68 |
|
63 |
| -(deftest word-beginning-with-qu-and-a-preceding-consonant |
64 |
| - (is (= "aresquay" |
65 |
| - (pig-latin/translate "square")))) |
| 69 | +(deftest translate_test_17 |
| 70 | + (testing "some letter clusters are treated like a single consonant ▶ word beginning with sch" |
| 71 | + (is (= "oolschay" (pig-latin/translate "school"))))) |
66 | 72 |
|
67 |
| -(deftest word-beginning-with-th |
68 |
| - (is (= "erapythay" |
69 |
| - (pig-latin/translate "therapy")))) |
| 73 | +(deftest translate_test_18 |
| 74 | + (testing "some letter clusters are treated like a single vowel ▶ word beginning with yt" |
| 75 | + (is (= "yttriaay" (pig-latin/translate "yttria"))))) |
70 | 76 |
|
71 |
| -(deftest word-beginning-with-thr |
72 |
| - (is (= "ushthray" |
73 |
| - (pig-latin/translate "thrush")))) |
| 77 | +(deftest translate_test_19 |
| 78 | + (testing "some letter clusters are treated like a single vowel ▶ word beginning with xr" |
| 79 | + (is (= "xrayay" (pig-latin/translate "xray"))))) |
74 | 80 |
|
75 |
| -(deftest word-beginning-with-sch |
76 |
| - (is (= "oolschay" |
77 |
| - (pig-latin/translate "school")))) |
| 81 | +(deftest translate_test_20 |
| 82 | + (testing "position of y in a word determines if it is a consonant or a vowel ▶ y is treated like a consonant at the beginning of a word" |
| 83 | + (is (= "ellowyay" (pig-latin/translate "yellow"))))) |
78 | 84 |
|
79 |
| -;; some letter clusters are treated like a single vowel |
| 85 | +(deftest translate_test_21 |
| 86 | + (testing "position of y in a word determines if it is a consonant or a vowel ▶ y is treated like a vowel at the end of a consonant cluster" |
| 87 | + (is (= "ythmrhay" (pig-latin/translate "rhythm"))))) |
80 | 88 |
|
81 |
| -(deftest word-beginning-with-yt |
82 |
| - (is (= "yttriaay" |
83 |
| - (pig-latin/translate "yttria")))) |
| 89 | +(deftest translate_test_22 |
| 90 | + (testing "position of y in a word determines if it is a consonant or a vowel ▶ y as second letter in two letter word" |
| 91 | + (is (= "ymay" (pig-latin/translate "my"))))) |
84 | 92 |
|
85 |
| -(deftest word-beginning-with-xr |
86 |
| - (is (= "xrayay" |
87 |
| - (pig-latin/translate "xray")))) |
88 |
| - |
89 |
| -(deftest word-beginning-with-consonants-followed-by-y |
90 |
| - (is (= "ythmrhay" |
91 |
| - (pig-latin/translate "rhythm")))) |
92 |
| - |
93 |
| -(deftest two-letter-word-ends-with-y |
94 |
| - (is (= "ymay" |
95 |
| - (pig-latin/translate "my")))) |
96 |
| - |
97 |
| -;; phrases are translated |
98 |
| -(deftest a-whole-phrase |
99 |
| - (is (= "ickquay astfay unray" |
100 |
| - (pig-latin/translate "quick fast run")))) |
| 93 | +(deftest translate_test_23 |
| 94 | + (testing "phrases are translated ▶ a whole phrase" |
| 95 | + (is (= "ickquay astfay unray" (pig-latin/translate "quick fast run"))))) |
0 commit comments