Skip to content

Commit

Permalink
dealing with rounding issue when using average
Browse files Browse the repository at this point in the history
  • Loading branch information
rosejn committed Jul 13, 2011
1 parent 8eb8272 commit 41a83bc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
[clojure-protobuf "0.3.4"]
[org.clojars.overtone/vijual "0.2.1"]
[logjam "0.1.0-SNAPSHOT"]]
:dev-dependencies [[marginalia "0.6.0"]]
:tasks [marginalia.tasks])
:dev-dependencies [[marginalia "0.6.0"]])

(import '[java.io File])
(use '[clojure.java.io :only (delete-file)])
Expand Down
2 changes: 1 addition & 1 deletion test/plasma/operator_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
tree-desc (assoc tree :proj avg-desc)]
(enqueue-and-close (:in p1) ROOT-ID)
(Thread/sleep 20)
(is (= (average [0.8 0.3 0.4 0.6]) (first (result tree-desc))))))
(is (= (Math/round (* 100 (average [0.8 0.3 0.4 0.6]))) (Math/round (* 100 (first (result tree-desc))))))))

; TODO: Finish me!
(defn group-by-op-test []
Expand Down
3 changes: 2 additions & 1 deletion test/plasma/query_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
(deftest average-test
(let [q (-> (path [synth [:music :synths :synth]])
(avg 'synth :score))]
(is (= (average [0.8 0.3 0.4 0.6]) (first (query q))))))
(is (= (Math/round (* 100 (average [0.8 0.3 0.4 0.6])))
(Math/round (* 100 (first (query q))))))))

(deftest limit-test
(let [q (limit (path [synth [:music :synths :synth]])
Expand Down

0 comments on commit 41a83bc

Please sign in to comment.