Reference

zt_value(3)

variant type for passing data into claim verifiers

NAME

zt_value, zt_value_kind, – variant type for passing data into claim verifiers

SYNOPSIS

#include <zt.h>

typedef struct zt_value { ... } zt_value;

TypeEntryDescription
zt_value_kindkindDiscriminator for the union
const char *sourceSource code used to compute the value
union { ... }asUnion containing the actual value
boolas.booleanValue when used as ZT_BOOLEAN
intas.integerValue when used as ZT_INTEGER
unsignedas.unsigned_integerValue when used as ZT_UNSIGNED
intas.runeValue when used as ZT_RUNE
const char *as.stringValue when used as ZT_STRING
const void *as.pointerValue when used as ZT_POINTER
intmax_tas.intmaxValue when used as ZT_INTMAX
uintmax_tas.uintmaxValue when used as ZT_UINTMAX

typedef enum zt_value_kind { ... } zt_value_kind;

KindDescription
ZT_NOTHINGPlaceholder for unused values
ZT_BOOLEANzt_value.as.boolean is valid
ZT_INTEGERzt_value.as.integer is valid (deprecated)
ZT_UNSIGNEDzt_value.as.unsigned_integer is valid (deprecated)
ZT_RUNEzt_value.as.rune is valid
ZT_STRINGzt_value.as.string is valid
ZT_POINTERzt_value.as.pointer is valid
ZT_INTMAXzt_value.as.intmax is valid
ZT_UINTMAXzt_value.as.uintmax is valid

DESCRIPTION

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.

IMPLEMENTATION NOTES

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.

BUGS

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.

SEE ALSO

zt_visit_test_case(3), zt_visit_test_suite(3)

HISTORY

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.

AUTHORS

Zygmunt Krynicki ⟨[email protected]⟩