2017-02-14 16:55:48 -05:00
|
|
|
(load "unit-test.lisp")
|
|
|
|
(load "compound-interest.lisp")
|
|
|
|
|
|
|
|
(unit
|
|
|
|
(list
|
|
|
|
|
|
|
|
(defun many-years-with-no-interest-rate ()
|
2017-02-15 09:29:57 -05:00
|
|
|
(assert= 100000 (compound-interest 100000 0 10))
|
2017-02-14 16:55:48 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
(defun no-years-with-positive-interest-rate ()
|
2017-02-15 09:29:57 -05:00
|
|
|
(assert= 100000 (compound-interest 100000 10 0))
|
2017-02-14 16:55:48 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
(defun one-year-with-positive-interest-rate ()
|
2017-02-15 09:29:57 -05:00
|
|
|
(assert= 105000 (compound-interest 100000 5 1))
|
2017-02-14 16:55:48 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
(defun two-years-with-positive-interest-rate ()
|
2017-02-15 09:29:57 -05:00
|
|
|
(assert= 110250 (compound-interest 100000 5 2))
|
2017-02-14 16:55:48 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
(defun three-years-with-positive-interest-rate ()
|
2017-02-15 09:29:57 -05:00
|
|
|
(assert= 115763 (compound-interest 100000 5 3))
|
2017-02-14 16:55:48 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
(defun four-years-with-positive-interest-rate ()
|
2017-02-15 09:29:57 -05:00
|
|
|
(assert= 121551 (compound-interest 100000 5 4))
|
2017-02-14 16:55:48 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
(defun one-year-with-negative-interest-rate ()
|
2017-02-27 13:34:04 -05:00
|
|
|
(assert= 95000 (compound-interest 100000 -5 1))
|
2017-02-14 16:55:48 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
(defun two-years-with-negative-interest-rate ()
|
2017-02-27 13:34:04 -05:00
|
|
|
(assert= 90250 (compound-interest 100000 -5 2))
|
2017-02-14 16:55:48 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
(defun three-years-with-negative-interest-rate ()
|
2017-02-27 13:34:04 -05:00
|
|
|
(assert= 85737 (compound-interest 100000 -5 3))
|
2017-02-14 16:55:48 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
(defun four-years-with-negative-interest-rate ()
|
2017-02-27 13:34:04 -05:00
|
|
|
(assert= 81450 (compound-interest 100000 -5 4))
|
2017-02-14 16:55:48 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|