Simplify t-test assertion in unit test for clarity

This commit is contained in:
Palash Tyagi 2025-07-15 01:05:32 +01:00
parent b2f6794e05
commit a335d29347

View File

@ -106,11 +106,7 @@ mod tests {
let sample1 = Matrix::from_vec(vec![1.0, 2.0, 3.0, 4.0, 5.0], 1, 5); let sample1 = Matrix::from_vec(vec![1.0, 2.0, 3.0, 4.0, 5.0], 1, 5);
let sample2 = Matrix::from_vec(vec![6.0, 7.0, 8.0, 9.0, 10.0], 1, 5); let sample2 = Matrix::from_vec(vec![6.0, 7.0, 8.0, 9.0, 10.0], 1, 5);
let (t_statistic, p_value) = t_test(&sample1, &sample2); let (t_statistic, p_value) = t_test(&sample1, &sample2);
assert!( assert!((t_statistic + 5.0).abs() < EPS);
(t_statistic + 5.0).abs() < EPS,
"Expected t-statistic close to -5.0 found: {}",
t_statistic
);
assert!(p_value > 0.0 && p_value < 1.0); assert!(p_value > 0.0 && p_value < 1.0);
} }