test(family-10): cover cold paths flagged by codecov (#57)

Add tests that exercise the protective fallbacks reachable via flat or
zero-valued input:

- `CenterOfGravity::zero_window_uses_zero_fallback` — den == 0 branch.
- `EhlersStochastic::flat_window_emits_zero` — range == 0 branch.
- `Mama::flat_input_uses_phase_fallback` and the matching
  `SineWave` variant — `i1` collapses to zero on a constant series.
- `Fama::new_with_valid_limits_constructs_via_mama` exercises the
  `Ok(Self { inner: Mama::new(..)? })` arm that no other test reaches.

Three branches were genuinely unreachable by construction, so the dead
code is removed rather than masked with an attribute:

- `Mama` clamped `alpha > fast_limit` after the lower-bound clamp; the
  upper bound is implied by `delta_phase >= 1` and `alpha = fast / delta_phase`.
- `CyberneticCycle` had a `0.0` fallback after the warmup gate that the
  3-slot ring buffers preclude (`count >= 7` => all five `Some`s).
- `DecyclerOscillator` used a `let-else { return None }` over a pair of
  `Decycler::update` calls that always emit `Some` from the first bar.
This commit is contained in:
kingchenc
2026-05-25 22:32:00 +02:00
committed by GitHub
parent 7a18a26daf
commit b971e671b4
7 changed files with 70 additions and 12 deletions
+13
View File
@@ -109,6 +109,19 @@ mod tests {
));
}
#[test]
fn new_with_valid_limits_constructs_via_mama() {
// `classic()` bypasses `new` by going through `Mama::classic`; this
// test exercises the happy-path `Ok(Self { inner: Mama::new(..)? })`
// arm so the `?` doesn't only collapse to the error path.
let mut fama = Fama::new(0.5, 0.05).expect("valid Mama limits");
assert_eq!(fama.limits(), (0.5, 0.05));
for i in 0..60 {
fama.update(100.0 + (f64::from(i) * 0.3).sin() * 5.0);
}
assert!(fama.value().is_some());
}
#[test]
fn accessors_and_metadata() {
let mut fama = Fama::classic();