use crate::proof::algebra::checker::support::{
boundary_grid_u32, call_binary, engine_failure_violation, simple_rng, violation,
ZERO_PRODUCT_COUNTEREXAMPLES,
};
use crate::spec::law::{AlgebraicLaw, LawViolation};
use super::witnessed::*;
fn check_bounded_exhaustive(
op_id: &str,
f: fn(&[u8]) -> Vec<u8>,
lo: u32,
hi: u32,
) -> Result<(u64, Option<LawViolation>), LawViolation> {
let mut cases = 0u64;
for a in 0u32..256 {
for b in 0u32..256 {
let ab = call_binary(f, a, b).map_err(|e| engine_failure_violation(op_id, e))?;
cases += 1;
if ab < lo || ab > hi {
return Ok((cases, Some(violation(op_id, "bounded", a, b, 0, ab, lo))));
}
}
}
Ok((cases, None))
}