Skip to content

Commit 9413a2a

Browse files
authored
Sync tests (#718)
1 parent b7cd284 commit 9413a2a

File tree

6 files changed

+134
-32
lines changed

6 files changed

+134
-32
lines changed

exercises/practice/bob/.meta/tests.toml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
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
[e162fead-606f-437a-a166-d051915cea8e]
613
description = "stating something"
@@ -64,6 +71,7 @@ description = "alternate silence"
6471

6572
[66953780-165b-4e7e-8ce3-4bcb80b6385a]
6673
description = "multiple line question"
74+
include = false
6775

6876
[5371ef75-d9ea-4103-bcfa-2da973ddec1b]
6977
description = "starting with whitespace"
@@ -76,3 +84,7 @@ description = "other whitespace"
7684

7785
[12983553-8601-46a8-92fa-fcaa3bc4a2a0]
7886
description = "non-question ending with whitespace"
87+
88+
[2c7278ac-f955-4eb4-bf8f-e33eb4116a15]
89+
description = "multiple line question"
90+
reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a"

exercises/practice/bob/bob.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ load bats-extra
145145

146146
@test "multiple line question" {
147147
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
148-
run bash bob.sh $'\nDoes this cryogenic chamber make me look fat?\nNo'
148+
run bash bob.sh $'\nDoes this cryogenic chamber make\n me look fat?'
149149
assert_success
150-
assert_output "Whatever."
150+
assert_output "Sure."
151151
}
152152

153153
@test "starting with whitespace" {

exercises/practice/forth/.meta/tests.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ description = "addition -> errors if there is nothing on the stack"
2424
[06efb9a4-817a-435e-b509-06166993c1b8]
2525
description = "addition -> errors if there is only one value on the stack"
2626

27+
[1e07a098-c5fa-4c66-97b2-3c81205dbc2f]
28+
description = "addition -> more than two values on the stack"
29+
2730
[09687c99-7bbc-44af-8526-e402f997ccbf]
2831
description = "subtraction -> can subtract two numbers"
2932

@@ -33,6 +36,9 @@ description = "subtraction -> errors if there is nothing on the stack"
3336
[b3cee1b2-9159-418a-b00d-a1bb3765c23b]
3437
description = "subtraction -> errors if there is only one value on the stack"
3538

39+
[2c8cc5ed-da97-4cb1-8b98-fa7b526644f4]
40+
description = "subtraction -> more than two values on the stack"
41+
3642
[5df0ceb5-922e-401f-974d-8287427dbf21]
3743
description = "multiplication -> can multiply two numbers"
3844

@@ -42,6 +48,9 @@ description = "multiplication -> errors if there is nothing on the stack"
4248
[8ba4b432-9f94-41e0-8fae-3b3712bd51b3]
4349
description = "multiplication -> errors if there is only one value on the stack"
4450

51+
[5cd085b5-deb1-43cc-9c17-6b1c38bc9970]
52+
description = "multiplication -> more than two values on the stack"
53+
4554
[e74c2204-b057-4cff-9aa9-31c7c97a93f5]
4655
description = "division -> can divide two numbers"
4756

@@ -57,12 +66,21 @@ description = "division -> errors if there is nothing on the stack"
5766
[d5547f43-c2ff-4d5c-9cb0-2a4f6684c20d]
5867
description = "division -> errors if there is only one value on the stack"
5968

69+
[f224f3e0-b6b6-4864-81de-9769ecefa03f]
70+
description = "division -> more than two values on the stack"
71+
6072
[ee28d729-6692-4a30-b9be-0d830c52a68c]
6173
description = "combined arithmetic -> addition and subtraction"
6274

6375
[40b197da-fa4b-4aca-a50b-f000d19422c1]
6476
description = "combined arithmetic -> multiplication and division"
6577

78+
[f749b540-53aa-458e-87ec-a70797eddbcb]
79+
description = "combined arithmetic -> multiplication and addition"
80+
81+
[c8e5a4c2-f9bf-4805-9a35-3c3314e4989a]
82+
description = "combined arithmetic -> addition and multiplication"
83+
6684
[c5758235-6eef-4bf6-ab62-c878e50b9957]
6785
description = "dup -> copies a value on the stack"
6886

exercises/practice/forth/forth.bats

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ END
5050
assert_output --partial "only one value on the stack"
5151
}
5252

53+
@test addition_more_than_two_values_on_the_stack {
54+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
55+
run bash forth.sh <<END
56+
1 2 3 +
57+
END
58+
assert_success
59+
assert_output "1 5"
60+
}
61+
5362
# subtraction
5463
@test subtraction_ok {
5564
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
@@ -78,6 +87,15 @@ END
7887
assert_output --partial "only one value on the stack"
7988
}
8089

90+
@test subtraction_more_than_two_values_on_the_stack {
91+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
92+
run bash forth.sh <<END
93+
1 12 3 -
94+
END
95+
assert_success
96+
assert_output "1 9"
97+
}
98+
8199
# multiplication
82100
@test multiplication_ok {
83101
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
@@ -106,6 +124,15 @@ END
106124
assert_output --partial "only one value on the stack"
107125
}
108126

127+
@test multiplication_more_than_two_values_on_the_stack {
128+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
129+
run bash forth.sh <<END
130+
1 2 3 *
131+
END
132+
assert_success
133+
assert_output "1 6"
134+
}
135+
109136
# division
110137
@test division_ok {
111138
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
@@ -152,16 +179,26 @@ END
152179
assert_output --partial "divide by zero"
153180
}
154181

182+
@test division_more_than_two_values_on_the_stack {
183+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
184+
run bash forth.sh <<END
185+
1 12 3 /
186+
END
187+
assert_success
188+
assert_output "1 4"
189+
}
190+
155191
# combined arithmetic
156-
@test add_and_subtract {
192+
@test combined_add_and_subtract {
157193
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
158194
run bash forth.sh <<END
159195
1 2 + 4 -
160196
END
161197
assert_success
162198
assert_output "-1"
163199
}
164-
@test multiply_and_divide {
200+
201+
@test combined_multiply_and_divide {
165202
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
166203
run bash forth.sh <<END
167204
2 4 * 3 /
@@ -170,6 +207,24 @@ END
170207
assert_output "2"
171208
}
172209

210+
@test combined_multiplication_and_addition {
211+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
212+
run bash forth.sh <<END
213+
1 3 4 * +
214+
END
215+
assert_success
216+
assert_output "13"
217+
}
218+
219+
@test combined_addition_and_multiplication {
220+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
221+
run bash forth.sh <<END
222+
1 3 4 + *
223+
END
224+
assert_success
225+
assert_output "7"
226+
}
227+
173228
# dup
174229
@test dup_1 {
175230
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
Lines changed: 35 additions & 25 deletions
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"

exercises/practice/pig-latin/pig_latin.bats

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ load bats-extra
7777
assert_output "atqay"
7878
}
7979

80+
@test word_beginning_with_consonant_and_vowel_containing_qu {
81+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
82+
run bash pig_latin.sh liquid
83+
assert_success
84+
assert_output "iquidlay"
85+
}
86+
8087
# some letter clusters are treated like a single consonant
8188

8289
@test word_beginning_with_ch {

0 commit comments

Comments
 (0)