summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-player.lisp2
-rw-r--r--tests/test.lisp19
2 files changed, 20 insertions, 1 deletions
diff --git a/tests/test-player.lisp b/tests/test-player.lisp
index 2f261d7..a74ecd7 100644
--- a/tests/test-player.lisp
+++ b/tests/test-player.lisp
@@ -5,7 +5,7 @@
:description "Test object and methods for player"
:in transacc-suite)
-;; testing buy-item
+;; testing player creation
(test creating-player
(let ((p (player:init-player "Joze"))
(p2 (player:init-player "Mehmout" 555 8976)))
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))))