From 62d2646d4dbe4a3a35bd9b4449e5c5b67d36f233 Mon Sep 17 00:00:00 2001 From: El-BG-1970 Date: Thu, 4 Aug 2022 18:47:24 +0200 Subject: implemented game:get profit --- tests/test.lisp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') 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))))) -- cgit v1.2.3