From 58aca5d76222c6b71c598b7403e566a49673556d Mon Sep 17 00:00:00 2001 From: Ben Sully Date: Wed, 25 Sep 2024 08:49:51 +0100 Subject: [PATCH] Use assert_all_close for dtw integration test --- crates/augurs/tests/integration.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/augurs/tests/integration.rs b/crates/augurs/tests/integration.rs index db6989f9..ac5d49e4 100644 --- a/crates/augurs/tests/integration.rs +++ b/crates/augurs/tests/integration.rs @@ -55,18 +55,20 @@ fn test_dtw() { #[test] fn test_dtw_distance_matrix() { use augurs::dtw::Dtw; + use augurs_testing::assert_all_close; + let dtw = Dtw::euclidean(); let series: &[&[f64]] = &[&[0.0, 1.0, 2.0], &[3.0, 4.0, 5.0], &[6.0, 7.0, 8.0]]; let dists = dtw.distance_matrix(series); assert_eq!(dists.shape(), (3, 3)); - assert_eq!(dists[0], vec![0.0, 5.0990195135927845, 10.392304845413264]); + assert_all_close(&dists[0], &[0.0, 5.0990195135927845, 10.392304845413264]); // Test with different length series. let dtw = Dtw::euclidean(); let series: &[&[f64]] = &[&[0.0, 1.0, 2.0], &[3.0], &[6.0, 7.0]]; let dists = dtw.distance_matrix(series); assert_eq!(dists.shape(), (3, 3)); - assert_eq!(dists[0], vec![0.0, 3.7416573867739413, 9.273618495495704]); + assert_all_close(&dists[0], &[0.0, 3.7416573867739413, 9.273618495495704]); } #[cfg(feature = "ets")]