File: README

package info (click to toggle)
sigscheme 0.8.3-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 9,672 kB
  • ctags: 7,108
  • sloc: lisp: 37,498; ansic: 30,947; sh: 9,257; makefile: 791; asm: 333; ruby: 288
file content (44 lines) | stat: -rw-r--r-- 1,505 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Experimental unittest utilities for tests at the C level.

Using the testing utilities should be straightforward.  Generally, a
test suite looks like this:

#include "sscm-test.h"

#if 0
/* Some testing-specific utilities are found in this file. */
#include "utils.c"
#endif


/* Test cases are declared like this. */
TST_CASE("example")
{
    /* TST_COND (condition, brief explanation); Optionally enclose in
     * TST_ASSERT() if carrying on upon failure is undesirable. */
    TST_COND(1, "context");

    /* TST_EQ_<type> (expected, actual, brief explanation);
     * <type> can be one of INT, PTR, STR, FPTR, or OBJ.
     * For now, equality testers can't be put inside TST_ASSERT(). */
    TST_EQ_INT(6, 5 + 1, "context 2");
}

/* The function name is optional.  Specifying one can aid in setting
 * breakpoints in a debugger, but always doing so is a pain
 * (especially since failed tests report the line number).  If
 * omitted, the function name will be tst_<n> where <n> is the number
 * of tests preceding this one + 1. */
TST_CASE(func, "eg 2")
{
    /* The body can be empty (not that it's useful though). */
}

Add the program name to Makefile.am with a -coll suffix attached to
the name.  The main() function will be generated automatically.  If
you absolutely must write main() yourself, define TST_HAVE_MAIN before
including sscm-test.h.  Tests will be executed in the order it appears
in the source file.

If collect.sh is not to be run on the source file, leave out the -coll
suffix.