CLUnit

Macro DEFTEST

Syntax:

deftest description &key category test-fn compare-fn output-fn output-form input-fn input-form => test

Arguments and Values:

description---a string

category---a string

test-fn---a function

compare-fn---a function

output-fn---a function

output-form---a form

input-fn---a function

input-form---a form

Description:

deftest defines a test to be run by CLUnit. The test is automatically registered with CLUnit and is afterwards available to be run by CLUnit.

The test is identified by its description, but the user can also specify a category into which the test is to be placed. All tests from a given category can be run using the function run-category. In addition, a specific test or all tests can be run using the functions run-named-test or run-all-tests respectively.

In addition to its identification and categorization attributes, a test also has four functional attributes: its input function, its test function, its output function, and its comparison function. These attributes are used when the test is run to determine whether the test has passed or failed.

The test is run using the following procedure:

  1. The input function of the test is evaluated to provide a set of values, collected by multiple-value-list.
  2. The test's test function is applied to values returned by the input function and the resulting set of output values is collected using multiple-value-list.
  3. The output function of the test is evaluated to give a set of values that are also collected using multiple-value-list.
  4. The test's comparison function is used to compare the lists resulting from the evaluation of the test function and output function.
  5. The output of the comparison function is returned as the value of the test.

If the comparison function returns t, the test is said to have passed. If the test returns nil or an error is encountered while running the test, the test has failed.

In addition to its description parameter, deftest will accept a variety of other keyword parameters:

See Also:

run-named-test, run-all-tests, run-category, remove-test

Notes:

Redefining a test with a given name will replace the original test with the new one.

Redefining a test with a given name will move the test to the category specified in the redefinition.


Valid HTML 3.2! Frank A. Adrian
Last modified: 12 July, 2001 14:59