Provided by: libzt-doc_0.3.1-4_all
NAME
zt_claim — structure capturing unevaluated assertion
SYNOPSIS
#include <zt.h> typedef struct zt_claim { ... } zt_claim; Type Member Description struct zt_verifier *(*)(void) make_verifier Verifier factory zt_value[3] args verifier arguments zt_location location origin of the claim
DESCRIPTION
zt_claim binds a verifier factory function with concrete arguments. This allows the entire claim to be passed around and evaluated on demand. In case of failure the location where the claim was made can be referenced for construction of error messages.
IMPLEMENTATION NOTES
The verification system is comprised of the following chain of cooperating elements. For example a trivial integer relationship assertion behaves as follows. ZT_CMP_INT(), or another similar macro, invokes zt_cmp_int(), providing source code location as zt_location, and packaging specific types into common variant type zt_value. The result is a zt_claim which is then passed to zt_assert() or zt_check() for evaluation. The roles of all the essential types and functions is summarized below. • zt_value captures values expressed in a test case • zt_claim transports up to three values and an opaque verifier • zt_check() and zt_assert() validate the claim by instantiating zt_verifier. • zt_verifier (private) wraps a verification function, including the arity and expected kind of each argument. • zt_arg_info (private) pairs expected argument kind with a customized error message used on kind mismatch. • zt_verify_claim() (private) ensures verifier function arity and argument kind matches what is encoded in the claim and invokes the verifier function. • The specific verifier function inspects the argument and performs the actual verification of the desired property that the test is measuring. • zt_test (private) keeps track of test outcome, provides a stream for writing error messages and assists in performing non-local exit.
SEE ALSO
zt_assert(3), zt_check(3)
HISTORY
zt_claim first appeared in libzt 0.1
BUGS
Part of the API is private which prevents third party verification functions from being written. This is done on purpose to to allow for some more experimentation before stabilizing the interface.
AUTHORS
Zygmunt Krynicki <me@zygoon.pl>