1
This directory is existing for unit testing for C. See doc/test-c.txt for
1
Experimental unittest utilities for tests at the C level.
3
Using the testing utilities should be straightforward. Generally, a
4
test suite looks like this:
9
/* Some testing-specific utilities are found in this file. */
14
/* Test cases are declared like this. */
17
/* TST_COND (condition, brief explanation); Optionally enclose in
18
* TST_ASSERT() if carrying on upon failure is undesirable. */
19
TST_COND(1, "context");
21
/* TST_EQ_<type> (expected, actual, brief explanation);
22
* <type> can be one of INT, PTR, STR, FPTR, or OBJ.
23
* For now, equality testers can't be put inside TST_ASSERT(). */
24
TST_EQ_INT(6, 5 + 1, "context 2");
27
/* The function name is optional. Specifying one can aid in setting
28
* breakpoints in a debugger, but always doing so is a pain
29
* (especially since failed tests report the line number). If
30
* omitted, the function name will be tst_<n> where <n> is the number
31
* of tests preceding this one + 1. */
32
TST_CASE(func, "eg 2")
34
/* The body can be empty (not that it's useful though). */
37
Add the program name to Makefile.am with a -coll suffix attached to
38
the name. The main() function will be generated automatically. If
39
you absolutely must write main() yourself, define TST_HAVE_MAIN before
40
including sscm-test.h. Tests will be executed in the order it appears
43
If collect.sh is not to be run on the source file, leave out the -coll