summaryrefslogtreecommitdiffstats
path: root/tests/test.lisp
diff options
context:
space:
mode:
authorEl-BG-1970 <elouangros@hotmail.com>2022-08-04 18:47:24 +0200
committerEl-BG-1970 <elouangros@hotmail.com>2022-08-04 18:47:24 +0200
commit62d2646d4dbe4a3a35bd9b4449e5c5b67d36f233 (patch)
treee8e60cf9cd00c27e216fbd4b100d64abf30001da /tests/test.lisp
parent5731684cca287633b7589c12ca1372eec5dc0f0a (diff)
downloadtransacc-62d2646d4dbe4a3a35bd9b4449e5c5b67d36f233.tar.gz
implemented game:get profit
Diffstat (limited to 'tests/test.lisp')
-rw-r--r--tests/test.lisp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test.lisp b/tests/test.lisp
index 6e6fb9b..405b6aa 100644
--- a/tests/test.lisp
+++ b/tests/test.lisp
@@ -55,3 +55,21 @@
(game:sell-item g "pear" 10)
(is (= (player:get-cash (game::player g))
2050))))
+
+;; testing get profit
+(test get-profit
+ (let* ((p (player:init-player "Joze"))
+ (c (list (commodities:new-commodity "apple" 5)
+ (commodities:new-commodity "pear" 7)))
+ (c2 (list (commodities:new-commodity "apple" 6)
+ (commodities:new-commodity "pear" 2)))
+ (z (zone:new-zone "Bronx" c))
+ (z2 (zone:new-zone "Manhattan" c2))
+ (g (game:new-game p z2 (list z z2))))
+ (is (= 0 (game:get-profit g "pear")))
+ (game:buy-item g "pear" 10)
+ (is (= 0 (game:get-profit g "pear")))
+ (is (= 5 (game:get-profit-in-zone g "pear" z)))
+ (game:change-zone g "Bronx")
+ (is (= 5 (game:get-profit g "pear")))
+ (is (= 0 (game:get-profit-in-zone g "pear" z2)))))