-
Notifications
You must be signed in to change notification settings - Fork 31
/
test_runner.clj
41 lines (39 loc) · 1.38 KB
/
test_runner.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(ns clojure-katas.test-runner
(:require [clojure.test :as t]))
(def problems
'[clojure-katas.sine-angle-test
clojure-katas.arranged-prob-test
clojure-katas.exponential-test
clojure-katas.nth-fibonacci-test
clojure-katas.greatest-common-divisor-test
clojure-katas.reverse-binary-test
clojure-katas.max-prime-factor-test
clojure-katas.pascal-triangle-test
clojure-katas.count-coin-change-test
clojure-katas.procedural-sum-test
clojure-katas.square-root-test
clojure-katas.integral-test
clojure-katas.fixed-point-test
clojure-katas.roman-to-arabic-test
clojure-katas.levenshtein-test])
(defn run-tests
[]
(try
(loop [nses problems]
(when-let [[ns & more] nses]
(and (try
(require ns)
true ; continue
(catch Exception e
(let [mapped-ex (Throwable->map e)]
(if (and
(= "Unimplemented problem" (:cause mapped-ex))
(contains? (:data mapped-ex) :symbol))
(let [sym (-> mapped-ex :data :symbol)]
(println "Current kata to tackle: " sym)
false ; don't continue
)
(throw e)))))
(let [{:keys [error fail]} (t/run-tests ns)]
(= 0 error fail))
(recur more))))))