lawsynth/crates/lawsynth-stats/tests/covariance_property.rs
caelum0x 8af85c6e28 style: format workspace to rustfmt.toml (use_small_heuristics = Max)
Bring the whole workspace into compliance with the repo's rustfmt config
(edition 2024, max_width 100, use_small_heuristics = "Max"), which had drifted
across many crates. Pure formatting — no logic changes; `cargo fmt --check` is
now clean and `cargo build --workspace` is green.
2026-08-18 16:59:40 +03:00

11 lines
433 B
Rust

use lawsynth_stats::{StatsError, covariance, pearson_correlation};
#[test]
fn covariance_and_correlation_are_symmetric_for_aligned_data() {
let left = [1.0, 2.0, 3.0];
let right = [2.0, 4.0, 8.0];
assert_eq!(covariance(&left, &right), covariance(&right, &left));
assert_eq!(pearson_correlation(&left, &left).unwrap(), 1.0);
assert_eq!(pearson_correlation(&left, &[1.0, 2.0]), Err(StatsError::LengthMismatch));
}