penny- Extensible double-entry accounting system

Safe HaskellNone




Wheat - Penny ledger tests

Wheat helps you build tests to check all the postings in your ledger. Perhaps you want to make sure all the account names are valid, or that your checking account has no unreconciled transactions. With Wheat you can easily build a command line program that will check all the postings in a ledger for you against criteria that you specify.



data WheatConf Source

Record holding all data to configure Wheat.




briefDescription :: String

This is displayed at the beginning of the online help. It should be a one-line description of what this program does--for example, what it checks for.

moreHelp :: [String]

Displayed at the end of the online help. It should be a list of lines, wich each line not terminated by a newline character. It is displayed at the end of the online help.

tests :: [UTCTime -> Test Posting]

The actual tests to run. The UTCTime is the base time. Each test may decide what to do with the base time--for example, the test might say that all postings have to have a date on or before that date. Or the test might just ignore the base time.

indentAmt :: IndentAmt

How many spaces to indent each level in a tree of tests.

verbosity :: Maybe TestVerbosity

If Just, use this verbosity. If Nothing, use the default verbosity provided by the tests themselves.

testPred :: Name -> Bool

Test names are filtered with this function; a test is only run if this function returns True.

stopOnFail :: Bool

If True, then tests will stop running immediately after a single test fails. If False, all tests are always run.

colorToFile :: Bool

Use colors even if stdout is not a file?

baseTime :: UTCTime

Tests may use this date and time as they wish; see tests. Typically you will set this to the current instant.

formatQty :: [LedgerItem] -> Amount Qty -> Text

How to format quantities


eachPostingMustBeTrue :: Name -> Pdct Posting -> Test PostingSource

Passes only if each posting is True.



:: Int

The number of postings that must be true for the test to pass

-> Name 
-> Pdct Posting 
-> Test Posting 

Passes if at least a particular number of postings is True.

Convenience functions

futureFirstsOfTheMonth :: Day -> [Day]Source

A non-terminating list of starting with the first day of the first month following the given day, followed by successive first days of the month.

Running tests



:: Version

Version of the binary

-> (Runtime -> WheatConf) 
-> IO () 

Runs Wheat tests. Prints the result to standard output. Exits unsuccessfully if the user gave bad command line options or if at least a single test failed; exits successfully if all tests succeeded. Shows the version number and exits successfully if that was requested.