mysten_common::logging

Macro assert_reachable_antithesis

macro_rules! assert_reachable_antithesis {
    ($message:literal$(, $details:expr)?) => { ... };
    ($($rest:tt)*) => { ... };
}
Expand description

Assert that a line of code is reached at least once. The corresponding test property will pass if this macro is ever called. (If it is never called the test property will therefore fail.) This test property will be viewable in the Antithesis SDK: Reachablity assertions group.

ยงExample

use serde_json::{json};
use antithesis_sdk::{assert_reachable, random};

const MAX_ALLOWED: u64 = 100;
let actual = random::get_random() % 120u64;
let details = json!({"max_allowed": MAX_ALLOWED, "actual": actual});
if (actual > MAX_ALLOWED) {
    antithesis_sdk::assert_reachable!("Value in range", &details);
}