git.iko.soy/rowtype-yoga/purescript-money
on master help sign in
Test showDiscrete
4901d10rightfold
bower.json+3
@@ -10,5 +10,8 @@
10 "purescript-prelude": "^2.5.0",
10 "purescript-prelude": "^2.5.0",
11 "purescript-modules": "^2.1.0",
11 "purescript-modules": "^2.1.0",
12 "purescript-newtype": "^1.3.0"
12 "purescript-newtype": "^1.3.0"
13+ },
14+ "devDependencies": {
15+ "purescript-test-unit": "^10.1.0"
13 }
16 }
14}
17}
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