Skip to content
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
19 changes: 16 additions & 3 deletions exercises/practice/two-bucket/.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.

[a6f2b4ba-065f-4dca-b6f0-e3eee51cb661]
description = "Measure using bucket one of size 3 and bucket two of size 5 - start with bucket one"
Expand All @@ -20,6 +27,12 @@ description = "Measure one step using bucket one of size 1 and bucket two of siz
[eb329c63-5540-4735-b30b-97f7f4df0f84]
description = "Measure using bucket one of size 2 and bucket two of size 3 - start with bucket one and end with bucket two"

[58d70152-bf2b-46bb-ad54-be58ebe94c03]
description = "Measure using bucket one much bigger than bucket two"

[9dbe6499-caa5-4a58-b5ce-c988d71b8981]
description = "Measure using bucket one much smaller than bucket two"

[449be72d-b10a-4f4b-a959-ca741e333b72]
description = "Not possible to reach the goal"

Expand Down
18 changes: 18 additions & 0 deletions exercises/practice/two-bucket/two-bucket-test.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,24 @@
(output (two-bucket:measure bucket-one bucket-two goal start-bucket)))
(is (equal-alists result output))))

(test measure-using-bucket-one-much-bigger-than-bucket-two
(let* ((bucket-one 5)
(bucket-two 1)
(goal 2)
(start-bucket :one)
(result '((:moves . 6) (:goal-bucket . :one) (:other-bucket . 1)))
(output (two-bucket:measure bucket-one bucket-two goal start-bucket)))
(is (equal-alists result output))))

(test measure-using-bucket-one-much-smaller-than-bucket-two
(let* ((bucket-one 3)
(bucket-two 15)
(goal 9)
(start-bucket :one)
(result '((:moves . 6) (:goal-bucket . :two) (:other-bucket . 0)))
(output (two-bucket:measure bucket-one bucket-two goal start-bucket)))
(is (equal-alists result output))))

(test not-possible-to-reach-the-goal
(let ((bucket-one 6)
(bucket-two 15)
Expand Down