| zt_value(3) | Library Functions Manual (prm) | zt_value(3) |
zt_value,
zt_value_kind, — variant
type for passing data into claim verifiers
#include
<zt.h>
typedef struct zt_value { ... } zt_value;
| Type | Entry | Description |
| zt_value_kind | kind | Discriminator for the union |
| const char * | source | Source code used to compute the value |
| union { ... } | as | Union containing the actual value |
| bool | as.boolean | Value when used as ZT_BOOLEAN |
| int | as.integer | Value when used as ZT_INTEGER |
| unsigned | as.unsigned_integer | Value when used as ZT_UNSIGNED |
| int | as.rune | Value when used as ZT_RUNE |
| const char * | as.string | Value when used as ZT_STRING |
| const void * | as.pointer | Value when used as ZT_POINTER |
| intmax_t | as.intmax | Value when used as ZT_INTMAX |
| uintmax_t | as.uintmax | Value when used as ZT_UINTMAX |
typedef enum zt_value_kind { ... } zt_value_kind;
| Kind | Description |
| ZT_NOTHING | Placeholder for unused values |
| ZT_BOOLEAN | zt_value.as.boolean is valid |
| ZT_INTEGER | zt_value.as.integer is valid (deprecated) |
| ZT_UNSIGNED | zt_value.as.unsigned_integer is valid (deprecated) |
| ZT_RUNE | zt_value.as.rune is valid |
| ZT_STRING | zt_value.as.string is valid |
| ZT_POINTER | zt_value.as.pointer is valid |
| ZT_INTMAX | zt_value.as.intmax is valid |
| ZT_UINTMAX | zt_value.as.uintmax is valid |
zt_value is a variant-like type that is
used to pass values around libzt internals. It is comprised of the
kind
enumeration, the
as union as
well as the
source
string.
zt_value_kind describes type of
verification function arguments.
zt_value exists to pass packed values of
several types from the test source code, through the
zt_claim type and into private verification
functions that determine test outcome.
Tests using binary relations encode the operator as an argument of kind ZT_STRING.
On some architectures ZT_INTEGER and
ZT_UNSIGNED are too short to handle
size_t and ssize_t values
correctly. They are now deprecated and automatically promoted to
ZT_INTMAX and ZT_UINTMAX
respectively.
zt_value and
zt_value_kind first appeared in libzt 0.1
ZT_INTMAX,
ZT_UINTMAX and the corresponding union members first
appeared in libzt 0.3.
Zygmunt Krynicki <me@zygoon.pl>
| January 12, 2020 | libzt 0.3.1 |