diff options
| author | El-BG-1970 <elouangros@hotmail.com> | 2022-08-04 16:41:30 +0200 |
|---|---|---|
| committer | El-BG-1970 <elouangros@hotmail.com> | 2022-08-04 16:41:30 +0200 |
| commit | 5731684cca287633b7589c12ca1372eec5dc0f0a (patch) | |
| tree | f0920be6027b5d1d03d321fb9160735599f27cc4 /tests/test.lisp | |
| parent | 164b961cdd97c4ef324bbb0ae5f46b394201183b (diff) | |
| download | transacc-5731684cca287633b7589c12ca1372eec5dc0f0a.tar.gz | |
implemented game:change-zone
Diffstat (limited to 'tests/test.lisp')
| -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)))) |
