• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

Makefile.amH A D03-May-20221.8 KiB5437

READMEH A D03-May-20221.5 KiB4535

collect.sh.inH A D03-May-20221.3 KiB4624

sscm-test.hH A D03-May-202218 KiB457318

test-alignment.cH A D03-May-20225.5 KiB182120

test-array2list.cH A D03-May-20225.1 KiB15090

test-format.cH A D03-May-2022151.5 KiB3,1412,629

test-gc-protect-stack.cH A D03-May-20227 KiB256167

test-gc-protect.cH A D03-May-20227.9 KiB267170

test-gc.cH A D03-May-20224.4 KiB13474

test-global.cH A D03-May-20223.2 KiB8543

test-length.cH A D03-May-202214.1 KiB346254

test-minishell.cH A D03-May-20222.4 KiB5922

test-storage-compact.cH A D03-May-202210.3 KiB296214

test-storage.cH A D03-May-202215.8 KiB499378

test-strcasecmp.cH A D03-May-20225.6 KiB12682

utils.cH A D03-May-20222.4 KiB6423

README

1Experimental unittest utilities for tests at the C level.
2
3Using the testing utilities should be straightforward.  Generally, a
4test suite looks like this:
5
6#include "sscm-test.h"
7
8#if 0
9/* Some testing-specific utilities are found in this file. */
10#include "utils.c"
11#endif
12
13
14/* Test cases are declared like this. */
15TST_CASE("example")
16{
17    /* TST_COND (condition, brief explanation); Optionally enclose in
18     * TST_ASSERT() if carrying on upon failure is undesirable. */
19    TST_COND(1, "context");
20
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");
25}
26
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. */
32TST_CASE(func, "eg 2")
33{
34    /* The body can be empty (not that it's useful though). */
35}
36
37Add the program name to Makefile.am with a -coll suffix attached to
38the name.  The main() function will be generated automatically.  If
39you absolutely must write main() yourself, define TST_HAVE_MAIN before
40including sscm-test.h.  Tests will be executed in the order it appears
41in the source file.
42
43If collect.sh is not to be run on the source file, leave out the -coll
44suffix.
45