---
name: "zt_claim"
section: "3"
platform: "linux"
package: "libzt-doc"
version: "0.3.1-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/zt_claim"
---

# zt\_claim(3)

structure capturing unevaluated assertion

## 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)](/zt_check/3.md)

## 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*⟩
