transcendental-lisp/lisp/compound-interest-test.lisp

50 lines
1.1 KiB
Common Lisp
Raw Normal View History

(load "unit-test.lisp")
(load "compound-interest.lisp")
(unit
(list
(defun many-years-with-no-interest-rate ()
(eq (compound-interest 100000 0 10) 100000)
)
(defun no-years-with-positive-interest-rate ()
(eq (compound-interest 100000 10 0) 100000)
)
(defun one-year-with-positive-interest-rate ()
(eq (compound-interest 100000 5 1) 105000)
)
(defun two-years-with-positive-interest-rate ()
(eq (compound-interest 100000 5 2) 110250)
)
(defun three-years-with-positive-interest-rate ()
(eq (compound-interest 100000 5 3) 115763)
)
(defun four-years-with-positive-interest-rate ()
(eq (compound-interest 100000 5 4) 121551)
)
(defun one-year-with-negative-interest-rate ()
(eq (compound-interest 100000 (- 5) 1) 95000)
)
(defun two-years-with-negative-interest-rate ()
(eq (compound-interest 100000 (- 5) 2) 90250)
)
(defun three-years-with-negative-interest-rate ()
(eq (compound-interest 100000 (- 5) 3) 85737)
)
(defun four-years-with-negative-interest-rate ()
(eq (compound-interest 100000 (- 5) 4) 81450)
)
)
)