git.iko.soy/rowtype-yoga/purescript-money
on master help sign in
Test showDiscrete
commit4901d1028799805ca6b76cad96ffe94d92441b7b authorrightfold <rightfold@gmail.com> dateThu 30 Mar 2017, 11:39 (10 years ago) parent35e1aa3
3 files changed+38
bower.json+3 test/Data/Finance/Money.purs+26 test/Main.purs+9
bower.json+3
@@ -10,5 +10,8 @@
1010 "purescript-prelude": "^2.5.0",
1111 "purescript-modules": "^2.1.0",
1212 "purescript-newtype": "^1.3.0"
13+ },
14+ "devDependencies": {
15+ "purescript-test-unit": "^10.1.0"
1316 }
1417}
test/Data/Finance/Money.pursnew file+26
@@ -0,0 +1,26 @@
1+module Test.Data.Finance.Money
2+ ( main
3+ ) where
4+
5+import Data.Finance.Currency (GBP, JPY)
6+import Data.Finance.Money (Discrete(..), showDiscrete)
7+import Prelude
8+import Test.Unit (suite, test)
9+import Test.Unit.Assert as Assert
10+
11+main = suite "Date.Finance.Money" do
12+ test "showDiscrete" do
13+ let gbp s n = Assert.equal s $ showDiscrete (Discrete n :: Discrete GBP)
14+ let jpy s n = Assert.equal s $ showDiscrete (Discrete n :: Discrete JPY)
15+
16+ gbp "0.00" 0
17+ gbp "2.56" 256
18+ gbp "-2.56" (-256)
19+ gbp "21474836.47" top
20+ gbp "-21474836.48" bottom
21+
22+ jpy "0" 0
23+ jpy "256" 256
24+ jpy "-256" (-256)
25+ jpy "2147483647" top
26+ jpy "-2147483648" bottom
test/Main.pursnew file+9
@@ -0,0 +1,9 @@
1+module Test.Main
2+ ( main
3+ ) where
4+
5+import Test.Data.Finance.Money as Data.Finance.Money
6+import Test.Unit.Main (runTest)
7+
8+main = runTest do
9+ Data.Finance.Money.main