test: 100% coverage for mom + sma + stoch_rsi + tema + trima (#25)
* test(mom): cover period/value accessors + name metadata Codecov flagged 9 lines in indicators/mom.rs (file at 89.53%): const accessors period (56-58), value (61-63) and Indicator-impl name (101-103). mom.rs now at 86/86. * test(sma): cover period accessor + warmup/name metadata Codecov flagged 9 lines in indicators/sma.rs (file at 93.12%): const accessor period (70-72), Indicator-impl warmup_period (115-117), name (123-125). sma.rs now at 131/131. * test(stoch_rsi): cover periods/value accessors + name metadata Codecov flagged 9 lines in indicators/stoch_rsi.rs (file at 92.37%): const accessors periods (69-71), value (74-76) and Indicator-impl name (131-133). stoch_rsi.rs now at 118/118. * test(tema): cover period accessor + warmup/name metadata Codecov flagged 9 lines in indicators/tema.rs (file at 83.63%): const accessor period (45-47), Indicator-impl warmup_period (67-69), name (75-77). tema.rs now at 55/55. * test(trima): cover period/value accessors + name metadata Codecov flagged 9 lines in indicators/trima.rs (file at 89.53%): const accessors period (59-61), value (64-66) and Indicator-impl name (99-101). trima.rs now at 86/86.
This commit is contained in:
@@ -117,4 +117,16 @@ mod tests {
|
||||
fn rejects_zero_period() {
|
||||
assert!(Tema::new(0).is_err());
|
||||
}
|
||||
|
||||
/// Cover the const accessor `period` (45-47) and the Indicator-impl
|
||||
/// `warmup_period` (67-69) + `name` (75-77). Existing tests inspect
|
||||
/// TEMA output but never query the metadata.
|
||||
#[test]
|
||||
fn accessors_and_metadata() {
|
||||
let tema = Tema::new(5).unwrap();
|
||||
assert_eq!(tema.period(), 5);
|
||||
// EMA1 seeds at period (5), each cascade stage needs another (period-1) inputs.
|
||||
assert_eq!(tema.warmup_period(), 3 * 5 - 2);
|
||||
assert_eq!(tema.name(), "TEMA");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user