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

View File

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