Macro antithesis_sdk::assert_sometimes

source ·
macro_rules! assert_sometimes {
    ($condition:expr, $message:literal, $details:expr) => { ... };
}
Expand description

Assert that condition is true at least one time that this function was called. (If the assertion is never encountered, the test property will therefore fail.) This test property will be viewable in the Antithesis SDK: Sometimes group.

§Example

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

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