test cleanup

This commit is contained in:
Simon Michael 2008-11-22 09:23:10 +00:00
parent 86b510917d
commit 10263ac6d9

View File

@ -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.")
,
"canonicaliseAmounts" ~: do
let l = canonicaliseAmounts $ rawLedgerWithAmounts ["1","2.00"]
assertequal [2,2] (rawLedgerPrecisions l) -- use greatest precision everywhere
-- all amounts use the greatest precision
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
[
@ -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 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 . (" "++)