#[test]
fn resident_fixed_point_hot_benchmark_excludes_setup_from_measured_loop() {
let src = include_str!("../benches/resident_fixed_point_hot_path.rs");
let hot_section = src
.split("resident_fixed_point_hot_cached_graph")
.nth(1)
.and_then(|tail| tail.split("resident_fixed_point_cold_graph_upload").next())
.expect("resident hot benchmark section must remain discoverable");
assert!(
hot_section.contains("hot resident batch warm-up"),
"resident hot benchmark must warm graph/frontier residency before the measured loop"
);
assert!(
hot_section.contains("reaching_sequence_window"),
"resident hot benchmark must measure the CUDA-style sequence-window resident path, not the host-polling resident frontier path"
);
assert!(
!hot_section.contains(".reaching(&backend"),
"resident hot benchmark must not route through FixedPointResidentBatch::reaching because that path can poll frontiers per iteration"
);
assert!(
hot_section.contains("b.iter(||"),
"resident hot benchmark must measure the steady-state loop directly"
);
assert!(
!hot_section.contains("iter_batched"),
"resident hot benchmark must not use iter_batched because that measures setup/allocation"
);
assert!(
!hot_section
.split("b.iter(||")
.nth(1)
.unwrap_or_default()
.contains("FixedPointResidentBatch::new"),
"resident hot benchmark must not construct the batch inside the measured loop"
);
}
#[test]
fn resident_flow_benchmarks_expose_release_evidence_fields() {
for (name, src) in [
(
"resident_fixed_point_hot_path",
include_str!("../benches/resident_fixed_point_hot_path.rs"),
),
(
"ifds_direct_resident_hot_path",
include_str!("../benches/ifds_direct_resident_hot_path.rs"),
),
] {
for field in [
"ResidentBenchmarkEvidence",
"backend_id",
"device_signature",
"source_fingerprint",
"output_digest",
"upload_transfer_bytes",
"readback_transfer_bytes",
] {
assert!(
src.contains(field),
"{name} must expose `{field}` for weir-matrix resident benchmark evidence"
);
}
}
}