From 250b75d468bb3bfb8c31aaee49d7dd9abca55000 Mon Sep 17 00:00:00 2001 From: kingchenc Date: Sun, 24 May 2026 00:48:37 +0200 Subject: [PATCH] test: 100% coverage for balance_of_power + median_price + true_range + typical_price + weighted_close (#32) * test(balance_of_power): cover name metadata Codecov flagged 3 lines (file at 96.25%): Indicator-impl name body (73-75). * test(median_price): cover name metadata Codecov flagged 3 lines (file at 94.44%): Indicator-impl name body (62-64). * test(true_range): cover name metadata Codecov flagged 3 lines (file at 95.94%): Indicator-impl name body (73-75). * test(typical_price): cover name metadata Codecov flagged 3 lines (file at 94.44%): Indicator-impl name body (62-64). * test(weighted_close): cover name metadata Codecov flagged 3 lines (file at 94.44%): Indicator-impl name body (61-63). --- crates/wickra-core/src/indicators/balance_of_power.rs | 7 +++++++ crates/wickra-core/src/indicators/median_price.rs | 7 +++++++ crates/wickra-core/src/indicators/true_range.rs | 7 +++++++ crates/wickra-core/src/indicators/typical_price.rs | 7 +++++++ crates/wickra-core/src/indicators/weighted_close.rs | 7 +++++++ 5 files changed, 35 insertions(+) diff --git a/crates/wickra-core/src/indicators/balance_of_power.rs b/crates/wickra-core/src/indicators/balance_of_power.rs index 1e7a5f59..6a113332 100644 --- a/crates/wickra-core/src/indicators/balance_of_power.rs +++ b/crates/wickra-core/src/indicators/balance_of_power.rs @@ -132,6 +132,13 @@ mod tests { ); } + /// Cover the Indicator-impl `name` body (73-75). + #[test] + fn name_metadata() { + let bop = BalanceOfPower::new(); + assert_eq!(bop.name(), "BalanceOfPower"); + } + #[test] fn emits_from_first_candle() { let mut bop = BalanceOfPower::new(); diff --git a/crates/wickra-core/src/indicators/median_price.rs b/crates/wickra-core/src/indicators/median_price.rs index 995e220b..9b761a5a 100644 --- a/crates/wickra-core/src/indicators/median_price.rs +++ b/crates/wickra-core/src/indicators/median_price.rs @@ -85,6 +85,13 @@ mod tests { ); } + /// Cover the Indicator-impl `name` body (62-64). + #[test] + fn name_metadata() { + let mp = MedianPrice::new(); + assert_eq!(mp.name(), "MedianPrice"); + } + #[test] fn emits_from_first_candle() { let mut mp = MedianPrice::new(); diff --git a/crates/wickra-core/src/indicators/true_range.rs b/crates/wickra-core/src/indicators/true_range.rs index 357bf490..02c0da1a 100644 --- a/crates/wickra-core/src/indicators/true_range.rs +++ b/crates/wickra-core/src/indicators/true_range.rs @@ -95,6 +95,13 @@ mod tests { assert_relative_eq!(out[1].unwrap(), 2.0, epsilon = 1e-12); } + /// Cover the Indicator-impl `name` body (73-75). + #[test] + fn name_metadata() { + let tr = TrueRange::new(); + assert_eq!(tr.name(), "TrueRange"); + } + #[test] fn emits_from_first_candle() { let mut tr = TrueRange::new(); diff --git a/crates/wickra-core/src/indicators/typical_price.rs b/crates/wickra-core/src/indicators/typical_price.rs index 14cdd431..343828a7 100644 --- a/crates/wickra-core/src/indicators/typical_price.rs +++ b/crates/wickra-core/src/indicators/typical_price.rs @@ -85,6 +85,13 @@ mod tests { ); } + /// Cover the Indicator-impl `name` body (62-64). + #[test] + fn name_metadata() { + let tp = TypicalPrice::new(); + assert_eq!(tp.name(), "TypicalPrice"); + } + #[test] fn emits_from_first_candle() { let mut tp = TypicalPrice::new(); diff --git a/crates/wickra-core/src/indicators/weighted_close.rs b/crates/wickra-core/src/indicators/weighted_close.rs index 34e7ff9a..504cf969 100644 --- a/crates/wickra-core/src/indicators/weighted_close.rs +++ b/crates/wickra-core/src/indicators/weighted_close.rs @@ -84,6 +84,13 @@ mod tests { ); } + /// Cover the Indicator-impl `name` body (61-63). + #[test] + fn name_metadata() { + let wc = WeightedClose::new(); + assert_eq!(wc.name(), "WeightedClose"); + } + #[test] fn emits_from_first_candle() { let mut wc = WeightedClose::new();