Skip to content

Commit

Permalink
Sync tests (#718)
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacG authored Jan 2, 2025
1 parent b7cd284 commit 9413a2a
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 32 deletions.
18 changes: 15 additions & 3 deletions exercises/practice/bob/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# This is an auto-generated file. Regular comments will be removed when this
# file is regenerated. Regenerating will not touch any manually added keys,
# so comments can be added in a "comment" key.
# This is an auto-generated file.
#
# Regenerating this file via `configlet sync` will:
# - Recreate every `description` key/value pair
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
# - Preserve any other key/value pair
#
# As user-added comments (using the # character) will be removed when this file
# is regenerated, comments can be added via a `comment` key.

[e162fead-606f-437a-a166-d051915cea8e]
description = "stating something"
Expand Down Expand Up @@ -64,6 +71,7 @@ description = "alternate silence"

[66953780-165b-4e7e-8ce3-4bcb80b6385a]
description = "multiple line question"
include = false

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

[12983553-8601-46a8-92fa-fcaa3bc4a2a0]
description = "non-question ending with whitespace"

[2c7278ac-f955-4eb4-bf8f-e33eb4116a15]
description = "multiple line question"
reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a"
4 changes: 2 additions & 2 deletions exercises/practice/bob/bob.bats
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ load bats-extra

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

@test "starting with whitespace" {
Expand Down
18 changes: 18 additions & 0 deletions exercises/practice/forth/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ description = "addition -> errors if there is nothing on the stack"
[06efb9a4-817a-435e-b509-06166993c1b8]
description = "addition -> errors if there is only one value on the stack"

[1e07a098-c5fa-4c66-97b2-3c81205dbc2f]
description = "addition -> more than two values on the stack"

[09687c99-7bbc-44af-8526-e402f997ccbf]
description = "subtraction -> can subtract two numbers"

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

[2c8cc5ed-da97-4cb1-8b98-fa7b526644f4]
description = "subtraction -> more than two values on the stack"

[5df0ceb5-922e-401f-974d-8287427dbf21]
description = "multiplication -> can multiply two numbers"

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

[5cd085b5-deb1-43cc-9c17-6b1c38bc9970]
description = "multiplication -> more than two values on the stack"

[e74c2204-b057-4cff-9aa9-31c7c97a93f5]
description = "division -> can divide two numbers"

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

[f224f3e0-b6b6-4864-81de-9769ecefa03f]
description = "division -> more than two values on the stack"

[ee28d729-6692-4a30-b9be-0d830c52a68c]
description = "combined arithmetic -> addition and subtraction"

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

[f749b540-53aa-458e-87ec-a70797eddbcb]
description = "combined arithmetic -> multiplication and addition"

[c8e5a4c2-f9bf-4805-9a35-3c3314e4989a]
description = "combined arithmetic -> addition and multiplication"

[c5758235-6eef-4bf6-ab62-c878e50b9957]
description = "dup -> copies a value on the stack"

Expand Down
59 changes: 57 additions & 2 deletions exercises/practice/forth/forth.bats
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ END
assert_output --partial "only one value on the stack"
}

@test addition_more_than_two_values_on_the_stack {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash forth.sh <<END
1 2 3 +
END
assert_success
assert_output "1 5"
}

# subtraction
@test subtraction_ok {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
Expand Down Expand Up @@ -78,6 +87,15 @@ END
assert_output --partial "only one value on the stack"
}

@test subtraction_more_than_two_values_on_the_stack {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash forth.sh <<END
1 12 3 -
END
assert_success
assert_output "1 9"
}

# multiplication
@test multiplication_ok {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
Expand Down Expand Up @@ -106,6 +124,15 @@ END
assert_output --partial "only one value on the stack"
}

@test multiplication_more_than_two_values_on_the_stack {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash forth.sh <<END
1 2 3 *
END
assert_success
assert_output "1 6"
}

# division
@test division_ok {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
Expand Down Expand Up @@ -152,16 +179,26 @@ END
assert_output --partial "divide by zero"
}

@test division_more_than_two_values_on_the_stack {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash forth.sh <<END
1 12 3 /
END
assert_success
assert_output "1 4"
}

# combined arithmetic
@test add_and_subtract {
@test combined_add_and_subtract {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash forth.sh <<END
1 2 + 4 -
END
assert_success
assert_output "-1"
}
@test multiply_and_divide {

@test combined_multiply_and_divide {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash forth.sh <<END
2 4 * 3 /
Expand All @@ -170,6 +207,24 @@ END
assert_output "2"
}

@test combined_multiplication_and_addition {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash forth.sh <<END
1 3 4 * +
END
assert_success
assert_output "13"
}

@test combined_addition_and_multiplication {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash forth.sh <<END
1 3 4 + *
END
assert_success
assert_output "7"
}

# dup
@test dup_1 {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
Expand Down
60 changes: 35 additions & 25 deletions exercises/practice/pig-latin/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -1,69 +1,79 @@
# This is an auto-generated file. Regular comments will be removed when this
# file is regenerated. Regenerating will not touch any manually added keys,
# so comments can be added in a "comment" key.
# This is an auto-generated file.
#
# Regenerating this file via `configlet sync` will:
# - Recreate every `description` key/value pair
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
# - Preserve any other key/value pair
#
# As user-added comments (using the # character) will be removed when this file
# is regenerated, comments can be added via a `comment` key.

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

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

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

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

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

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

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

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

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

[bce94a7a-a94e-4e2b-80f4-b2bb02e40f71]
description = "word beginning with q without a following u"
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with q without a following u"

[e59dbbe8-ccee-4619-a8e9-ce017489bfc0]
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with consonant and vowel containing qu"

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

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

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

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

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

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

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

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

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

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

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

[44616581-5ce3-4a81-82d0-40c7ab13d2cf]
description = "a whole phrase"
description = "phrases are translated -> a whole phrase"
7 changes: 7 additions & 0 deletions exercises/practice/pig-latin/pig_latin.bats
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ load bats-extra
assert_output "atqay"
}

@test word_beginning_with_consonant_and_vowel_containing_qu {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash pig_latin.sh liquid
assert_success
assert_output "iquidlay"
}

# some letter clusters are treated like a single consonant

@test word_beginning_with_ch {
Expand Down

0 comments on commit 9413a2a

Please sign in to comment.