test(std_dev): cover period/value accessors + warmup/name metadata
Codecov flagged 12 lines in crates/wickra-core/src/indicators/std_dev.rs (file at 89.09%): const accessors period (64-66), value (68-71) and Indicator-impl bodies warmup_period (110-112), name (118-120). None of the existing tests inspected the metadata surface. Add accessors_and_metadata asserting period == 14, warmup_period == 14, name == "StdDev", and value() across both the None (pre-warmup) and Some (post-warmup) branches. std_dev.rs is now at 110/110 lines, no behavioural change.
This commit is contained in:
@@ -131,6 +131,22 @@ mod tests {
|
||||
assert!(matches!(StdDev::new(0), Err(Error::PeriodZero)));
|
||||
}
|
||||
|
||||
/// Cover the const accessors `period` / `value` and the Indicator-impl
|
||||
/// `warmup_period` / `name` methods (lines 64-71, 110-112, 118-120).
|
||||
/// Existing tests only inspect numeric outputs of `update` / `batch`.
|
||||
#[test]
|
||||
fn accessors_and_metadata() {
|
||||
let mut sd = StdDev::new(14).unwrap();
|
||||
assert_eq!(sd.period(), 14);
|
||||
assert_eq!(sd.warmup_period(), 14);
|
||||
assert_eq!(sd.name(), "StdDev");
|
||||
assert_eq!(sd.value(), None);
|
||||
for i in 1..=14 {
|
||||
sd.update(f64::from(i));
|
||||
}
|
||||
assert!(sd.value().is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reference_value() {
|
||||
// StdDev(3) of [2, 4, 6]: mean = 4, variance = (4+0+4)/3 = 8/3.
|
||||
|
||||
Reference in New Issue
Block a user