ZT_VISITOR(3)

✨ zt_visitor β€” interface for discovering test suites and test cases ✨

okay bestie, so this is page 3 of the LOCAL manual, and it's about zt_visitor and its lil buddy zt_visitor_vtab. they're the interface for discovering test suites and test cases πŸ¦‹. part of libzt, iykyk.


🌸 SYNOPSIS 🌸

#include <zt.h>

typedef struct zt_visitor { ... } zt_visitor;

and here's the struct layout, because we're not gatekeeping ✨:

  • void * id β€” the object implementing the interface πŸ’…
  • struct zt_visitor_vtab * vtab β€” the table of interface functions πŸ‘‘

πŸŽ€ DESCRIPTION πŸŽ€

zt_visitor is an interface for exploring test suites and test cases. like, it's how you go poking around inside them πŸ”.

the visitor type gets passed as an argument to all test suites. no exceptions, bestie. test suites can enumerate test cases and other test suites β€” nesting, we love to see it πŸͺ†.

heads up: this is part of the implementation. it is not expected to be implemented by library users. so if you were about to go write your own, put the keyboard down 🫢.

zt_visitor_vtab is an opaque type made up of the functions that define the interface. it's only used internally, so the implementation is private πŸ™ˆ β€” no peeking, no touchies.


πŸ”₯ IMPLEMENTATION NOTES πŸ”₯

  • interface values combine an object pointer with a function table pointer, and they're passed by value ✨
  • an interface can use the NULL pointer as its object pointer if there's no need to refer to any data specific to an instance β€” go off, minimalism πŸ’€
  • but the function table pointer cannot be null, because it's literally the thing that defines the unique aspect of the implementation. so do not. fr fr 🚫

πŸ’– SEE ALSO πŸ’–


⭐ HISTORY ⭐

zt_visitor first appeared in libzt 0.1 πŸŽ€ β€” baby's first release, iconic behaviour, we stan.


πŸ‘‘ AUTHORS πŸ‘‘

Zygmunt Krynicki <me@zygoon.pl> β€” thank you for your service πŸ«‘πŸ’œ


🌈 that's a wrap, bestie! this page came to you from libzt 0.3.1, dated January 12, 2020, and it lives in the LOCAL section of the manual. now go forth and visit some test suites, you absolute main character πŸ’…βœ¨πŸ¦‹