test cleanup
This commit is contained in:
parent
86b510917d
commit
10263ac6d9
21
Tests.hs
21
Tests.hs
@ -87,17 +87,10 @@ misc_tests = TestList [
|
|||||||
assertparseequal (Mixed [Amount (Commodity {symbol="$",side=L,spaced=False,comma=False,precision=0}) 1 Nothing]) (parsewith transactionamount " $1.")
|
assertparseequal (Mixed [Amount (Commodity {symbol="$",side=L,spaced=False,comma=False,precision=0}) 1 Nothing]) (parsewith transactionamount " $1.")
|
||||||
,
|
,
|
||||||
"canonicaliseAmounts" ~: do
|
"canonicaliseAmounts" ~: do
|
||||||
let l = canonicaliseAmounts $ rawLedgerWithAmounts ["1","2.00"]
|
-- all amounts use the greatest precision
|
||||||
assertequal [2,2] (rawLedgerPrecisions l) -- use greatest precision everywhere
|
assertequal [2,2] (rawLedgerPrecisions $ canonicaliseAmounts $ rawLedgerWithAmounts ["1","2.00"])
|
||||||
|
|
||||||
] where
|
]
|
||||||
rawLedgerWithAmounts as =
|
|
||||||
RawLedger
|
|
||||||
[]
|
|
||||||
[]
|
|
||||||
[nullentry{etransactions=[nullrawtxn{tamount=parse a}]} | a <- as]
|
|
||||||
""
|
|
||||||
where parse = fromparse . parsewith transactionamount . (" "++)
|
|
||||||
|
|
||||||
balancereportacctnames_tests = TestList
|
balancereportacctnames_tests = TestList
|
||||||
[
|
[
|
||||||
@ -600,3 +593,11 @@ tlistconcat = foldr (\(TestList as) (TestList bs) -> TestList (as ++ bs)) (TestL
|
|||||||
assertparseequal :: (Show a, Eq a) => a -> (Either ParseError a) -> Assertion
|
assertparseequal :: (Show a, Eq a) => a -> (Either ParseError a) -> Assertion
|
||||||
assertparseequal expected parsed = either printParseError (assertequal expected) parsed
|
assertparseequal expected parsed = either printParseError (assertequal expected) parsed
|
||||||
|
|
||||||
|
rawLedgerWithAmounts as =
|
||||||
|
RawLedger
|
||||||
|
[]
|
||||||
|
[]
|
||||||
|
[nullentry{edescription=a,etransactions=[nullrawtxn{tamount=parse a}]} | a <- as]
|
||||||
|
""
|
||||||
|
where parse = fromparse . parsewith transactionamount . (" "++)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user