Permalink
Browse files

Implement money.amounts/total

  • Loading branch information...
michaelklishin committed Mar 11, 2012
1 parent a0cf17d commit 26892795b3de1dbca15e637aa3c75b9c56b2afc6
Showing with 14 additions and 0 deletions.
  1. +4 −0 src/clojure/clojurewerkz/money/amounts.clj
  2. +10 −0 test/clojurewerkz/money/amounts_test.clj
@@ -24,3 +24,7 @@
(defn zero
[^CurrencyUnit unit]
(Money/zero unit))
+
+(defn total
+ [monies]
+ (Money/total monies))
@@ -44,3 +44,13 @@
CurrencyUnit/USD 0.00M
CurrencyUnit/GBP 0.00M
CurrencyUnit/JPY 0M))
+
+(deftest test-money-total
+ (let [cu CurrencyUnit/EUR
+ a (amount-of cu 15.00)
+ b (of-major cu 10)
+ c (of-minor cu 1300)
+ d (zero cu)
+ t (total [a b c d])]
+ (is (= (.getCurrencyUnit t) cu))
+ (is (= 38.00M (.getAmount t)))))

0 comments on commit 2689279

Please sign in to comment.