From 3fcab89c5159e0aa0a367e897193083efd744799 Mon Sep 17 00:00:00 2001 From: Rico Riedel Date: Sat, 6 Aug 2022 21:55:37 +0200 Subject: [PATCH] Switch to approx --- src/transform/segment.rs | 2 +- src/vec.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/transform/segment.rs b/src/transform/segment.rs index 4342b48..092ef18 100644 --- a/src/transform/segment.rs +++ b/src/transform/segment.rs @@ -123,7 +123,7 @@ mod test { let sampler = SegmentsFactory::new(Box::new(child), 4.0).create(&Config::default()); - assert_eq!(0.96, sampler.sample(Vector::default())); + assert_abs_diff_eq!(0.96, sampler.sample(Vector::default())); } #[test] diff --git a/src/vec.rs b/src/vec.rs index dc0d41c..9a98a49 100644 --- a/src/vec.rs +++ b/src/vec.rs @@ -55,8 +55,8 @@ mod test { #[test] fn new() { let v = Vector::new(4.0, 7.0); - assert_eq!(4.0, v.x); - assert_eq!(7.0, v.y); + assert_abs_diff_eq!(4.0, v.x); + assert_abs_diff_eq!(7.0, v.y); } #[test] @@ -71,7 +71,7 @@ mod test { #[test] fn sum() { - assert_eq!(11.0, Vector::new(3.0, 8.0).sum()); + assert_abs_diff_eq!(11.0, Vector::new(3.0, 8.0).sum()); } #[test]