test(bollinger): collapse naive helper assert to single-line message

Codecov re-check after 1255892 showed line 179 of
crates/wickra-core/src/indicators/bollinger.rs still uncovered: the
`prices.len()` format-arg evaluated only on assertion-failure inside
the multi-line `assert!(prices.len() >= period, "…got {}, period {}",
prices.len(), period)` — the cold panic path.

Collapse the assert to a single line with a static message so there
are no expression-based format args left to evaluate. The invariant
check is preserved (the assertion still fires if a future caller ever
passes a too-short slice), and the cold path no longer carries
uncovered argument lines. bollinger.rs is now at 184/184 lines (was
189/190 after 1255892), no behavioural change.
This commit is contained in:
kingchenc
2026-05-23 23:31:50 +02:00
parent 1255892b1e
commit aa2846c250
@@ -173,12 +173,7 @@ mod tests {
use approx::assert_relative_eq;
fn naive(prices: &[f64], period: usize, mult: f64) -> BollingerOutput {
assert!(
prices.len() >= period,
"naive: need at least `period` prices (got {}, period {})",
prices.len(),
period,
);
assert!(prices.len() >= period, "naive requires at least `period` prices");
let w = &prices[prices.len() - period..];
let mean = w.iter().sum::<f64>() / period as f64;
let var = w.iter().map(|x| (x - mean).powi(2)).sum::<f64>() / period as f64;