This module provides a short tutorial on how to use the HTF. It
assumes that you are using GHC for compiling your Haskell code. (It is
possible to use the HTF with other Haskell environments, only the steps
taken to invoke the custom preprocessor of the HTF may differ in
this case.)

When htfpp consumes the source file, it replaces the assertEqual
tokens (and other assert-like tokens, see
Test.Framework.HUnitWrapper) with calls to
assertEqual_, passing
the current location in the file as the first argument. Moreover, the
preprocessor collects all top-level definitions starting with test_
or prop_ in a test suite with name allHTFTests of type TestSuite.

Definitions starting with test_
denote unit tests and must be of type Assertion.
Definitions starting with prop_
denote QuickCheck properties and must be of type T such that
T is an instance of the type class Testable.

To run the tests, use the runTestWithArgs function, which
takes a list of strings and the test.

main =
do args <- getArgs
runTestWithArgs args reverseTests

Here is the skeleton of a .cabal file which you may want to use to
compile the tests.

(To check only specific tests, you can pass commandline
arguments to the program: the HTF then runs only those tests whose name
contain at least one of the commandline arguments as a substring.)

You see that the message for the first failure contains exact location
information, which is quite convenient. Moreover, for the QuickCheck
property Main.reverse, the HTF also outputs a string
represenation of the random generator used to check the property. This
string representation can be used to replay the property. (The replay
feature may not be useful for this simple example but it helps in more
complex scenarios).

To replay a property you simply use the string
representation of the generator to define a new QuickCheck property
with custom arguments: