diff options
| author | El-BG-1970 <elouangros@hotmail.com> | 2022-07-29 16:44:09 +0200 |
|---|---|---|
| committer | El-BG-1970 <elouangros@hotmail.com> | 2022-07-29 16:44:09 +0200 |
| commit | 080878db58f67845b382f19857f731cfb9794865 (patch) | |
| tree | d46ccc555eeef6b872f99f65e12379123acf2395 /tests/test.lisp | |
| parent | 39730c70367bcaa96e34982b90268d2170c75e90 (diff) | |
| download | transacc-080878db58f67845b382f19857f731cfb9794865.tar.gz | |
more inventory tests
Diffstat (limited to 'tests/test.lisp')
| -rw-r--r-- | tests/test.lisp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/test.lisp b/tests/test.lisp index f2136d6..9884990 100644 --- a/tests/test.lisp +++ b/tests/test.lisp @@ -59,9 +59,21 @@ (test inventory-add-and-substract (let ((i (inventory:new-inventory 100)) (c (commodities:new-commodity "apple" 2))) - (inventory:add-item i c 10) + ;; add 10 + (is (= (inventory:add-item i c 10) 10)) (is (= (inventory:filled i) 10)) + ;; remove 4 (is (equal (inventory:remove-item i "apple" 4) - (cons c 4))))) + (cons c 4))) + (is (= (inventory:filled i) 6)) + (is (equal (inventory::find-item i "apple") + (cons c 6))) + ;; adding 90 + (is (= (inventory:add-item i c 90) 96)) + ;; adding one too many + (is (not (inventory:add-item i c 5))) + (is (= (inventory::filled i) 96)) + (is (equal (inventory::find-item i "apple") + (cons c 96))))) ;; creating inventory adding |
