HATE: Writing Test Scripts
As with the rest of HATE, test scripts are written in the Tcl programming language. However, writing a test script does not require an in-depth knowledge of Tcl; reading through the following guidelines and looking at an example should be enough to get you going.
A well-formed test script comprises two procedures:
- HATE_DescribeTests writes out a short description (using
HATE_Line to output each line) of the tests contained in the
script.
- HATE_RunTests is used by HATE to actually run the tests. It should consist of a series of invocations of the routine HATE_Test, one for each test. The normal Tcl looping and conditional constructs may be used if required.
Each invocation of HATE_Test should pass the following four arguments:
- the test name, a unique identifier for this particular test; this is used in the production of verbose output
- a value that indicates whether the test is expected to succeed or fail; the values 1 and 0 are normally used for success and failure respectively
- the input to the test program
- the expected output from the test program