moonpool_assertions/lib.rs
1//! Portable assertion accounting for the moonpool framework.
2//!
3//! This is the Antithesis-style assertion suite — boolean (always / sometimes /
4//! reachable / unreachable), numeric guidance with watermarks, compound
5//! sometimes-all with frontier tracking, and per-value `sometimes_each` buckets —
6//! factored out of `moonpool-explorer` so it has **zero dependencies** and
7//! compiles on `wasm32-unknown-unknown`, macOS, and Linux.
8//!
9//! # How it relates to exploration
10//!
11//! The counts live in a region of memory. By default [`init`] allocates that
12//! region on the heap (single process — wasm, macOS, plain native test runs).
13//! `moonpool-explorer` instead allocates a `MAP_SHARED` region and hands it to
14//! [`install_region`], so the same accounting is visible across `fork`ed
15//! children, and installs a [`DiscoveryHooks`] that turns "a new assertion state
16//! was reached" into coverage marking and fork dispatch. With no hooks installed
17//! the accounting is pure: assertions still record pass/fail/watermark/frontier,
18//! which is all the `UntilCoverageStable` stop condition and contract
19//! validation need.
20//!
21//! See [`hooks`] for the coupling surface and [`region`] for the storage model.
22
23#![deny(missing_docs)]
24
25pub mod buckets;
26pub mod hooks;
27pub mod region;
28pub mod slots;
29
30pub use buckets::{
31 EACH_BUCKET_MEM_SIZE, EachBucket, MAX_EACH_BUCKETS, assertion_sometimes_each,
32 each_bucket_read_all, unpack_quality,
33};
34pub use hooks::{DiscoveryHooks, clear_discovery_hooks, set_discovery_hooks};
35pub use region::{
36 assertion_table_ptr, clear, each_bucket_ptr, init, install_region, prepare_next_seed_reset,
37 reset,
38};
39pub use slots::{
40 ASSERTION_TABLE_MEM_SIZE, AssertCmp, AssertKind, AssertionSlot, AssertionSlotSnapshot,
41 MAX_ASSERTION_SLOTS, assertion_bool, assertion_numeric, assertion_read_all,
42 assertion_sometimes_all, msg_hash,
43};