use super::*;
#[test]
fn resident_fixed_point_families_expose_shared_sequence_window_path() {
let helper = read_source("src/fixed_point_resident_sequence.rs");
assert!(
helper.contains("dispatch_resident_repeated_sequence_read_ranges_into"),
"shared resident sequence-window helper must batch fixed-point windows behind the backend repeated-sequence API"
);
assert!(
helper.contains("previous_frontier_bytes"),
"shared resident sequence-window helper must read final and previous frontiers for convergence instead of polling every iteration"
);
for (relative, api) in RESIDENT_SEQUENCE_WINDOW_APIS {
let source = read_source(relative);
let body = function_body(&source, api);
assert!(
body.contains("run_resident_sequence_window_into"),
"{relative}::{api} must delegate to the shared sequence-window helper; Fix: avoid per-analysis copies of the CUDA resident hot-loop"
);
assert!(
!body.contains("for _ in 0..max_iterations"),
"{relative}::{api} must not reintroduce host-polling fixed-point loops"
);
}
}
#[test]
fn resident_plan_facades_expose_sequence_window_path_for_owned_and_borrowed_graphs() {
for (relative, api) in RESIDENT_SEQUENCE_WINDOW_APIS {
let source = read_source(relative);
assert!(
source.contains(&format!("pub fn {api}")),
"{relative} must expose sequence-window API {api}"
);
}
}
#[test]
fn resident_batch_facade_exposes_sequence_window_path() {
let source = read_source("src/fixed_point_resident_batch/analysis_methods.rs");
for api in RESIDENT_SEQUENCE_WINDOW_BATCH_APIS {
let body = function_body(&source, api);
assert!(
body.contains("sequence_window"),
"FixedPointResidentBatch::{api} must call the resident sequence-window hot path"
);
assert!(
!body.contains("reusing_frontier("),
"FixedPointResidentBatch::{api} must not route through the old host-polling resident frontier facade"
);
}
}
#[test]
fn resident_batch_sequence_window_accepts_prepared_plan_not_split_program_and_graph() {
let source = read_source("src/fixed_point_resident_batch/analysis_methods.rs");
for api in RESIDENT_SEQUENCE_WINDOW_BATCH_APIS {
let signature_start = source
.find(&format!("pub fn {api}"))
.unwrap_or_else(|| panic!("FixedPointResidentBatch::{api} must exist"));
let signature_end = source[signature_start..]
.find(") ->")
.map(|offset| signature_start + offset)
.unwrap_or_else(|| {
panic!("FixedPointResidentBatch::{api} must have a Result signature")
});
let signature = &source[signature_start..signature_end];
assert!(
signature.contains("plan: &FixedPointAnalysisPlan"),
"FixedPointResidentBatch::{api} must accept one prepared FixedPointAnalysisPlan; Fix: keep program and graph paired."
);
assert!(
!signature.contains("program: &vyre::ir::Program")
&& !signature.contains("graph: &FixedPointForwardGraph"),
"FixedPointResidentBatch::{api} must not accept split program/graph parameters that can mismatch."
);
}
}
#[test]
fn resident_batch_sequence_window_accounts_physical_readback_shape() {
let source = read_source("src/fixed_point_resident_batch.rs");
assert!(
source.contains("logical_seed_bytes.checked_mul(2)"),
"resident batch IO accounting must count both frontier_in and frontier_out seed uploads"
);
assert!(
source.contains("record_resident_changed_flag_sequence_window_io"),
"FixedPointResidentBatch must expose changed-flag sequence-window IO accounting for forward closures"
);
assert!(
source.contains("result_words.checked_add(1)"),
"changed-flag sequence-window IO accounting must count final frontier plus one changed flag"
);
assert!(
!source.contains("record_resident_two_frontier_sequence_window_io")
&& !source.contains("result_words.checked_mul(2)"),
"all resident sequence-window families must use changed-flag accounting; final-plus-previous frontier accounting is a regression"
);
let methods = read_source("src/fixed_point_resident_batch/analysis_methods.rs");
for api in RESIDENT_SEQUENCE_WINDOW_BATCH_APIS {
let body = function_body(&methods, api);
assert!(
body.contains("record_resident_changed_flag_sequence_window_io"),
"FixedPointResidentBatch::{api} must use changed-flag physical sequence-window IO accounting"
);
}
}