Skip to content

Commit 206c24e

Browse files
authored
Sync tests (#274)
1 parent f008764 commit 206c24e

File tree

6 files changed

+152
-18
lines changed

6 files changed

+152
-18
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ description = "alternate silence"
7171

7272
[66953780-165b-4e7e-8ce3-4bcb80b6385a]
7373
description = "multiple line question"
74+
include = false
7475

7576
[5371ef75-d9ea-4103-bcfa-2da973ddec1b]
7677
description = "starting with whitespace"
@@ -83,3 +84,7 @@ description = "other whitespace"
8384

8485
[12983553-8601-46a8-92fa-fcaa3bc4a2a0]
8586
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/test-bob.bats

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bats
2-
# generated on 2022-11-02T20:59:00Z
2+
# generated on 2025-01-01T20:30:37Z
33
load bats-extra
44
load bats-jq
55

@@ -283,20 +283,6 @@ END_INPUT
283283
assert_equal "$output" "$expected"
284284
}
285285

286-
@test 'multiple line question' {
287-
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
288-
289-
run jq -r -f bob.jq << 'END_INPUT'
290-
{
291-
"heyBob": "\nDoes this cryogenic chamber make me look fat?\nNo."
292-
}
293-
END_INPUT
294-
295-
assert_success
296-
expected='Whatever.'
297-
assert_equal "$output" "$expected"
298-
}
299-
300286
@test 'starting with whitespace' {
301287
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
302288

@@ -353,3 +339,16 @@ END_INPUT
353339
assert_equal "$output" "$expected"
354340
}
355341

342+
@test 'multiple line question' {
343+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
344+
345+
run jq -r -f bob.jq << 'END_INPUT'
346+
{
347+
"heyBob": "\nDoes this cryogenic chamber make\n me look fat?"
348+
}
349+
END_INPUT
350+
351+
assert_success
352+
expected='Sure.'
353+
assert_equal "$output" "$expected"
354+
}

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/test-forth.bats

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bats
2-
# generated on 2022-11-02T20:59:07Z
2+
# generated on 2025-01-01T20:30:54Z
33
load bats-extra
44
load bats-jq
55

@@ -83,6 +83,22 @@ END_INPUT
8383
assert_equal "$output" "$expected"
8484
}
8585

86+
@test 'addition:more than two values on the stack' {
87+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
88+
89+
run jq -c -f forth.jq << 'END_INPUT'
90+
{
91+
"instructions": [
92+
"1 2 3 +"
93+
]
94+
}
95+
END_INPUT
96+
97+
assert_success
98+
expected='[1,5]'
99+
assert_equal "$output" "$expected"
100+
}
101+
86102
@test 'subtraction:can subtract two numbers' {
87103
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
88104

@@ -131,6 +147,22 @@ END_INPUT
131147
assert_equal "$output" "$expected"
132148
}
133149

150+
@test 'subtraction:more than two values on the stack' {
151+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
152+
153+
run jq -c -f forth.jq << 'END_INPUT'
154+
{
155+
"instructions": [
156+
"1 12 3 -"
157+
]
158+
}
159+
END_INPUT
160+
161+
assert_success
162+
expected='[1,9]'
163+
assert_equal "$output" "$expected"
164+
}
165+
134166
@test 'multiplication:can multiply two numbers' {
135167
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
136168

@@ -179,6 +211,22 @@ END_INPUT
179211
assert_equal "$output" "$expected"
180212
}
181213

214+
@test 'multiplication:more than two values on the stack' {
215+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
216+
217+
run jq -c -f forth.jq << 'END_INPUT'
218+
{
219+
"instructions": [
220+
"1 2 3 *"
221+
]
222+
}
223+
END_INPUT
224+
225+
assert_success
226+
expected='[1,6]'
227+
assert_equal "$output" "$expected"
228+
}
229+
182230
@test 'division:can divide two numbers' {
183231
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
184232

@@ -259,6 +307,22 @@ END_INPUT
259307
assert_equal "$output" "$expected"
260308
}
261309

310+
@test 'division:more than two values on the stack' {
311+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
312+
313+
run jq -c -f forth.jq << 'END_INPUT'
314+
{
315+
"instructions": [
316+
"1 12 3 /"
317+
]
318+
}
319+
END_INPUT
320+
321+
assert_success
322+
expected='[1,4]'
323+
assert_equal "$output" "$expected"
324+
}
325+
262326
@test 'combined arithmetic:addition and subtraction' {
263327
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
264328

@@ -291,6 +355,38 @@ END_INPUT
291355
assert_equal "$output" "$expected"
292356
}
293357

358+
@test 'combined arithmetic:multiplication and addition' {
359+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
360+
361+
run jq -c -f forth.jq << 'END_INPUT'
362+
{
363+
"instructions": [
364+
"1 3 4 * +"
365+
]
366+
}
367+
END_INPUT
368+
369+
assert_success
370+
expected='[13]'
371+
assert_equal "$output" "$expected"
372+
}
373+
374+
@test 'combined arithmetic:addition and multiplication' {
375+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
376+
377+
run jq -c -f forth.jq << 'END_INPUT'
378+
{
379+
"instructions": [
380+
"1 3 4 + *"
381+
]
382+
}
383+
END_INPUT
384+
385+
assert_success
386+
expected='[7]'
387+
assert_equal "$output" "$expected"
388+
}
389+
294390
@test 'dup:copies a value on the stack' {
295391
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
296392

@@ -783,4 +879,3 @@ END_INPUT
783879
expected='[1,1,1,1]'
784880
assert_equal "$output" "$expected"
785881
}
786-

exercises/practice/pig-latin/.meta/tests.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ description = "first letter and ay are moved to the end of words that start with
3939
[bce94a7a-a94e-4e2b-80f4-b2bb02e40f71]
4040
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with q without a following u"
4141

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"
44+
4245
[c01e049a-e3e2-451c-bf8e-e2abb7e438b8]
4346
description = "some letter clusters are treated like a single consonant -> word beginning with ch"
4447

exercises/practice/pig-latin/test-pig-latin.bats

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bats
2-
# generated on 2024-06-07T20:49:24Z
2+
# generated on 2025-01-01T20:31:02Z
33
load bats-extra
44
load bats-jq
55

@@ -143,6 +143,20 @@ END_INPUT
143143
assert_equal "$output" "$expected"
144144
}
145145

146+
@test 'first letter and ay are moved to the end of words that start with consonants:word beginning with consonant and vowel containing qu' {
147+
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
148+
149+
run jq -r -f pig-latin.jq << 'END_INPUT'
150+
{
151+
"phrase": "liquid"
152+
}
153+
END_INPUT
154+
155+
assert_success
156+
expected='iquidlay'
157+
assert_equal "$output" "$expected"
158+
}
159+
146160
@test 'some letter clusters are treated like a single consonant:word beginning with ch' {
147161
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
148162

0 commit comments

Comments
 (0)