summaryrefslogtreecommitdiffstats
path: root/tests/test-commodities.lisp
diff options
context:
space:
mode:
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))))