diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test.lisp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test.lisp b/tests/test.lisp index 73f03b8..6e6fb9b 100644 --- a/tests/test.lisp +++ b/tests/test.lisp @@ -12,6 +12,14 @@ :description "Test object and methods for game" :in transacc-suite) +(test make-game + (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 (equal (type-of g) 'game::game)))) + ;; testing buy-item (test buy-item (let* ((p (player:init-player "Joze")) @@ -25,3 +33,25 @@ (is (game:sell-item g "apple" 5)) (is (game:buy-item g "pear" 20)) (is (game:sell-item g "pear" 100)))) + +;; testing change-zone +(test change-zone + (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 z (list z z2)))) + (is (string= (zone:name (game::cur-zone g)) + "Bronx")) + (is (game:change-zone g "Manhattan")) + (is (string= (zone:name (game::cur-zone g)) + "Manhattan")) + (game:buy-item g "pear" 10) + (is (not (game:change-zone g "Paris"))) + (is (game:change-zone g "Bronx")) + (game:sell-item g "pear" 10) + (is (= (player:get-cash (game::player g)) + 2050)))) |
