From: Ramakrishnan Muthukrishnan <vu3rdd@gmail.com>
Date: Wed, 5 May 2010 14:16:51 +0000 (+0530)
Subject: fixed some unit tests
X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/flags/using.html?a=commitdiff_plain;h=6ed861350752ccb6f5bfbf8610207d99e5e8eacf;p=sicp.git

fixed some unit tests
---

diff --git a/src/sicp/ex1_31.clj b/src/sicp/ex1_31.clj
index a1c8dd7..6878fde 100644
--- a/src/sicp/ex1_31.clj
+++ b/src/sicp/ex1_31.clj
@@ -20,16 +20,18 @@
   (prod identity 1 inc n))
 
 (deftest test-factorial-of-6
-  (is (factorial 6) 720))
+  (is (= (factorial 6)
+	 (reduce * (range 1 7)))))
 
 (deftest test-factorial-of-10
-  (is (factorial 10) 3628800))
+  (is (= (factorial 10)
+	 (reduce * (range 1 11)))))
 
 (defn prod-pi [a b]
   (prod #(/ (* % (+ % 2)) (square (+ % 1.0))) a #(+ % 2) b))
 
 (deftest test-pi-2-digits-accuracy
-  (is (> (Math/abs (- 3.14159 (* 4 (prod-pi 2 1000)))) 0.001) true))
+  (is (= (> (Math/abs (- 3.14159 (* 4 (prod-pi 2 1000)))) 0.001) true)))
 
 (defn iter-prod [term a next b result]
   (if (> a b)
@@ -40,4 +42,5 @@
   (iter-prod term a next b 1))
 
 (deftest test-iprod-for-prod-of-1-to-10
-  (is (iprod identity 1 inc 10) (prod identity 1 inc 10)))
+  (is (= (iprod identity 1 inc 10)
+	 (prod identity 1 inc 10))))