logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

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

Authors

       Zygmunt Krynicki <me@zygoon.pl>

libzt 0.3.1                                     January 12, 2020                                     zt_value(3)

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.

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.

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.

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.

Name

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

See Also

zt_visit_test_case(3), zt_visit_test_suite(3)

Synopsis

#include<zt.h>typedefstructzt_value{...}zt_value;TypeEntryDescriptionzt_value_kind     kind                 Discriminator for the union
       constchar*      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
       constchar*      as.string            Value when used as ZT_STRING
       constvoid*      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

       typedefenumzt_value_kind{...}zt_value_kind;KindDescriptionZT_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

See Also