Skip to content

Commit

Permalink
Fix: Use float_cmp for testing floats
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Beyer <[email protected]>
  • Loading branch information
matthiasbeyer committed Aug 2, 2022
1 parent 336a34e commit d54986c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ fn test_parse_float() {

// can't use `matches!` because of float value
match config {
TestFloatEnum::Float(TestFloat { float_val }) => assert_eq!(float_val, 42.3),
TestFloatEnum::Float(TestFloat { float_val }) => {
assert!(float_cmp::approx_eq!(f64, float_val, 42.3))
}
}
})
}
Expand Down

0 comments on commit d54986c

Please sign in to comment.