test: 100% coverage for tsi + ultimate_oscillator + vortex + vwma + zlema (#26)
* test(tsi): cover periods/value accessors + name metadata Codecov flagged 9 lines in indicators/tsi.rs (file at 92.30%): const accessors periods (70-72), value (75-77) and Indicator-impl name (137-139). tsi.rs now at 117/117. * test(ultimate_oscillator): cover periods/value accessors + name metadata Codecov flagged 9 lines in indicators/ultimate_oscillator.rs (file at 94.76%): const accessors periods (96-98), value (101-103) and Indicator-impl name (193-195). uo.rs now at 172/172. * test(vortex): cover period/value accessors + name metadata Codecov flagged 9 lines in indicators/vortex.rs (file at 93.18%): const accessors period (84-86), value (89-91) and Indicator-impl name (157-159). vortex.rs now at 132/132. * test(vwma): cover period/value accessors + name metadata Codecov flagged 9 lines in indicators/vwma.rs (file at 92.56%): const accessors period (72-74), value (77-79) and Indicator-impl name (129-131). vwma.rs now at 121/121. * test(zlema): cover period/value accessors + name metadata Codecov flagged 9 lines in indicators/zlema.rs (file at 90.62%): const accessors period (62-64), value (72-74) and Indicator-impl name (111-113). zlema.rs now at 96/96.
This commit is contained in:
@@ -147,6 +147,22 @@ mod tests {
|
||||
assert!(matches!(Vwma::new(0), Err(Error::PeriodZero)));
|
||||
}
|
||||
|
||||
/// Cover the const accessors `period` / `value` (72-79) and the
|
||||
/// Indicator-impl `name` body (129-131). Existing tests inspect
|
||||
/// VWMA output but never query the metadata.
|
||||
#[test]
|
||||
fn accessors_and_metadata() {
|
||||
let mut v = Vwma::new(5).unwrap();
|
||||
assert_eq!(v.period(), 5);
|
||||
assert_eq!(v.name(), "VWMA");
|
||||
assert_eq!(v.value(), None);
|
||||
for i in 1..=5i64 {
|
||||
let p = 100.0 + i as f64;
|
||||
v.update(Candle::new(p, p, p, p, 1.0, i).unwrap());
|
||||
}
|
||||
assert!(v.value().is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reference_value() {
|
||||
// VWMA(2): (10·1 + 20·3) / (1 + 3) = 70 / 4 = 17.5.
|
||||
|
||||
Reference in New Issue
Block a user