Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configlet sync --tests #302

Merged
merged 3 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions exercises/practice/anagram/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ description = "detects anagrams using case-insensitive possible matches"

[7cc195ad-e3c7-44ee-9fd2-d3c344806a2c]
description = "does not detect an anagram if the original word is repeated"
include = false

[630abb71-a94e-4715-8395-179ec1df9f91]
description = "does not detect an anagram if the original word is repeated"
reimplements = "7cc195ad-e3c7-44ee-9fd2-d3c344806a2c"

[9878a1c9-d6ea-4235-ae51-3ea2befd6842]
description = "anagrams must use all letters exactly once"
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/anagram/anagram.test
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test anagram-10 "detects anagrams using case-insensitive possible matches" -body

skip anagram-11
test anagram-11 "does not detect an anagram if the original word is repeated" -body {
findAnagrams go {go Go GO}
findAnagrams go {goGoGO}
} -returnCodes ok -result {}

skip anagram-12
Expand Down
61 changes: 61 additions & 0 deletions exercises/practice/bank-account/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# 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.

[983a1528-4ceb-45e5-8257-8ce01aceb5ed]
description = "Newly opened account has zero balance"

[e88d4ec3-c6bf-4752-8e59-5046c44e3ba7]
description = "Single deposit"

[3d9147d4-63f4-4844-8d2b-1fee2e9a2a0d]
description = "Multiple deposits"

[08f1af07-27ae-4b38-aa19-770bde558064]
description = "Withdraw once"

[6f6d242f-8c31-4ac6-8995-a90d42cad59f]
description = "Withdraw twice"

[45161c94-a094-4c77-9cec-998b70429bda]
description = "Can do multiple operations sequentially"

[f9facfaa-d824-486e-8381-48832c4bbffd]
description = "Cannot check balance of closed account"

[7a65ba52-e35c-4fd2-8159-bda2bde6e59c]
description = "Cannot deposit into closed account"

[a0a1835d-faae-4ad4-a6f3-1fcc2121380b]
description = "Cannot deposit into unopened account"

[570dfaa5-0532-4c1f-a7d3-0f65c3265608]
description = "Cannot withdraw from closed account"

[c396d233-1c49-4272-98dc-7f502dbb9470]
description = "Cannot close an account that was not opened"

[c06f534f-bdc2-4a02-a388-1063400684de]
description = "Cannot open an already opened account"

[0722d404-6116-4f92-ba3b-da7f88f1669c]
description = "Reopened account does not retain balance"

[ec42245f-9361-4341-8231-a22e8d19c52f]
description = "Cannot withdraw more than deposited"

[4f381ef8-10ef-4507-8e1d-0631ecc8ee72]
description = "Cannot withdraw negative"

[d45df9ea-1db0-47f3-b18c-d365db49d938]
description = "Cannot deposit negative"

[ba0c1e0b-0f00-416f-8097-a7dfc97871ff]
description = "Can handle concurrent transactions"
70 changes: 44 additions & 26 deletions exercises/practice/bank-account/bank-account.test
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ test bank-account-1 "newly opened account has zero balance" -body {
} -returnCodes ok -result 0

skip bank-account-2
test bank-account-2 "can deposit money" -body {
test bank-account-2 "single deposit" -body {
set account [BankAccount new]
$account open
$account deposit 100
$account balance
} -returnCodes ok -result 100

skip bank-account-3
test bank-account-3 "can deposit money sequentially" -body {
test bank-account-3 "multiple deposits" -body {
set account [BankAccount new]
$account open
$account deposit 100
Expand All @@ -32,63 +32,81 @@ test bank-account-3 "can deposit money sequentially" -body {
} -returnCodes ok -result 150

skip bank-account-4
test bank-account-4 "can withdraw money" -body {
test bank-account-4 "withdraw once" -body {
set account [BankAccount new]
$account open
$account deposit 100
$account withdraw 50
$account withdraw 75
$account balance
} -returnCodes ok -result 50
} -returnCodes ok -result 25

skip bank-account-5
test bank-account-5 "can withdraw money sequentially" -body {
test bank-account-5 "withdraw twice" -body {
set account [BankAccount new]
$account open
$account deposit 100
$account withdraw 20
$account withdraw 80
$account withdraw 20
$account balance
} -returnCodes ok -result 0

skip bank-account-6
test bank-account-6 "checking balance of closed account throws error" -body {
test bank-account-6 "can do multiple operations sequentially" -body {
set account [BankAccount new]
$account open
$account deposit 100
$account deposit 110
$account withdraw 200
$account deposit 60
$account withdraw 50
$account balance
} -returnCodes ok -result 20

skip bank-account-7
test bank-account-7 "cannot check balance of a closed account" -body {
set account [BankAccount new]
$account open
$account close
$account balance
} -returnCodes error -match glob -result "*account is not open*"

skip bank-account-7
test bank-account-7 "deposit into closed account" -body {
skip bank-account-8
test bank-account-8 "cannot deposit into closed account" -body {
set account [BankAccount new]
$account open
$account close
$account deposit 50
} -returnCodes error -match glob -result "*account is not open*"

skip bank-account-8
test bank-account-8 "withdraw from closed account" -body {
skip bank-account-9
test bank-account-9 "cannot deposit into unopened account" -body {
set account [BankAccount new]
$account deposit 50
} -returnCodes error -match glob -result "*account is not open*"

skip bank-account-10
test bank-account-10 "cannot withdraw from closed account" -body {
set account [BankAccount new]
$account open
$account close
$account withdraw 50
} -returnCodes error -match glob -result "*account is not open*"

skip bank-account-9
test bank-account-9 "close already closed account" -body {
skip bank-account-11
test bank-account-11 "cannot close an account that was not opened" -body {
set account [BankAccount new]
$account close
} -returnCodes error -match glob -result "*account is not open*"

skip bank-account-10
test bank-account-10 "open already opened account" -body {
skip bank-account-12
test bank-account-12 "cannot open an already opened account" -body {
set account [BankAccount new]
$account open
$account open
} -returnCodes error -match glob -result "*account is already open*"

skip bank-account-11
test bank-account-11 "reopened account does not retain balance" -body {
skip bank-account-13
test bank-account-13 "reopened account does not retain balance" -body {
set account [BankAccount new]
$account open
$account deposit 50
Expand All @@ -97,31 +115,31 @@ test bank-account-11 "reopened account does not retain balance" -body {
$account balance
} -returnCodes ok -result 0

skip bank-account-12
test bank-account-12 "cannot withdraw more than deposited" -body {
skip bank-account-14
test bank-account-14 "cannot withdraw more than deposited" -body {
set account [BankAccount new]
$account open
$account deposit 25
$account withdraw 50
} -returnCodes error -match glob -result "*insufficient funds*"

skip bank-account-13
test bank-account-13 "cannot withdraw negative" -body {
skip bank-account-15
test bank-account-15 "cannot withdraw negative" -body {
set account [BankAccount new]
$account open
$account deposit 100
$account withdraw -50
} -returnCodes error -match glob -result "*invalid amount*"

skip bank-account-14
test bank-account-14 "cannot deposit negative" -body {
skip bank-account-16
test bank-account-16 "cannot deposit negative" -body {
set account [BankAccount new]
$account open
$account deposit -50
} -returnCodes error -match glob -result "*invalid amount*"

skip bank-account-15
test bank-account-15 "adjust balance concurrently" -body {
skip bank-account-17
test bank-account-17 "can handle concurrent transactions" -body {
# In this style of using Tcl threads, we don't need
# to make any thread-specific adjustments to the
# BankAccount class: passing messages between threads
Expand Down
Loading