summaryrefslogtreecommitdiffstats
path: root/tests/test-commodities.lisp
diff options
context:
space:
mode:
authorEl-BG-1970 <elouangros@hotmail.com>2022-08-01 21:12:47 +0200
committerEl-BG-1970 <elouangros@hotmail.com>2022-08-01 21:12:47 +0200
commit8104b4db1c5752b777d17e1f84f8a575587c735f (patch)
tree08277694d39fb486ceed520ebd9c2811a9beca73 /tests/test-commodities.lisp
parent00a46570d36720ab0ac4b6081b62ca96895a0acc (diff)
downloadtransacc-8104b4db1c5752b777d17e1f84f8a575587c735f.tar.gz
split tests for better readability
Diffstat (limited to 'tests/test-commodities.lisp')
-rw-r--r--tests/test-commodities.lisp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test-commodities.lisp b/tests/test-commodities.lisp
new file mode 100644
index 0000000..c664629
--- /dev/null
+++ b/tests/test-commodities.lisp
@@ -0,0 +1,24 @@
+(in-package :transacc-tests)
+
+;;; TESTING COMMODITIES
+(def-suite* commodities-suite
+ :description "Test object and methods for commodities"
+ :in transacc-suite)
+
+;; we make sure creating a commodity returns one
+(test commodity-creation
+ (let ((c1 (commodities:new-commodity "apple" 1))
+ (c2 (commodities:new-commodity "pear" 4))
+ (c3 (commodities:new-commodity "petrol" -3))
+ (c4 (commodities:new-commodity "void" 0)))
+ (is (equal (type-of c1) 'commodities::commodity))
+ (is (equal (type-of c2) 'commodities::commodity))
+ (is (eq c3 nil))
+ (is (eq c4 nil))))
+
+;; we make sure a commodity created with given values
+;; in fact contains said values
+(test commodity-values
+ (let ((c (commodities:new-commodity "car" 10000)))
+ (is (equal (commodities:name c) "car"))
+ (is (= (commodities:price c) 10000))))