penny-lib- Extensible double-entry accounting system - library

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 -> TestTree 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.

passVerbosity :: Verbosity

Verbosity for tests that pass

failVerbosity :: Verbosity

Verbosity for tests that fail

groupPred :: Name -> Bool

Group names are filtered with this function; a group is only run if this function returns True.

testPred :: Name -> Bool

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

showSkippedTests :: Bool

Some tests might be skipped; see testPred. This controls whether you want to see a notification of tests that were skipped. (Does not affect skipped groups; see groupVerbosity for that.)

groupVerbosity :: GroupVerbosity

Show group names? Even if you do not show the names of groups, tests within the group will still be indented.

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.

ledgers :: [String]

Ledger files to read in from disk.


eachPostingMustBeTrue :: Name -> Pdct Posting -> TestTree 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 
-> TestTree 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.