more small stuff

This commit is contained in:
Simon Michael 2007-03-09 23:32:00 +00:00
parent 0542e2f2f6
commit dabc30e115
2 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,7 @@
module Ledger
where
import qualified Data.Map as Map
import Utils
import AccountName
import BasicTypes
@ -32,6 +34,9 @@ ledgerTransactionsMatching (acctregexps,descregexps) l =
(concat [filter (matchTransactionDescription r) ts | r <- descregexps])
where ts = ledgerTransactions l
ledgerTransactionsInAccount :: Ledger -> AccountName -> [EntryTransaction]
ledgerTransactionsInAccount l a = ledgerTransactionsMatching (["^" ++ a ++ "$"], []) l
accountNamesFromTransactions :: [EntryTransaction] -> [AccountName]
accountNamesFromTransactions ts = nub $ map account ts

View File

@ -1,6 +1,7 @@
module Tests
where
import qualified Data.Map as Map
import Text.ParserCombinators.Parsec
import Test.QuickCheck
import Test.HUnit
@ -219,6 +220,7 @@ ledger7 = Ledger
}
]
-- utils
assertEqual' e a = assertEqual "" e a