Switch to approx

This commit is contained in:
Rico Riedel 2022-08-05 19:20:50 +02:00
parent 66a5ec78f3
commit 7c13c8838a
No known key found for this signature in database
GPG Key ID: 75AC868575DE7B18
4 changed files with 9 additions and 5 deletions

View File

@ -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]

View File

@ -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]

View File

@ -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]

View File

@ -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]