2018-03-26 01:25:33 +00:00
|
|
|
# Helper code for running tests
|
|
|
|
|
|
|
|
(var num-tests-passed 0)
|
|
|
|
(var num-tests-run 0)
|
|
|
|
(var suite-num 0)
|
|
|
|
|
|
|
|
(defn assert [x e]
|
|
|
|
(++ num-tests-run)
|
|
|
|
(when x (++ num-tests-passed))
|
|
|
|
(print (if x
|
|
|
|
" \e[32m✔\e[0m "
|
|
|
|
" \e[31m✘\e[0m ") e)
|
|
|
|
x)
|
|
|
|
|
|
|
|
(defn start-suite [x]
|
2018-12-17 02:57:32 +00:00
|
|
|
(set suite-num x)
|
2018-03-26 01:25:33 +00:00
|
|
|
(print "\nRunning test suite " x " tests...\n"))
|
|
|
|
|
|
|
|
(defn end-suite []
|
|
|
|
(print "\nTest suite " suite-num " finished.")
|
|
|
|
(print num-tests-passed " of " num-tests-run " tests passed.\n")
|
2018-12-01 03:49:21 +00:00
|
|
|
(if (not= num-tests-passed num-tests-run) (os/exit 1)))
|