Man page - libzt(3)
Packages contains this manual
- zt_pack_boolean(3)
- zt_claim(3)
- zt_location_at(3)
- zt_test(3)
- zt_test_suite_func(3)
- zt_pack_integer(3)
- zt_pack_nothing(3)
- zt_location(3)
- libzt(3)
- zt_test_case_func(3)
- zt_main(3)
- zt_pack_pointer(3)
- zt_value(3)
- zt_visit_test_case(3)
- zt_pack_string(3)
- zt_visitor(3)
- zt_check(3)
- zt_pack_unsigned(3)
- zt_pack_rune(3)
apt-get install libzt-doc
Manual
UNTITLED () LOCAL UNTITLED ()
NAME
libzt — Library for unit testing C
LIBRARY
Library for unit testing C (-lzt)
SYNOPSIS
#include <zt.h>
DESCRIPTION
The libzt library offers routines for writing C unit tests. It is focusing on simplicity, robustness and correctness, offering facilities for:
-
Defining test suites and test cases.
-
Asserting relations between booleans, integers, strings and characters. Asserting properties of booleans and pointers.
-
Creating command line interface that allows enumerating and invoking tests. The output of test programs integrates well with make .
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.
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.
#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);
}
SEE ALSO
zt_main (3), ZT_VISIT_TEST_CASE (3), ZT_VISIT_TEST_SUITE (3), zt_check (3), ZT_CMP_INT (3)
HISTORY
libzt version 0.1 was first released in 2020
AUTHORS
Zygmunt Krynicki < me@zygoon.pl > libzt 0.3.1 January 12, 2020 libzt (3)