Skip to main content

Crate assert_tv

Crate assert_tv 

Source
Expand description

Public crate API for test‑vector based deterministic testing.

See the README for an end‑to‑end walkthrough. At a glance:

  • Use #[derive(TestVectorSet)] to define TestValue<…> fields
  • Parameterize code under test with TV: TestVector
  • In tests, wrap functions with #[test_vec_case] or manually call initialize_tv_case_from_file and finalize_tv_case.

Structs§

TestValue
Descriptor for a single test‑vector value.
TestVecEnv
Internal environment holding the currently loaded and recorded test vectors.
TestVectorActive
Active test‑vector implementation: records, injects, and checks entries.
TestVectorNOP
No‑op test‑vector implementation for production or non‑testing code paths.
TlsEnvGuard
Drop‑guard that keeps the thread‑local test‑vector environment active.

Enums§

TestMode
Execution mode for test vectors.
TestVectorEntryType
Kind of entry stored in a test vector file.
TestVectorFileFormat
File format used to read/write test vector files.

Traits§

TestVector
Core interface toggling between active (capture/validate) and no‑op behavior.
TestVectorMomento
Pluggable serializer/deserializer for a type used in test vectors.
TestVectorSet
Helper trait implemented by #[derive(TestVectorSet)] to construct a struct whose fields are TestValue<…> for the current source location.

Functions§

finalize_tv_case
Finalize the current test‑vector session.
initialize_tv_case_from_file
Create a test‑vector session from the given file and mode.
process_next_entry
Low‑level: process the next observed entry.

Type Aliases§

DynDeserializer
Erased deserializer used by TestValue<T> to restore values from test vectors.
DynSerializer
Erased serializer used by TestValue<T> to persist values in test vectors.

Attribute Macros§

test_vec_case
Attribute macro for tests that use assert_tv test vectors.

Derive Macros§

TestVectorSet
Derive assert_tv::TestVectorSet for a struct of TestValue<…> fields.