Skip to content

Commit 042942a

Browse files
authored
pig-latin: Sync tests (#778)
* sync tests * add generator and regenerate tests * update starter file * update contributors
1 parent 6ec0f55 commit 042942a

File tree

5 files changed

+120
-104
lines changed

5 files changed

+120
-104
lines changed

exercises/practice/pig-latin/.meta/config.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"haus",
88
"querenker",
99
"sjwarner-bp",
10-
"thomchop"
10+
"thomchop",
11+
"tasxatzial"
1112
],
1213
"files": {
1314
"solution": [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
(ns pig-latin-test
2+
(:require [clojure.test :refer [deftest testing is]]
3+
pig-latin))
4+
{{#test_cases.translate}}
5+
(deftest translate_test_{{idx}}
6+
(testing {{description}}
7+
(is (= {{expected}} (pig-latin/translate {{input.phrase}})))))
8+
{{/test_cases.translate~}}
+35-25
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,79 @@
1-
# This is an auto-generated file. Regular comments will be removed when this
2-
# file is regenerated. Regenerating will not touch any manually added keys,
3-
# so comments can be added in a "comment" key.
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
411

512
[11567f84-e8c6-4918-aedb-435f0b73db57]
6-
description = "word beginning with a"
13+
description = "ay is added to words that start with vowels -> word beginning with a"
714

815
[f623f581-bc59-4f45-9032-90c3ca9d2d90]
9-
description = "word beginning with e"
16+
description = "ay is added to words that start with vowels -> word beginning with e"
1017

1118
[7dcb08b3-23a6-4e8a-b9aa-d4e859450d58]
12-
description = "word beginning with i"
19+
description = "ay is added to words that start with vowels -> word beginning with i"
1320

1421
[0e5c3bff-266d-41c8-909f-364e4d16e09c]
15-
description = "word beginning with o"
22+
description = "ay is added to words that start with vowels -> word beginning with o"
1623

1724
[614ba363-ca3c-4e96-ab09-c7320799723c]
18-
description = "word beginning with u"
25+
description = "ay is added to words that start with vowels -> word beginning with u"
1926

2027
[bf2538c6-69eb-4fa7-a494-5a3fec911326]
21-
description = "word beginning with a vowel and followed by a qu"
28+
description = "ay is added to words that start with vowels -> word beginning with a vowel and followed by a qu"
2229

2330
[e5be8a01-2d8a-45eb-abb4-3fcc9582a303]
24-
description = "word beginning with p"
31+
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with p"
2532

2633
[d36d1e13-a7ed-464d-a282-8820cb2261ce]
27-
description = "word beginning with k"
34+
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with k"
2835

2936
[d838b56f-0a89-4c90-b326-f16ff4e1dddc]
30-
description = "word beginning with x"
37+
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with x"
3138

3239
[bce94a7a-a94e-4e2b-80f4-b2bb02e40f71]
33-
description = "word beginning with q without a following u"
40+
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with q without a following u"
41+
42+
[e59dbbe8-ccee-4619-a8e9-ce017489bfc0]
43+
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with consonant and vowel containing qu"
3444

3545
[c01e049a-e3e2-451c-bf8e-e2abb7e438b8]
36-
description = "word beginning with ch"
46+
description = "some letter clusters are treated like a single consonant -> word beginning with ch"
3747

3848
[9ba1669e-c43f-4b93-837a-cfc731fd1425]
39-
description = "word beginning with qu"
49+
description = "some letter clusters are treated like a single consonant -> word beginning with qu"
4050

4151
[92e82277-d5e4-43d7-8dd3-3a3b316c41f7]
42-
description = "word beginning with qu and a preceding consonant"
52+
description = "some letter clusters are treated like a single consonant -> word beginning with qu and a preceding consonant"
4353

4454
[79ae4248-3499-4d5b-af46-5cb05fa073ac]
45-
description = "word beginning with th"
55+
description = "some letter clusters are treated like a single consonant -> word beginning with th"
4656

4757
[e0b3ae65-f508-4de3-8999-19c2f8e243e1]
48-
description = "word beginning with thr"
58+
description = "some letter clusters are treated like a single consonant -> word beginning with thr"
4959

5060
[20bc19f9-5a35-4341-9d69-1627d6ee6b43]
51-
description = "word beginning with sch"
61+
description = "some letter clusters are treated like a single consonant -> word beginning with sch"
5262

5363
[54b796cb-613d-4509-8c82-8fbf8fc0af9e]
54-
description = "word beginning with yt"
64+
description = "some letter clusters are treated like a single vowel -> word beginning with yt"
5565

5666
[8c37c5e1-872e-4630-ba6e-d20a959b67f6]
57-
description = "word beginning with xr"
67+
description = "some letter clusters are treated like a single vowel -> word beginning with xr"
5868

5969
[a4a36d33-96f3-422c-a233-d4021460ff00]
60-
description = "y is treated like a consonant at the beginning of a word"
70+
description = "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"
6171

6272
[adc90017-1a12-4100-b595-e346105042c7]
63-
description = "y is treated like a vowel at the end of a consonant cluster"
73+
description = "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"
6474

6575
[29b4ca3d-efe5-4a95-9a54-8467f2e5e59a]
66-
description = "y as second letter in two letter word"
76+
description = "position of y in a word determines if it is a consonant or a vowel -> y as second letter in two letter word"
6777

6878
[44616581-5ce3-4a81-82d0-40c7ab13d2cf]
69-
description = "a whole phrase"
79+
description = "phrases are translated -> a whole phrase"
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
(ns pig-latin)
22

3-
(defn translate [] ;; <- arglist goes here
4-
;; your code goes here
5-
)
3+
(defn translate
4+
"Translates phrase from English to Pig Latin"
5+
[phrase]
6+
;; function body
7+
)
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,95 @@
11
(ns pig-latin-test
2-
(:require [clojure.test :refer [deftest is]]
2+
(:require [clojure.test :refer [deftest testing is]]
33
pig-latin))
44

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")))))
68

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")))))
1012

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")))))
1416

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")))))
1820

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")))))
2224

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")))))
2628

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")))))
3032

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")))))
3236

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")))))
3640

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")))))
4044

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")))))
4448

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")))))
4852

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")))))
5256

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")))))
5460

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")))))
5864

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")))))
6268

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")))))
6672

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")))))
7076

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")))))
7480

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")))))
7884

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")))))
8088

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")))))
8492

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

Comments
 (0)