test: Don't compare floats for strict equality

pull/24376/head
Carol (Nichols || Goulding) 2021-08-19 15:02:34 -04:00
parent 266dffea86
commit 31ead36fc0
3 changed files with 4 additions and 1 deletions

1
Cargo.lock generated
View File

@ -1913,6 +1913,7 @@ dependencies = [
"rand_seeder",
"serde",
"snafu",
"test_helpers",
"tokio",
"toml",
"tracing",

View File

@ -31,6 +31,7 @@ uuid = { version = "0.8.1", default_features = false }
[dev-dependencies]
criterion = "0.3.3"
test_helpers = { path = "../test_helpers" }
[[bench]]
name = "point_generation"

View File

@ -406,6 +406,7 @@ fn field_spec_to_generator<T: DataGenRng>(
mod test {
use super::*;
use crate::{DynamicRng, ZeroRng, TEST_SEED};
use test_helpers::approximately_equal;
type Error = Box<dyn std::error::Error>;
type Result<T = (), E = Error> = std::result::Result<T, E>;
@ -566,7 +567,7 @@ mod test {
// All the values generated will always be the same known value.
assert!(
f64_fields.iter().all(|f| *f == start_and_end),
f64_fields.iter().all(|f| approximately_equal(*f, start_and_end)),
"{:?}",
f64_fields
);