(values: &[f64])
| 31 | (open, high, low, close) |
| 32 | } |
| 33 | |
| 34 | /// Expected values from tests/fixtures/volatility/generate_range.py (Parkinson 1980, |
| 35 | /// Garman & Klass 1980, Yang & Zhang 2000, computed in pandas independently of this crate). |
| 36 | fn reference() -> Value { |
| 37 | let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) |
| 38 | .join("../../tests/fixtures/volatility/range_reference.json"); |
| 39 | serde_json::from_str(&std::fs::read_to_string(path).unwrap()).unwrap() |
| 40 | } |
| 41 | |
| 42 | /// Compare an estimator's output with one entry of the reference: the NaN warm-up count, |
| 43 | /// the mean of the non-NaN values and the sampled positions. |
| 44 | fn assert_matches(actual: &[f64], expected: &Value) { |
| 45 | let n_nan = actual.iter().filter(|v| v.is_nan()).count() as u64; |
| 46 | assert_eq!(n_nan, expected["n_nan"].as_u64().unwrap()); |
nothing calls this directly
no outgoing calls
no test coverage detected