Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
USING: exercism-tools pursers-pantry tools.test ;
USING: exercism-tools kernel pursers-pantry tools.test ;
IN: pursers-pantry.tests

TASK: 1 create-inventory
Expand All @@ -15,6 +15,11 @@ TASK: 2 add-items
H{ { "coal" 1 } } { "wood" "iron" "coal" "wood" } add-items
] unit-test

! the original inventory is left unmodified
{ H{ { "coal" 1 } } } [
H{ { "coal" 1 } } dup { "wood" "iron" "coal" "wood" } add-items drop
] unit-test

TASK: 3 decrement-items
{ H{ { "coal" 2 } { "diamond" 0 } { "iron" 3 } } } [
H{ { "coal" 3 } { "diamond" 1 } { "iron" 5 } }
Expand All @@ -30,6 +35,12 @@ TASK: 3 decrement-items
H{ { "coal" 2 } } { "gold" "silver" } decrement-items
] unit-test

! the original inventory is left unmodified
{ H{ { "coal" 3 } { "diamond" 1 } { "iron" 5 } } } [
H{ { "coal" 3 } { "diamond" 1 } { "iron" 5 } } dup
{ "diamond" "coal" "iron" "iron" } decrement-items drop
] unit-test

TASK: 4 remove-item
{ H{ { "wood" 1 } { "diamond" 2 } } } [
H{ { "coal" 2 } { "wood" 1 } { "diamond" 2 } } "coal" remove-item
Expand All @@ -39,6 +50,11 @@ TASK: 4 remove-item
H{ { "coal" 2 } { "wood" 1 } { "diamond" 2 } } "gold" remove-item
] unit-test

! the original inventory is left unmodified
{ H{ { "coal" 2 } { "wood" 1 } { "diamond" 2 } } } [
H{ { "coal" 2 } { "wood" 1 } { "diamond" 2 } } dup "coal" remove-item drop
] unit-test

TASK: 5 list-inventory
{ { { "coal" 7 } { "diamond" 2 } { "iron" 7 } { "wood" 11 } } } [
H{ { "coal" 7 } { "wood" 11 } { "diamond" 2 } { "iron" 7 } { "silver" 0 } }
Expand Down
Loading