diff --git a/test/propeller/tools/calculus_test.cljc b/test/propeller/tools/calculus_test.cljc index 6300479..a130373 100644 --- a/test/propeller/tools/calculus_test.cljc +++ b/test/propeller/tools/calculus_test.cljc @@ -1,9 +1,8 @@ (ns propeller.tools.calculus-test (:require [clojure.test :as t] [propeller.tools.calculus :as c])) -(t/deftest deriv_test +(t/deftest deriv-test (t/is (letfn [(cubic [x] (let [a (double x)] (* a a a)))] - (< (max (- (c/deriv cubic 2) 12) (- (- (c/deriv cubic 2) 12))) 0.001) - ) - ) + (< (max (- (c/deriv cubic 2) 12) (- (- (c/deriv cubic 2) 12))) 0.001))) ) + diff --git a/test/propeller/tools/character_test.cljc b/test/propeller/tools/character_test.cljc new file mode 100644 index 0000000..2b32d9f --- /dev/null +++ b/test/propeller/tools/character_test.cljc @@ -0,0 +1,20 @@ +(ns propeller.tools.character-test + (:require [clojure.test :as t] + [propeller.tools.character :as c])) +(t/deftest get-ascii-test + (t/is (= 97 (c/get-ascii (first "abc"))))) + +(t/deftest is-letter-test + (t/is (c/is-letter (first "abc"))) + ;(t/is (= false (c/is-letter 97))) + ) + +(t/deftest is-digit-test + (t/is (c/is-digit (first "545"))) + (t/is (c/is-digit (char \5)))) + +(t/deftest is-whitespace-test + (t/is (c/is-whitespace (char \tab))) + (t/is (c/is-whitespace (first " hello"))) + (t/is (c/is-whitespace (char \newline))) + ) diff --git a/test/propeller/tools/math_test.cljc b/test/propeller/tools/math_test.cljc new file mode 100644 index 0000000..4f35ebb --- /dev/null +++ b/test/propeller/tools/math_test.cljc @@ -0,0 +1,24 @@ +(ns propeller.tools.math-test + (:require [clojure.test :as t] + [propeller.tools.math :as m])) +(t/deftest not-lazy-test + (t/is (= 1 (m/abs -1))) + (t/is (= 1 (m/abs 1))) + (t/is (= 0 (m/abs 0)))) + +(t/deftest approx=-test + (t/is (m/approx= 3 5 2)) + (t/is (not (m/approx= 5 3 1.5))) + (t/is (m/approx= -1 -5 9))) + +(t/deftest ceil-test + (t/is (= 5.0 (m/ceil 4.9))) + (t/is (= 5.0 (m/ceil 4.5))) + (t/is (= -10.0 (m/ceil -10.5 )))) + +(t/deftest cos-test + (t/is (= 1.0 (m/cos 0))) + (t/is (= -1.0 (m/cos (* 3 m/PI))))) + +(t/deftest div + (t/is ))