Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Implement money.amounts/total

  • Loading branch information...
commit 26892795b3de1dbca15e637aa3c75b9c56b2afc6 1 parent a0cf17d
Michael Klishin authored March 11, 2012
4  src/clojure/clojurewerkz/money/amounts.clj
@@ -24,3 +24,7 @@
24 24
 (defn zero
25 25
   [^CurrencyUnit unit]
26 26
   (Money/zero unit))
  27
+
  28
+(defn total
  29
+  [monies]
  30
+  (Money/total monies))
10  test/clojurewerkz/money/amounts_test.clj
@@ -44,3 +44,13 @@
44 44
        CurrencyUnit/USD 0.00M
45 45
        CurrencyUnit/GBP 0.00M
46 46
        CurrencyUnit/JPY 0M))
  47
+
  48
+(deftest test-money-total
  49
+  (let [cu CurrencyUnit/EUR
  50
+        a  (amount-of cu 15.00)
  51
+        b  (of-major  cu 10)
  52
+        c  (of-minor  cu 1300)
  53
+        d  (zero      cu)
  54
+        t  (total [a b c d])]
  55
+    (is (= (.getCurrencyUnit t) cu))
  56
+    (is (= 38.00M (.getAmount t)))))

0 notes on commit 2689279

Please sign in to comment.
Something went wrong with that request. Please try again.