From 4555bc9737b6f200d6aa2253f79c61f74a8b3dbf Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Wed, 1 Feb 2023 19:05:16 +0100 Subject: [PATCH 01/25] Add tests for bank account --- exercises/bank-account/canonical-data.json | 278 +++++++++++++++++++++ 1 file changed, 278 insertions(+) create mode 100644 exercises/bank-account/canonical-data.json diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json new file mode 100644 index 0000000000..ec28aee656 --- /dev/null +++ b/exercises/bank-account/canonical-data.json @@ -0,0 +1,278 @@ +{ + "exercise": "bank-account", + "comments": [ + "For this exercise it is possible to implement concurrency tests", + "but for language tracks that do not support concurrency, the tests", + "are written to be run in a single thread.", + "But for language tracks that do support concurrency, so is it possible", + "to write tests that run concurrently." + ], + "cases": [ + { + "uuid": "983a1528-4ceb-45e5-8257-8ce01aceb5ed", + "description": "Using pop raises an error if the list is empty", + "property": "bankAccont", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "amount", + "expected": 0 + } + ] + }, + "expected": {} + }, + { + "uuid": "e88d4ec3-c6bf-4752-8e59-5046c44e3ba7", + "description": "Can return with pop and then raise an error if empty", + "property": "bankAccont", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "deposit", + "value": 100 + }, + { + "operation": "amount", + "expected": 100 + } + ] + }, + "expected": {} + }, + { + "uuid": "08f1af07-27ae-4b38-aa19-770bde558064", + "description": "Using shift raises an error if the list is empty", + "property": "bankAccont", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "deposit", + "value": 100 + }, + { + "operation": "withdraw", + "value": 50 + }, + { + "operation": "amount", + "expected": 50 + } + ] + }, + "expected": {} + }, + { + "uuid": "6f6d242f-8c31-4ac6-8995-a90d42cad59f", + "description": "Can return with shift and then raise an error if empty", + "property": "bankAccont", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "deposit", + "value": 100 + }, + { + "operation": "withdraw", + "value": 80 + }, + { + "operation": "withdraw", + "value": 20 + }, + { + "operation": "amount", + "expected": 0 + } + ] + }, + "expected": {} + }, + { + "uuid": "f9facfaa-d824-486e-8381-48832c4bbffd", + "description": "Can return with shift and then raise an error if empty", + "property": "bankAccont", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "close" + }, + { + "operation": "amount" + } + ] + }, + "expected": { "error": "account not open" } + }, + { + "uuid": "7a65ba52-e35c-4fd2-8159-bda2bde6e59c", + "description": "Can return with shift and then raise an error if empty", + "property": "bankAccont", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "close" + }, + { + "operation": "deposit", + "value": 50 + } + ] + }, + "expected": { "error": "account not open" } + }, + { + "uuid": "570dfaa5-0532-4c1f-a7d3-0f65c3265608", + "description": "Can return with shift and then raise an error if empty", + "property": "bankAccont", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "close" + }, + { + "operation": "withdraw", + "value": 50 + } + ] + }, + "expected": { "error": "account not open" } + }, + { + "uuid": "c396d233-1c49-4272-98dc-7f502dbb9470", + "description": "Can return with shift and then raise an error if empty", + "property": "bankAccont", + "input": { + "operations": [ + { + "operation": "close" + } + ] + }, + "expected": { "error": "account not open" } + }, + { + "uuid": "c06f534f-bdc2-4a02-a388-1063400684de", + "description": "Can return with shift and then raise an error if empty", + "property": "bankAccont", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "open" + } + ] + }, + "expected": { "error": "account already open" } + }, + { + "uuid": "0722d404-6116-4f92-ba3b-da7f88f1669c", + "description": "Can return with shift and then raise an error if empty", + "property": "bankAccont", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "deposit", + "value": 50 + }, + { + "operation": "close" + }, + { + "operation": "open" + }, + { + "operation": "amount", + "expected": 0 + } + ] + }, + "expected": {} + }, + { + "uuid": "ec42245f-9361-4341-8231-a22e8d19c52f", + "description": "Can return with shift and then raise an error if empty", + "property": "bankAccont", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "deposit", + "value": 25 + }, + { + "operation": "withdraw", + "value": 50 + } + ] + }, + "expected": { "error": "amount must be less than balance" } + }, + { + "uuid": "4f381ef8-10ef-4507-8e1d-0631ecc8ee72", + "description": "Can return with shift and then raise an error if empty", + "property": "bankAccont", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "deposit", + "value": 100 + }, + { + "operation": "withdraw", + "value": -50 + } + ] + }, + "expected": { "error": "amount must be greater than 0" } + }, + { + "uuid": "d45df9ea-1db0-47f3-b18c-d365db49d938", + "description": "Can return with shift and then raise an error if empty", + "property": "bankAccont", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "deposit", + "value": -50 + } + ] + }, + "expected": { "error": "amount must be greater than 0" } + } + ] +} From ed8bc2017e0823405cdc342a05d4d3c2755d3e80 Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Wed, 1 Feb 2023 19:30:23 +0100 Subject: [PATCH 02/25] Update comments, fixed spelling mistakes --- exercises/bank-account/canonical-data.json | 79 ++++++++++++++-------- 1 file changed, 52 insertions(+), 27 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index ec28aee656..9ed453bc7a 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -4,14 +4,14 @@ "For this exercise it is possible to implement concurrency tests", "but for language tracks that do not support concurrency, the tests", "are written to be run in a single thread.", - "But for language tracks that do support concurrency, so is it possible", + "But for language tracks that do support concurrency, it is possible", "to write tests that run concurrently." ], "cases": [ { "uuid": "983a1528-4ceb-45e5-8257-8ce01aceb5ed", - "description": "Using pop raises an error if the list is empty", - "property": "bankAccont", + "description": "Newly opened account has zero balance", + "property": "bankAccount", "input": { "operations": [ { @@ -27,8 +27,8 @@ }, { "uuid": "e88d4ec3-c6bf-4752-8e59-5046c44e3ba7", - "description": "Can return with pop and then raise an error if empty", - "property": "bankAccont", + "description": "Can deposit money", + "property": "bankAccount", "input": { "operations": [ { @@ -46,10 +46,35 @@ }, "expected": {} }, + { + "uuid": "3d9147d4-63f4-4844-8d2b-1fee2e9a2a0d", + "description": "Can deposit money sequentially", + "property": "bankAccount", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "deposit", + "value": 100 + }, + { + "operation": "deposit", + "value": 50 + }, + { + "operation": "amount", + "expected": 150 + } + ] + }, + "expected": {} + }, { "uuid": "08f1af07-27ae-4b38-aa19-770bde558064", - "description": "Using shift raises an error if the list is empty", - "property": "bankAccont", + "description": "Can withdraw money", + "property": "bankAccount", "input": { "operations": [ { @@ -73,8 +98,8 @@ }, { "uuid": "6f6d242f-8c31-4ac6-8995-a90d42cad59f", - "description": "Can return with shift and then raise an error if empty", - "property": "bankAccont", + "description": "Can withdraw money sequentially", + "property": "bankAccount", "input": { "operations": [ { @@ -102,8 +127,8 @@ }, { "uuid": "f9facfaa-d824-486e-8381-48832c4bbffd", - "description": "Can return with shift and then raise an error if empty", - "property": "bankAccont", + "description": "Checking balance of closed account throws error", + "property": "bankAccount", "input": { "operations": [ { @@ -121,8 +146,8 @@ }, { "uuid": "7a65ba52-e35c-4fd2-8159-bda2bde6e59c", - "description": "Can return with shift and then raise an error if empty", - "property": "bankAccont", + "description": "Deposit into closed account", + "property": "bankAccount", "input": { "operations": [ { @@ -141,8 +166,8 @@ }, { "uuid": "570dfaa5-0532-4c1f-a7d3-0f65c3265608", - "description": "Can return with shift and then raise an error if empty", - "property": "bankAccont", + "description": "Withdraw from closed account", + "property": "bankAccount", "input": { "operations": [ { @@ -161,8 +186,8 @@ }, { "uuid": "c396d233-1c49-4272-98dc-7f502dbb9470", - "description": "Can return with shift and then raise an error if empty", - "property": "bankAccont", + "description": "Close already closed account", + "property": "bankAccount", "input": { "operations": [ { @@ -174,8 +199,8 @@ }, { "uuid": "c06f534f-bdc2-4a02-a388-1063400684de", - "description": "Can return with shift and then raise an error if empty", - "property": "bankAccont", + "description": "Open already opened account", + "property": "bankAccount", "input": { "operations": [ { @@ -190,8 +215,8 @@ }, { "uuid": "0722d404-6116-4f92-ba3b-da7f88f1669c", - "description": "Can return with shift and then raise an error if empty", - "property": "bankAccont", + "description": "Reopened account does not retain balance", + "property": "bankAccount", "input": { "operations": [ { @@ -217,8 +242,8 @@ }, { "uuid": "ec42245f-9361-4341-8231-a22e8d19c52f", - "description": "Can return with shift and then raise an error if empty", - "property": "bankAccont", + "description": "Cannot withdraw more than deposited", + "property": "bankAccount", "input": { "operations": [ { @@ -238,8 +263,8 @@ }, { "uuid": "4f381ef8-10ef-4507-8e1d-0631ecc8ee72", - "description": "Can return with shift and then raise an error if empty", - "property": "bankAccont", + "description": "Cannot withdraw negative", + "property": "bankAccount", "input": { "operations": [ { @@ -259,8 +284,8 @@ }, { "uuid": "d45df9ea-1db0-47f3-b18c-d365db49d938", - "description": "Can return with shift and then raise an error if empty", - "property": "bankAccont", + "description": "Cannot deposit negative", + "property": "bankAccount", "input": { "operations": [ { From 6bbe2830e6caadbb4f34c7d2d42adaf14ad114a6 Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Thu, 2 Feb 2023 10:20:59 +0000 Subject: [PATCH 03/25] Moved error and updated the comment --- exercises/bank-account/canonical-data.json | 68 +++++++++++++++------- 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 9ed453bc7a..bb7c2b9ac6 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -1,11 +1,11 @@ { "exercise": "bank-account", "comments": [ - "For this exercise it is possible to implement concurrency tests", - "but for language tracks that do not support concurrency, the tests", - "are written to be run in a single thread.", - "But for language tracks that do support concurrency, it is possible", - "to write tests that run concurrently." + "This exercise is a good candidate to practice concurrency, which", + "may not be available or possible in the implementing language track.", + "In this case, all tests can be executed on a single thread. If there", + "are tests that don't work using a single thread, these should be", + "marked with a concurrency scenario." ], "cases": [ { @@ -138,11 +138,14 @@ "operation": "close" }, { - "operation": "amount" + "operation": "amount", + "expected": { + "error": "account not open" + } } ] }, - "expected": { "error": "account not open" } + "expected": {} }, { "uuid": "7a65ba52-e35c-4fd2-8159-bda2bde6e59c", @@ -158,11 +161,14 @@ }, { "operation": "deposit", - "value": 50 + "value": 50, + "expected": { + "error": "account not open" + } } ] }, - "expected": { "error": "account not open" } + "expected": {} }, { "uuid": "570dfaa5-0532-4c1f-a7d3-0f65c3265608", @@ -178,11 +184,14 @@ }, { "operation": "withdraw", - "value": 50 + "value": 50, + "expected": { + "error": "account not open" + } } ] }, - "expected": { "error": "account not open" } + "expected": {} }, { "uuid": "c396d233-1c49-4272-98dc-7f502dbb9470", @@ -191,11 +200,14 @@ "input": { "operations": [ { - "operation": "close" + "operation": "close", + "expected": { + "error": "account not open" + } } ] }, - "expected": { "error": "account not open" } + "expected": {} }, { "uuid": "c06f534f-bdc2-4a02-a388-1063400684de", @@ -207,11 +219,14 @@ "operation": "open" }, { - "operation": "open" + "operation": "open", + "expected": { + "error": "account already open" + } } ] }, - "expected": { "error": "account already open" } + "expected": {} }, { "uuid": "0722d404-6116-4f92-ba3b-da7f88f1669c", @@ -255,11 +270,14 @@ }, { "operation": "withdraw", - "value": 50 + "value": 50, + "expected": { + "error": "amount must be less than balance" + } } ] }, - "expected": { "error": "amount must be less than balance" } + "expected": {} }, { "uuid": "4f381ef8-10ef-4507-8e1d-0631ecc8ee72", @@ -276,11 +294,14 @@ }, { "operation": "withdraw", - "value": -50 + "value": -50, + "expected": { + "error": "amount must be greater than 0" + } } ] }, - "expected": { "error": "amount must be greater than 0" } + "expected": {} }, { "uuid": "d45df9ea-1db0-47f3-b18c-d365db49d938", @@ -293,11 +314,14 @@ }, { "operation": "deposit", - "value": -50 + "value": -50, + "expected": { + "error": "amount must be greater than 0" + } } ] }, - "expected": { "error": "amount must be greater than 0" } + "expected": {} } ] -} +} \ No newline at end of file From 09f11daceb869de2d5f0bab5d6febd90da7c3126 Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Thu, 2 Feb 2023 10:22:09 +0000 Subject: [PATCH 04/25] added space at the end --- exercises/bank-account/canonical-data.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index bb7c2b9ac6..331b5ae3a8 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -324,4 +324,4 @@ "expected": {} } ] -} \ No newline at end of file +} From b5e4a521a929f777752432b0a3f703a1bdb2fab2 Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Thu, 2 Feb 2023 19:05:45 +0100 Subject: [PATCH 05/25] Apply suggestions from code review Co-authored-by: Glenn Jackman --- exercises/bank-account/canonical-data.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 331b5ae3a8..3a9dfe3005 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -86,11 +86,11 @@ }, { "operation": "withdraw", - "value": 50 + "value": 75 }, { "operation": "amount", - "expected": 50 + "expected": 25 } ] }, @@ -195,7 +195,7 @@ }, { "uuid": "c396d233-1c49-4272-98dc-7f502dbb9470", - "description": "Close already closed account", + "description": "Close an account that was not opened", "property": "bankAccount", "input": { "operations": [ From b9abfa4a43d003feef21b0a50b5b306b6edd8313 Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Thu, 2 Feb 2023 19:07:36 +0100 Subject: [PATCH 06/25] Add additional test --- exercises/bank-account/canonical-data.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 3a9dfe3005..55c5d19616 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -170,6 +170,21 @@ }, "expected": {} }, + { + "uuid": "a0a1835d-faae-4ad4-a6f3-1fcc2121380b", + "description": "Deposit into unopened account", + "property": "bankAccount", + "input": { + "operations": [ + { + "operation": "deposit", + "value": 50, + "expected": { "error": "account not open" } + } + ] + }, + "expected": {} + }, { "uuid": "570dfaa5-0532-4c1f-a7d3-0f65c3265608", "description": "Withdraw from closed account", From 16c6f5b515e2aac70ecad9b6f301102aea927e1d Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Mon, 6 Feb 2023 09:06:18 +0100 Subject: [PATCH 07/25] Removed expect --- exercises/bank-account/canonical-data.json | 45 ++++++++-------------- 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 55c5d19616..fa17de1a11 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -22,8 +22,7 @@ "expected": 0 } ] - }, - "expected": {} + } }, { "uuid": "e88d4ec3-c6bf-4752-8e59-5046c44e3ba7", @@ -43,8 +42,7 @@ "expected": 100 } ] - }, - "expected": {} + } }, { "uuid": "3d9147d4-63f4-4844-8d2b-1fee2e9a2a0d", @@ -68,8 +66,7 @@ "expected": 150 } ] - }, - "expected": {} + } }, { "uuid": "08f1af07-27ae-4b38-aa19-770bde558064", @@ -93,8 +90,7 @@ "expected": 25 } ] - }, - "expected": {} + } }, { "uuid": "6f6d242f-8c31-4ac6-8995-a90d42cad59f", @@ -122,8 +118,7 @@ "expected": 0 } ] - }, - "expected": {} + } }, { "uuid": "f9facfaa-d824-486e-8381-48832c4bbffd", @@ -144,8 +139,7 @@ } } ] - }, - "expected": {} + } }, { "uuid": "7a65ba52-e35c-4fd2-8159-bda2bde6e59c", @@ -167,8 +161,7 @@ } } ] - }, - "expected": {} + } }, { "uuid": "a0a1835d-faae-4ad4-a6f3-1fcc2121380b", @@ -182,8 +175,7 @@ "expected": { "error": "account not open" } } ] - }, - "expected": {} + } }, { "uuid": "570dfaa5-0532-4c1f-a7d3-0f65c3265608", @@ -205,8 +197,7 @@ } } ] - }, - "expected": {} + } }, { "uuid": "c396d233-1c49-4272-98dc-7f502dbb9470", @@ -221,8 +212,7 @@ } } ] - }, - "expected": {} + } }, { "uuid": "c06f534f-bdc2-4a02-a388-1063400684de", @@ -240,8 +230,7 @@ } } ] - }, - "expected": {} + } }, { "uuid": "0722d404-6116-4f92-ba3b-da7f88f1669c", @@ -267,8 +256,7 @@ "expected": 0 } ] - }, - "expected": {} + } }, { "uuid": "ec42245f-9361-4341-8231-a22e8d19c52f", @@ -291,8 +279,7 @@ } } ] - }, - "expected": {} + } }, { "uuid": "4f381ef8-10ef-4507-8e1d-0631ecc8ee72", @@ -315,8 +302,7 @@ } } ] - }, - "expected": {} + } }, { "uuid": "d45df9ea-1db0-47f3-b18c-d365db49d938", @@ -335,8 +321,7 @@ } } ] - }, - "expected": {} + } } ] } From 81f097cca7439ea00bfa3876c9fae60fd137e2ba Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Mon, 6 Feb 2023 09:10:46 +0100 Subject: [PATCH 08/25] Revert "Removed expect" This reverts commit 16c6f5b515e2aac70ecad9b6f301102aea927e1d. --- exercises/bank-account/canonical-data.json | 45 ++++++++++++++-------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index fa17de1a11..55c5d19616 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -22,7 +22,8 @@ "expected": 0 } ] - } + }, + "expected": {} }, { "uuid": "e88d4ec3-c6bf-4752-8e59-5046c44e3ba7", @@ -42,7 +43,8 @@ "expected": 100 } ] - } + }, + "expected": {} }, { "uuid": "3d9147d4-63f4-4844-8d2b-1fee2e9a2a0d", @@ -66,7 +68,8 @@ "expected": 150 } ] - } + }, + "expected": {} }, { "uuid": "08f1af07-27ae-4b38-aa19-770bde558064", @@ -90,7 +93,8 @@ "expected": 25 } ] - } + }, + "expected": {} }, { "uuid": "6f6d242f-8c31-4ac6-8995-a90d42cad59f", @@ -118,7 +122,8 @@ "expected": 0 } ] - } + }, + "expected": {} }, { "uuid": "f9facfaa-d824-486e-8381-48832c4bbffd", @@ -139,7 +144,8 @@ } } ] - } + }, + "expected": {} }, { "uuid": "7a65ba52-e35c-4fd2-8159-bda2bde6e59c", @@ -161,7 +167,8 @@ } } ] - } + }, + "expected": {} }, { "uuid": "a0a1835d-faae-4ad4-a6f3-1fcc2121380b", @@ -175,7 +182,8 @@ "expected": { "error": "account not open" } } ] - } + }, + "expected": {} }, { "uuid": "570dfaa5-0532-4c1f-a7d3-0f65c3265608", @@ -197,7 +205,8 @@ } } ] - } + }, + "expected": {} }, { "uuid": "c396d233-1c49-4272-98dc-7f502dbb9470", @@ -212,7 +221,8 @@ } } ] - } + }, + "expected": {} }, { "uuid": "c06f534f-bdc2-4a02-a388-1063400684de", @@ -230,7 +240,8 @@ } } ] - } + }, + "expected": {} }, { "uuid": "0722d404-6116-4f92-ba3b-da7f88f1669c", @@ -256,7 +267,8 @@ "expected": 0 } ] - } + }, + "expected": {} }, { "uuid": "ec42245f-9361-4341-8231-a22e8d19c52f", @@ -279,7 +291,8 @@ } } ] - } + }, + "expected": {} }, { "uuid": "4f381ef8-10ef-4507-8e1d-0631ecc8ee72", @@ -302,7 +315,8 @@ } } ] - } + }, + "expected": {} }, { "uuid": "d45df9ea-1db0-47f3-b18c-d365db49d938", @@ -321,7 +335,8 @@ } } ] - } + }, + "expected": {} } ] } From 4ec1daba15de33e309d53dbf222db5adc8189378 Mon Sep 17 00:00:00 2001 From: Carl Date: Fri, 10 Feb 2023 19:33:24 +0100 Subject: [PATCH 09/25] Updated tests --- exercises/bank-account/canonical-data.json | 99 ++++++++-------------- 1 file changed, 37 insertions(+), 62 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 55c5d19616..849da3a0e0 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -5,7 +5,13 @@ "may not be available or possible in the implementing language track.", "In this case, all tests can be executed on a single thread. If there", "are tests that don't work using a single thread, these should be", - "marked with a concurrency scenario." + "marked with a concurrency scenario.", + "----------------------------------------------------------------", + "For tests which requires multiple expected values/errors", + "Should put the expected values/errors at each operation", + "And then the last expected value/error should be the case expected", + "For errors that are suppose to raise non fatal errors", + "Should have an extra field called `fatal` which holds a boolean" ], "cases": [ { @@ -18,12 +24,11 @@ "operation": "open" }, { - "operation": "amount", - "expected": 0 + "operation": "amount" } ] }, - "expected": {} + "expected": 0 }, { "uuid": "e88d4ec3-c6bf-4752-8e59-5046c44e3ba7", @@ -39,12 +44,11 @@ "value": 100 }, { - "operation": "amount", - "expected": 100 + "operation": "amount" } ] }, - "expected": {} + "expected": 100 }, { "uuid": "3d9147d4-63f4-4844-8d2b-1fee2e9a2a0d", @@ -64,12 +68,11 @@ "value": 50 }, { - "operation": "amount", - "expected": 150 + "operation": "amount" } ] }, - "expected": {} + "expected": 150 }, { "uuid": "08f1af07-27ae-4b38-aa19-770bde558064", @@ -89,12 +92,11 @@ "value": 75 }, { - "operation": "amount", - "expected": 25 + "operation": "amount" } ] }, - "expected": {} + "expected": 25 }, { "uuid": "6f6d242f-8c31-4ac6-8995-a90d42cad59f", @@ -118,12 +120,11 @@ "value": 20 }, { - "operation": "amount", - "expected": 0 + "operation": "amount" } ] }, - "expected": {} + "expected": 0 }, { "uuid": "f9facfaa-d824-486e-8381-48832c4bbffd", @@ -138,14 +139,11 @@ "operation": "close" }, { - "operation": "amount", - "expected": { - "error": "account not open" - } + "operation": "amount" } ] }, - "expected": {} + "expected": {"error": "account not open"} }, { "uuid": "7a65ba52-e35c-4fd2-8159-bda2bde6e59c", @@ -161,14 +159,11 @@ }, { "operation": "deposit", - "value": 50, - "expected": { - "error": "account not open" - } + "value": 50 } ] }, - "expected": {} + "expected": {"error": "account not open"} }, { "uuid": "a0a1835d-faae-4ad4-a6f3-1fcc2121380b", @@ -178,12 +173,11 @@ "operations": [ { "operation": "deposit", - "value": 50, - "expected": { "error": "account not open" } + "value": 50 } ] }, - "expected": {} + "expected": {"error": "account not open"} }, { "uuid": "570dfaa5-0532-4c1f-a7d3-0f65c3265608", @@ -199,14 +193,11 @@ }, { "operation": "withdraw", - "value": 50, - "expected": { - "error": "account not open" - } + "value": 50 } ] }, - "expected": {} + "expected": {"error": "account not open"} }, { "uuid": "c396d233-1c49-4272-98dc-7f502dbb9470", @@ -215,14 +206,11 @@ "input": { "operations": [ { - "operation": "close", - "expected": { - "error": "account not open" - } + "operation": "close" } ] }, - "expected": {} + "expected": {"error": "account not open"} }, { "uuid": "c06f534f-bdc2-4a02-a388-1063400684de", @@ -234,14 +222,11 @@ "operation": "open" }, { - "operation": "open", - "expected": { - "error": "account already open" - } + "operation": "open" } ] }, - "expected": {} + "expected": {"error": "account already open"} }, { "uuid": "0722d404-6116-4f92-ba3b-da7f88f1669c", @@ -263,12 +248,11 @@ "operation": "open" }, { - "operation": "amount", - "expected": 0 + "operation": "amount" } ] }, - "expected": {} + "expected": 0 }, { "uuid": "ec42245f-9361-4341-8231-a22e8d19c52f", @@ -285,14 +269,11 @@ }, { "operation": "withdraw", - "value": 50, - "expected": { - "error": "amount must be less than balance" - } + "value": 50 } ] }, - "expected": {} + "expected": {"error": "amount must be less than balance"} }, { "uuid": "4f381ef8-10ef-4507-8e1d-0631ecc8ee72", @@ -309,14 +290,11 @@ }, { "operation": "withdraw", - "value": -50, - "expected": { - "error": "amount must be greater than 0" - } + "value": -50 } ] }, - "expected": {} + "expected": {"error": "amount must be greater than 0"} }, { "uuid": "d45df9ea-1db0-47f3-b18c-d365db49d938", @@ -329,14 +307,11 @@ }, { "operation": "deposit", - "value": -50, - "expected": { - "error": "amount must be greater than 0" - } + "value": -50 } ] }, - "expected": {} + "expected": {"error": "amount must be greater than 0"} } ] } From b994a35010f1bc6db00b58ad7f935fee231befd7 Mon Sep 17 00:00:00 2001 From: Carl Date: Fri, 10 Feb 2023 19:36:01 +0100 Subject: [PATCH 10/25] Fixed formatting --- exercises/bank-account/canonical-data.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 849da3a0e0..3c864107fd 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -143,7 +143,7 @@ } ] }, - "expected": {"error": "account not open"} + "expected": { "error": "account not open" } }, { "uuid": "7a65ba52-e35c-4fd2-8159-bda2bde6e59c", @@ -163,7 +163,7 @@ } ] }, - "expected": {"error": "account not open"} + "expected": { "error": "account not open" } }, { "uuid": "a0a1835d-faae-4ad4-a6f3-1fcc2121380b", @@ -177,7 +177,7 @@ } ] }, - "expected": {"error": "account not open"} + "expected": { "error": "account not open" } }, { "uuid": "570dfaa5-0532-4c1f-a7d3-0f65c3265608", @@ -197,7 +197,7 @@ } ] }, - "expected": {"error": "account not open"} + "expected": { "error": "account not open" } }, { "uuid": "c396d233-1c49-4272-98dc-7f502dbb9470", @@ -210,7 +210,7 @@ } ] }, - "expected": {"error": "account not open"} + "expected": { "error": "account not open" } }, { "uuid": "c06f534f-bdc2-4a02-a388-1063400684de", @@ -226,7 +226,7 @@ } ] }, - "expected": {"error": "account already open"} + "expected": { "error": "account already open" } }, { "uuid": "0722d404-6116-4f92-ba3b-da7f88f1669c", @@ -273,7 +273,7 @@ } ] }, - "expected": {"error": "amount must be less than balance"} + "expected": { "error": "amount must be less than balance" } }, { "uuid": "4f381ef8-10ef-4507-8e1d-0631ecc8ee72", @@ -294,7 +294,7 @@ } ] }, - "expected": {"error": "amount must be greater than 0"} + "expected": { "error": "amount must be greater than 0" } }, { "uuid": "d45df9ea-1db0-47f3-b18c-d365db49d938", @@ -311,7 +311,7 @@ } ] }, - "expected": {"error": "amount must be greater than 0"} + "expected": { "error": "amount must be greater than 0" } } ] } From e5514c546b3a356906eb7e40955938173390350f Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Mon, 27 Feb 2023 20:56:54 +0100 Subject: [PATCH 11/25] Apply suggestions from code review Co-authored-by: Peter Tseng --- exercises/bank-account/canonical-data.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 3c864107fd..656e8e78b4 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -8,8 +8,8 @@ "marked with a concurrency scenario.", "----------------------------------------------------------------", "For tests which requires multiple expected values/errors", - "Should put the expected values/errors at each operation", - "And then the last expected value/error should be the case expected", + "Should put the expected values/errors as a field of each operation", + "And then the last expected value/error should be the overall expected value for the case", "For errors that are suppose to raise non fatal errors", "Should have an extra field called `fatal` which holds a boolean" ], From ef45bab0eb0d31b469b6e0aa633ba58fab958540 Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Thu, 2 Mar 2023 08:42:21 +0100 Subject: [PATCH 12/25] Update exercises/bank-account/canonical-data.json Co-authored-by: Peter Tseng --- exercises/bank-account/canonical-data.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 656e8e78b4..838c6cb49f 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -7,9 +7,9 @@ "are tests that don't work using a single thread, these should be", "marked with a concurrency scenario.", "----------------------------------------------------------------", - "For tests which requires multiple expected values/errors", - "Should put the expected values/errors as a field of each operation", - "And then the last expected value/error should be the overall expected value for the case", + "The overall expected value for the case should be the result of the last operation.", + "If any operation other than the last one also has an expected result,", + "that individual operation should have its expected value/error as a field.", "For errors that are suppose to raise non fatal errors", "Should have an extra field called `fatal` which holds a boolean" ], From 1e3775de56da464088f31b9afd7513d94fc8aafa Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Thu, 2 Mar 2023 22:27:23 +0100 Subject: [PATCH 13/25] Apply suggestions from code review Co-authored-by: Erik Schierboom --- exercises/bank-account/canonical-data.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 838c6cb49f..b66034f465 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -32,7 +32,7 @@ }, { "uuid": "e88d4ec3-c6bf-4752-8e59-5046c44e3ba7", - "description": "Can deposit money", + "description": "Single deposit", "property": "bankAccount", "input": { "operations": [ @@ -52,7 +52,7 @@ }, { "uuid": "3d9147d4-63f4-4844-8d2b-1fee2e9a2a0d", - "description": "Can deposit money sequentially", + "description": "Multiple deposits", "property": "bankAccount", "input": { "operations": [ @@ -76,7 +76,7 @@ }, { "uuid": "08f1af07-27ae-4b38-aa19-770bde558064", - "description": "Can withdraw money", + "description": "Withdraw once", "property": "bankAccount", "input": { "operations": [ @@ -100,7 +100,7 @@ }, { "uuid": "6f6d242f-8c31-4ac6-8995-a90d42cad59f", - "description": "Can withdraw money sequentially", + "description": "Withdraw twice", "property": "bankAccount", "input": { "operations": [ @@ -128,7 +128,7 @@ }, { "uuid": "f9facfaa-d824-486e-8381-48832c4bbffd", - "description": "Checking balance of closed account throws error", + "description": "Cannot check balance of closed account", "property": "bankAccount", "input": { "operations": [ @@ -147,7 +147,7 @@ }, { "uuid": "7a65ba52-e35c-4fd2-8159-bda2bde6e59c", - "description": "Deposit into closed account", + "description": "Cannot deposit into closed account", "property": "bankAccount", "input": { "operations": [ @@ -167,7 +167,7 @@ }, { "uuid": "a0a1835d-faae-4ad4-a6f3-1fcc2121380b", - "description": "Deposit into unopened account", + "description": "Cannot deposit into unopened account", "property": "bankAccount", "input": { "operations": [ @@ -181,7 +181,7 @@ }, { "uuid": "570dfaa5-0532-4c1f-a7d3-0f65c3265608", - "description": "Withdraw from closed account", + "description": "Cannot withdraw from closed account", "property": "bankAccount", "input": { "operations": [ @@ -201,7 +201,7 @@ }, { "uuid": "c396d233-1c49-4272-98dc-7f502dbb9470", - "description": "Close an account that was not opened", + "description": "Cannot close an account that was not opened", "property": "bankAccount", "input": { "operations": [ @@ -214,7 +214,7 @@ }, { "uuid": "c06f534f-bdc2-4a02-a388-1063400684de", - "description": "Open already opened account", + "description": "Cannot open an already opened account", "property": "bankAccount", "input": { "operations": [ From 257d20e07f124ab9aed020f1355366c28e7acc90 Mon Sep 17 00:00:00 2001 From: Carl Date: Thu, 2 Mar 2023 22:33:45 +0100 Subject: [PATCH 14/25] added extra test based of Eriks feedback --- exercises/bank-account/canonical-data.json | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index b66034f465..bb04e6f3ab 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -126,6 +126,42 @@ }, "expected": 0 }, + { + "uuid": "45161c94-a094-4c77-9cec-998b70429bda", + "description": "Can do multiple operations sequentially", + "property": "bankAccount", + "input": { + "operations": [ + { + "operation": "open" + }, + { + "operation": "deposit", + "value": 100 + }, + { + "operation": "deposit", + "value": 110 + }, + { + "operation": "withdraw", + "value": 200 + }, + { + "operation": "deposit", + "value": 60 + }, + { + "operation": "withdraw", + "value": 50 + }, + { + "operation": "amount" + } + ] + }, + "expected": 20 + }, { "uuid": "f9facfaa-d824-486e-8381-48832c4bbffd", "description": "Cannot check balance of closed account", From 5bd2808439b272cbd9b6a8afe76b8fc574621640 Mon Sep 17 00:00:00 2001 From: Carl Date: Wed, 15 Mar 2023 22:50:13 +0100 Subject: [PATCH 15/25] Added concurrent test case --- exercises/bank-account/canonical-data.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index bb04e6f3ab..c8fae8b6e8 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -348,6 +348,21 @@ ] }, "expected": { "error": "amount must be greater than 0" } + }, + { + "scenarios": ["concurrent"], + "operation": "Can handle concurrent transactions", + "operations": [ + { + "operation": "deposit", + "value": 1 + }, + { + "operation": "withdraw", + "value": 1 + } + ], + "expected": {} } ] } From dad9a347f63a4fd0cdb121dee0c0d5ca10f53eca Mon Sep 17 00:00:00 2001 From: Carl Date: Wed, 15 Mar 2023 22:52:43 +0100 Subject: [PATCH 16/25] Fix --- exercises/bank-account/canonical-data.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index c8fae8b6e8..fc02634d40 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -350,8 +350,9 @@ "expected": { "error": "amount must be greater than 0" } }, { + "uuid": "ba0c1e0b-0f00-416f-8097-a7dfc97871ff", + "description": "Can handle concurrent transactions", "scenarios": ["concurrent"], - "operation": "Can handle concurrent transactions", "operations": [ { "operation": "deposit", From 764a961ff0a81afa90ce3588c5606a2e459495cb Mon Sep 17 00:00:00 2001 From: Carl Date: Wed, 15 Mar 2023 22:56:15 +0100 Subject: [PATCH 17/25] fix --- exercises/bank-account/canonical-data.json | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index fc02634d40..239d5b7ac2 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -353,16 +353,18 @@ "uuid": "ba0c1e0b-0f00-416f-8097-a7dfc97871ff", "description": "Can handle concurrent transactions", "scenarios": ["concurrent"], - "operations": [ - { - "operation": "deposit", - "value": 1 - }, - { - "operation": "withdraw", - "value": 1 - } - ], + "input": { + "operations": [ + { + "operation": "deposit", + "value": 1 + }, + { + "operation": "withdraw", + "value": 1 + } + ] + }, "expected": {} } ] From 8d26047f4d3554fa62836421234ef0a238d6ea1e Mon Sep 17 00:00:00 2001 From: Carl Date: Wed, 15 Mar 2023 22:57:35 +0100 Subject: [PATCH 18/25] Fix --- exercises/bank-account/canonical-data.json | 1 + 1 file changed, 1 insertion(+) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 239d5b7ac2..21f4cf5199 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -353,6 +353,7 @@ "uuid": "ba0c1e0b-0f00-416f-8097-a7dfc97871ff", "description": "Can handle concurrent transactions", "scenarios": ["concurrent"], + "property": "bankAccount", "input": { "operations": [ { From abf10f4b1c43eadfa1b09b2816a2a68fccb23c35 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 16 Mar 2023 08:51:13 +0100 Subject: [PATCH 19/25] Update exercises/bank-account/canonical-data.json --- exercises/bank-account/canonical-data.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 21f4cf5199..c2fcc5e18a 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -3,7 +3,7 @@ "comments": [ "This exercise is a good candidate to practice concurrency, which", "may not be available or possible in the implementing language track.", - "In this case, all tests can be executed on a single thread. If there", + "In that case, all tests can be executed on a single thread. If there", "are tests that don't work using a single thread, these should be", "marked with a concurrency scenario.", "----------------------------------------------------------------", From efa765e48c1be7cc0f5c1736d0dab052d0b35504 Mon Sep 17 00:00:00 2001 From: Carl Date: Thu, 16 Mar 2023 18:29:04 +0100 Subject: [PATCH 20/25] Added changes based on feedback --- exercises/bank-account/canonical-data.json | 34 ++++++++++------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index c2fcc5e18a..b6999977d2 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -3,15 +3,7 @@ "comments": [ "This exercise is a good candidate to practice concurrency, which", "may not be available or possible in the implementing language track.", - "In that case, all tests can be executed on a single thread. If there", - "are tests that don't work using a single thread, these should be", - "marked with a concurrency scenario.", - "----------------------------------------------------------------", - "The overall expected value for the case should be the result of the last operation.", - "If any operation other than the last one also has an expected result,", - "that individual operation should have its expected value/error as a field.", - "For errors that are suppose to raise non fatal errors", - "Should have an extra field called `fatal` which holds a boolean" + "It is possible to implement this exercise without concurrency," ], "cases": [ { @@ -24,7 +16,7 @@ "operation": "open" }, { - "operation": "amount" + "operation": "balance" } ] }, @@ -44,7 +36,7 @@ "value": 100 }, { - "operation": "amount" + "operation": "balance" } ] }, @@ -68,7 +60,7 @@ "value": 50 }, { - "operation": "amount" + "operation": "balance" } ] }, @@ -92,7 +84,7 @@ "value": 75 }, { - "operation": "amount" + "operation": "balance" } ] }, @@ -120,7 +112,7 @@ "value": 20 }, { - "operation": "amount" + "operation": "balance" } ] }, @@ -156,7 +148,7 @@ "value": 50 }, { - "operation": "amount" + "operation": "balance" } ] }, @@ -175,7 +167,7 @@ "operation": "close" }, { - "operation": "amount" + "operation": "balance" } ] }, @@ -284,7 +276,7 @@ "operation": "open" }, { - "operation": "amount" + "operation": "balance" } ] }, @@ -353,9 +345,15 @@ "uuid": "ba0c1e0b-0f00-416f-8097-a7dfc97871ff", "description": "Can handle concurrent transactions", "scenarios": ["concurrent"], + "comments": [ + "This test is a good candidate to practice concurrency, which", + "may not be available or possible in the implementing language track.", + "Concurrency testing is often made by running the same operations in", + "parallel, and then checking that the final state is as expected." + ], "property": "bankAccount", "input": { - "operations": [ + "concurrent_operations": [ { "operation": "deposit", "value": 1 From 105a3c75f7980e18d531b4660bd2babd80b29aae Mon Sep 17 00:00:00 2001 From: Carl Date: Thu, 16 Mar 2023 18:30:36 +0100 Subject: [PATCH 21/25] Fix --- exercises/bank-account/canonical-data.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index b6999977d2..526785c815 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -344,13 +344,13 @@ { "uuid": "ba0c1e0b-0f00-416f-8097-a7dfc97871ff", "description": "Can handle concurrent transactions", - "scenarios": ["concurrent"], "comments": [ "This test is a good candidate to practice concurrency, which", "may not be available or possible in the implementing language track.", "Concurrency testing is often made by running the same operations in", "parallel, and then checking that the final state is as expected." ], + "scenarios": ["concurrent"], "property": "bankAccount", "input": { "concurrent_operations": [ From c2c92cdaeecb080609feddbf2bb64375d9e67aec Mon Sep 17 00:00:00 2001 From: Carl Date: Fri, 17 Mar 2023 08:46:28 +0100 Subject: [PATCH 22/25] Updated --- exercises/bank-account/canonical-data.json | 50 +++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 526785c815..a6ca433f0a 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -3,7 +3,7 @@ "comments": [ "This exercise is a good candidate to practice concurrency, which", "may not be available or possible in the implementing language track.", - "It is possible to implement this exercise without concurrency," + "It is possible to implement this exercise without concurrency." ], "cases": [ { @@ -33,7 +33,7 @@ }, { "operation": "deposit", - "value": 100 + "amount": 100 }, { "operation": "balance" @@ -53,11 +53,11 @@ }, { "operation": "deposit", - "value": 100 + "amount": 100 }, { "operation": "deposit", - "value": 50 + "amount": 50 }, { "operation": "balance" @@ -77,11 +77,11 @@ }, { "operation": "deposit", - "value": 100 + "amount": 100 }, { "operation": "withdraw", - "value": 75 + "amount": 75 }, { "operation": "balance" @@ -101,15 +101,15 @@ }, { "operation": "deposit", - "value": 100 + "amount": 100 }, { "operation": "withdraw", - "value": 80 + "amount": 80 }, { "operation": "withdraw", - "value": 20 + "amount": 20 }, { "operation": "balance" @@ -129,23 +129,23 @@ }, { "operation": "deposit", - "value": 100 + "amount": 100 }, { "operation": "deposit", - "value": 110 + "amount": 110 }, { "operation": "withdraw", - "value": 200 + "amount": 200 }, { "operation": "deposit", - "value": 60 + "amount": 60 }, { "operation": "withdraw", - "value": 50 + "amount": 50 }, { "operation": "balance" @@ -187,7 +187,7 @@ }, { "operation": "deposit", - "value": 50 + "amount": 50 } ] }, @@ -201,7 +201,7 @@ "operations": [ { "operation": "deposit", - "value": 50 + "amount": 50 } ] }, @@ -221,7 +221,7 @@ }, { "operation": "withdraw", - "value": 50 + "amount": 50 } ] }, @@ -267,7 +267,7 @@ }, { "operation": "deposit", - "value": 50 + "amount": 50 }, { "operation": "close" @@ -293,11 +293,11 @@ }, { "operation": "deposit", - "value": 25 + "amount": 25 }, { "operation": "withdraw", - "value": 50 + "amount": 50 } ] }, @@ -314,11 +314,11 @@ }, { "operation": "deposit", - "value": 100 + "amount": 100 }, { "operation": "withdraw", - "value": -50 + "amount": -50 } ] }, @@ -335,7 +335,7 @@ }, { "operation": "deposit", - "value": -50 + "amount": -50 } ] }, @@ -356,11 +356,11 @@ "concurrent_operations": [ { "operation": "deposit", - "value": 1 + "amount": 1 }, { "operation": "withdraw", - "value": 1 + "amount": 1 } ] }, From 8bda70d8dfc166892fedac60effdfda3a8887cb7 Mon Sep 17 00:00:00 2001 From: Carl Date: Fri, 17 Mar 2023 09:02:50 +0100 Subject: [PATCH 23/25] Updated --- exercises/bank-account/canonical-data.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index a6ca433f0a..8e01433a8f 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -362,9 +362,14 @@ "operation": "withdraw", "amount": 1 } + ], + "operations": [ + { + "operation": "balance" + } ] }, - "expected": {} + "expected": 0 } ] } From 7f8a07c077a360fbc9beabff7485e3315372d5d6 Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Mon, 20 Mar 2023 18:44:57 +0100 Subject: [PATCH 24/25] Update exercises/bank-account/canonical-data.json Awsome! Co-authored-by: Glenn Jackman --- exercises/bank-account/canonical-data.json | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 8e01433a8f..54e80b7e58 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -353,17 +353,25 @@ "scenarios": ["concurrent"], "property": "bankAccount", "input": { - "concurrent_operations": [ + "initial_operations": [ { - "operation": "deposit", - "amount": 1 - }, - { - "operation": "withdraw", - "amount": 1 + "operation": "open" } ], - "operations": [ + "concurrent_operations": { + "number": 1000, + "operations": [ + { + "operation": "deposit", + "amount": 1 + }, + { + "operation": "withdraw", + "amount": 1 + } + ] + }, + "finishing_operations": [ { "operation": "balance" } From 8a18f977d1eb36e0b49375f5aa9aa192dcfee0cc Mon Sep 17 00:00:00 2001 From: Carl Date: Tue, 21 Mar 2023 12:57:14 +0100 Subject: [PATCH 25/25] Updated based on feedback --- exercises/bank-account/canonical-data.json | 33 +++++++++++----------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/exercises/bank-account/canonical-data.json b/exercises/bank-account/canonical-data.json index 54e80b7e58..8cf700bcfd 100644 --- a/exercises/bank-account/canonical-data.json +++ b/exercises/bank-account/canonical-data.json @@ -353,25 +353,24 @@ "scenarios": ["concurrent"], "property": "bankAccount", "input": { - "initial_operations": [ + "operations": [ { "operation": "open" - } - ], - "concurrent_operations": { - "number": 1000, - "operations": [ - { - "operation": "deposit", - "amount": 1 - }, - { - "operation": "withdraw", - "amount": 1 - } - ] - }, - "finishing_operations": [ + }, + { + "operation": "concurrent", + "number": 1000, + "operations": [ + { + "operation": "deposit", + "amount": 1 + }, + { + "operation": "withdraw", + "amount": 1 + } + ] + }, { "operation": "balance" }