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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
.Dd January 12, 2020
.Os libzt @VERSION@
.Dt libzt 3 PRM
.Sh NAME
.Nm libzt
.Nd Library for unit testing C
.Sh LIBRARY
Library for unit testing C (-lzt)
.Sh SYNOPSIS
.In zt.h
.Sh DESCRIPTION
The
.Nm
library offers routines for writing C unit tests. It is focusing on simplicity,
robustness and correctness, offering facilities for:
.Bl -dash
.It
Defining test suites and test cases.
.It
Asserting relations between booleans, integers, strings and characters.
Asserting properties of booleans and pointers.
.It
Creating command line interface that allows enumerating and invoking tests.
The output of test programs integrates well with
.Em make .
.El
.Pp
The library code is portable between a wide range of C compilers and operating
systems. All library code is covered by a self-test test suite. The library
never allocates memory or uses the file system which makes it suitable for
working on embedded targets.
.Sh EXAMPLES
The following fragment demonstrates a simple test program, comprised of a
single test suite with a single test case checking the relations between two
integers.
.Bd -literal -offset indent
#include <zt.h>
static void test_math(zt_t t)
{
zt_check(t, ZT_CMP_INT(2 + 2, ==, 4));
}
static void test_suite(zt_visitor v)
{
ZT_VISIT_TEST_CASE(v, test_math);
}
int main(int argc, char** argv, char** envp)
{
return zt_main(argc, argv, envp, test_suite);
}
.Ed
.Sh SEE ALSO
.Xr zt_main 3 ,
.Xr ZT_VISIT_TEST_CASE 3 ,
.Xr ZT_VISIT_TEST_SUITE 3 ,
.Xr zt_check 3 ,
.Xr ZT_CMP_INT 3
.Sh HISTORY
.Nm
version 0.1 was first released in 2020
.Sh AUTHORS
.An "Zygmunt Krynicki" Aq Mt me@zygoon.pl
|