summaryrefslogtreecommitdiffstats
path: root/tests/test.lisp
diff options
context:
space:
mode:
authorEl-BG-1970 <elouangros@hotmail.com>2022-08-04 11:13:32 +0200
committerEl-BG-1970 <elouangros@hotmail.com>2022-08-04 11:13:32 +0200
commit164b961cdd97c4ef324bbb0ae5f46b394201183b (patch)
tree0051bfc0d5c91e150eec85f8860f3244332a0764 /tests/test.lisp
parent8104b4db1c5752b777d17e1f84f8a575587c735f (diff)
downloadtransacc-164b961cdd97c4ef324bbb0ae5f46b394201183b.tar.gz
implemented game:buy-item and game:sell-item
Diffstat (limited to 'tests/test.lisp')
-rw-r--r--tests/test.lisp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test.lisp b/tests/test.lisp
index fb37c94..73f03b8 100644
--- a/tests/test.lisp
+++ b/tests/test.lisp
@@ -6,3 +6,22 @@
(def-suite transacc-suite
:description "Test transacc")
+
+;;; Game tests
+(def-suite* game-suite
+ :description "Test object and methods for game"
+ :in transacc-suite)
+
+;; testing buy-item
+(test buy-item
+ (let* ((p (player:init-player "Joze"))
+ (c (list (commodities:new-commodity "apple" 5)
+ (commodities:new-commodity "pear" 7)))
+ (z (zone:new-zone "Bronx" c))
+ (g (game:new-game p z (list z))))
+ (is (game:buy-item g "apple" 10))
+ (is (not (game:sell-item g "pear" 1)))
+ (is (game:sell-item g "apple" 5))
+ (is (game:sell-item g "apple" 5))
+ (is (game:buy-item g "pear" 20))
+ (is (game:sell-item g "pear" 100))))