test: 100% coverage for cmo + dema + donchian + dpo + ease_of_movement (#23)

* test(cmo): cover period/value accessors + name metadata

Codecov flagged 9 lines in crates/wickra-core/src/indicators/cmo.rs
(file at 92.30%): const accessors period (66-68), value (71-73) and
Indicator-impl name (134-136). cmo.rs now at 117/117.

* test(dema): cover period accessor + warmup/name metadata

Codecov flagged 9 lines in crates/wickra-core/src/indicators/dema.rs
(file at 85.00%): const accessor period (43-45), Indicator-impl
warmup_period (63,65,66) and name (72-74). dema.rs now at 60/60.

* test(donchian): cover period accessor + warmup/name metadata

Codecov flagged 9 lines in crates/wickra-core/src/indicators/donchian.rs
(file at 90.21%): const accessor period (57-59), Indicator-impl
warmup_period (95-97), name (103-105). donchian.rs now at 92/92.

* test(dpo): cover period/value accessors + name metadata

Codecov flagged 9 lines in crates/wickra-core/src/indicators/dpo.rs
(file at 91.74%): const accessors period (73-75), value (83-85) and
Indicator-impl name (132-134). dpo.rs now at 109/109.

* test(ease_of_movement): cover period/divisor accessors + name metadata

Codecov flagged 9 lines in crates/wickra-core/src/indicators/ease_of_movement.rs
(file at 94.15%): const accessors period (83-85), divisor (88-90) and
Indicator-impl name (141-143). ease_of_movement.rs now at 154/154.
This commit is contained in:
kingchenc
2026-05-24 00:47:01 +02:00
committed by GitHub
parent 8582338b5d
commit 5a6689cf1a
5 changed files with 67 additions and 0 deletions
+15
View File
@@ -147,6 +147,21 @@ mod tests {
assert!(matches!(Cmo::new(0), Err(Error::PeriodZero)));
}
/// Cover the const accessors `period` / `value` (66-73) and the
/// Indicator-impl `name` body (134-136). Existing tests inspect
/// CMO output but never query the metadata.
#[test]
fn accessors_and_metadata() {
let mut cmo = Cmo::new(14).unwrap();
assert_eq!(cmo.period(), 14);
assert_eq!(cmo.name(), "CMO");
assert_eq!(cmo.value(), None);
for i in 1..=15 {
cmo.update(f64::from(i));
}
assert!(cmo.value().is_some());
}
#[test]
fn reference_value() {
// CMO(3) over [10, 11, 10, 12]: changes +1, 1, +2.