From: U-tackya-PC\tackya Date: Sat, 21 Jan 2012 05:30:40 +0000 (+0900) Subject: [1] Somes test were added. X-Git-Url: http://git.osdn.net/view?p=ierope%2Fbitcalc.git;a=commitdiff_plain;h=31d40f2a4d3985b03374822218be2337c78247a2 [1] Somes test were added. --- diff --git a/dynamics/test/math.clj b/dynamics/test/math.clj index 480de46..b253e94 100755 --- a/dynamics/test/math.clj +++ b/dynamics/test/math.clj @@ -82,6 +82,15 @@ 2 1) 4))) +(deftest test-tfassoc + (is (= (mt/tfassoc 2 '[] #(* % 3)) + 6)) + (is (= (mt/tfassoc '[up 0 [up 1 2] [down 3 4]] + '[2 1] + #(+ % 4)) + '[up 0 [up 1 2] [down 3 8]] + ))) + (deftest test-t+2 (is (= (mt/t+2 1 2) 3)) (is (= (mt/t+2 '[up 1 2 3] @@ -167,14 +176,37 @@ '[up 16 22] ))) -(deftest test-jaco - (binding [mt/*dxi* 0.5] - (is (= (mt/jaco (fn [[x y]] - [(* 2 x y) - (+ (* 5 x) (* 3 y)) - ]) - [1 2]) - [[4 2] [5 3]])))) +(deftest test-partial-val + (is (= (binding [mt/*dx* 0.5] + (mt/partial-val (fn [x] (* 4 x)) + [] + 3 + )) + 4 + )) + (is (= (binding [mt/*dx* 0.5] + (mt/partial-val (fn [[_ x y]] + ['up + (* 2 x y) + (+ (* 5 x) (* 3 y)) + ]) + [0] + ['up 1 2] + )) + ['up 4 5] + )) + (is (= (binding [mt/*dx* 0.5] + (mt/partial-val (fn [[_ x y]] + ['up + (* 2 x y) + (+ (* 5 x) (* 3 y)) + ]) + [] + ['up 1 2] + )) + ['down ['up 4 5] + ['up 2 3] + ]))) (run-tests)