test: 100% coverage for keltner + linreg + linreg_slope + macd + super_trend (#30)

* test(keltner): cover periods accessor + name metadata

Codecov flagged 6 lines (file at 95.23%): periods (68-70) + name (106-108).

* test(linreg): cover period accessor + name metadata

Codecov flagged 6 lines (file at 96.10%): period (92-94) + name (142-144).

* test(linreg_slope): cover period accessor + name metadata

Codecov flagged 6 lines (file at 95.91%): period (80-82) + name (125-127).

* test(macd): cover periods/value accessors + name metadata

Codecov flagged 6 lines (file at 95.45%): periods (81-83) + name (135-137).

* test(super_trend): cover params accessor + name metadata

Codecov flagged 6 lines (file at 96.36%): params (99-101) + name (176-178).
This commit is contained in:
kingchenc
2026-05-24 00:47:59 +02:00
committed by GitHub
parent 8f6ffe5a62
commit 512bbf75c4
5 changed files with 57 additions and 0 deletions
@@ -162,6 +162,19 @@ mod tests {
assert!(Keltner::new(20, 10, -1.0).is_err());
}
/// Cover the const accessor `periods` (68-70) and the Indicator-impl
/// `name` body (106-108). Existing tests inspect band output but
/// never query the metadata.
#[test]
fn accessors_and_metadata() {
let k = Keltner::new(20, 10, 2.0).unwrap();
let (ema, atr, mult) = k.periods();
assert_eq!(ema, 20);
assert_eq!(atr, 10);
assert!((mult - 2.0).abs() < 1e-12);
assert_eq!(k.name(), "KeltnerChannels");
}
#[test]
fn reset_clears_state() {
let candles: Vec<Candle> = (0..50)