diff --git a/src/transform/invert.rs b/src/transform/invert.rs index 7744d4e..01cd310 100644 --- a/src/transform/invert.rs +++ b/src/transform/invert.rs @@ -30,6 +30,7 @@ impl Pattern for Invert { mod test { use super::*; use crate::MockPatternFactory; + use approx::*; use mockall::predicate::eq; #[test] @@ -62,7 +63,7 @@ mod test { let sampler = InvertFactory::new(Box::new(child)).create(&Config::default()); - assert_eq!(0.3, sampler.sample(Vector::default())); + assert_abs_diff_eq!(0.3, sampler.sample(Vector::default())); } #[test] diff --git a/src/transform/shift.rs b/src/transform/shift.rs index 2840473..39f090d 100644 --- a/src/transform/shift.rs +++ b/src/transform/shift.rs @@ -28,6 +28,7 @@ impl Pattern for Shift { mod test { use super::*; use crate::MockPatternFactory; + use approx::*; use mockall::predicate::eq; #[test] @@ -61,7 +62,7 @@ mod test { let sampler = ShiftFactory::new(Box::new(child)).create(&config); - assert_eq!(0.8, sampler.sample(Vector::default())); + assert_abs_diff_eq!(0.8, sampler.sample(Vector::default())); } #[test] diff --git a/src/transform/slice.rs b/src/transform/slice.rs index 50e75fe..1aaef8a 100644 --- a/src/transform/slice.rs +++ b/src/transform/slice.rs @@ -38,6 +38,7 @@ impl Pattern for Slice { mod test { use super::*; use crate::MockPatternFactory; + use approx::*; use mockall::predicate::eq; #[test] @@ -67,7 +68,7 @@ mod test { let sampler = SliceFactory::new(Box::new(child), 4).create(&Config::default()); - assert_eq!(1.0, sampler.sample(Vector::default())); + assert_abs_diff_eq!(1.0, sampler.sample(Vector::default())); } #[test] @@ -81,7 +82,7 @@ mod test { let sampler = SliceFactory::new(Box::new(child), 4).create(&Config::default()); - assert_eq!(0.0, sampler.sample(Vector::default())); + assert_abs_diff_eq!(0.0, sampler.sample(Vector::default())); } #[test] diff --git a/src/transform/swap.rs b/src/transform/swap.rs index f0ee618..04b49f4 100644 --- a/src/transform/swap.rs +++ b/src/transform/swap.rs @@ -30,6 +30,7 @@ impl Pattern for Swap { mod test { use super::*; use crate::MockPatternFactory; + use approx::*; use mockall::predicate::eq; #[test] @@ -62,7 +63,7 @@ mod test { let sampler = SwapFactory::new(Box::new(child)).create(&Config::default()); - assert_eq!(0.4, sampler.sample(Vector::default())); + assert_abs_diff_eq!(0.4, sampler.sample(Vector::default())); } #[test]