use crate::{PrepareConfig, Tensor};
pub trait RealizeTestExt {
fn realize_with_and(&mut self, config: &PrepareConfig) -> &Self;
}
impl RealizeTestExt for Tensor {
fn realize_with_and(&mut self, config: &PrepareConfig) -> &Self {
self.realize_with(config).unwrap();
self
}
}
pub fn test_setup() {
svod_runtime::kernel_cache::clear_all();
}
#[track_caller]
pub fn assert_close_f32(actual: &[f32], expected: &[f32], tol: f32) {
assert_eq!(actual.len(), expected.len(), "Length mismatch: {} != {}", actual.len(), expected.len());
for (i, (a, e)) in actual.iter().zip(expected).enumerate() {
assert!((a - e).abs() < tol, "Mismatch at index {}: {} != {} (diff: {})", i, a, e, (a - e).abs());
}
}