-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
It would be really cool if we could configure the assertion to ignore tiny differences in float values, e.g.
let assert_config = assert_json_diff::Config::new(assert_json_diff::CompareMode::Strict)
.numeric_mode(assert_json_diff::NumericMode::AssumeFloat)
.float_eq_epsilon(0.001);
assert_json_diff::assert_json_matches!(
serde_json::json!({"a": 1.1000001}),
serde_json::json!({"a": 1.1000002}),
assert_config
);
This should work, but right now will fail with
json atoms at path ".a" are not equal:
lhs:
1.1000001
rhs:
1.1000002
It would also more elegantly solve the discussion over at #17.
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed