A3: close core test-coverage gaps
Adds the reset tests the audit named as missing (aroon, awesome oscillator, donchian, keltner, williams_r, and both VWAP variants), non-finite-input tests for every scalar indicator that guards is_finite (WMA, RSI, MACD, Bollinger, KAMA), and naive-reference proptests for EMA, RSI and ATR. 189 core tests pass.
This commit is contained in:
@@ -227,4 +227,16 @@ mod tests {
|
||||
assert!(!macd.is_ready());
|
||||
assert_eq!(macd.update(1.0), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ignores_non_finite_input() {
|
||||
let mut macd = MacdIndicator::classic();
|
||||
macd.batch(&(1..=80).map(f64::from).collect::<Vec<_>>());
|
||||
let before = macd.value();
|
||||
assert!(before.is_some());
|
||||
// Non-finite inputs return the last value without advancing any EMA.
|
||||
assert_eq!(macd.update(f64::NAN), before);
|
||||
assert_eq!(macd.update(f64::INFINITY), before);
|
||||
assert_eq!(macd.value(), before);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user