summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/test.lisp16
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