Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
binding: update floating-point comparisons in tests
version 1.60 of the rust stdlib included a change to improve the accuracy of calculations in `Duration::try_from_secs_f32/64` (see [1]), which had a minor breaking change of slightly altering the calculated results. version 1.63 further tweaked this (see [2]). this commit updates tests to match the new calculated values from 1.63+, and thus fixes failure running tests in newer stable rust releases and helps us to fix CI failure. this is done at the expense of breaking the ability to run the tests with older rust versions, which seems reasonably acceptable at this time. for the record, the new values used here are those calculated using version 1.66. it has been suggested that rather than compare float values directly, it may be better for this crate to compare via the `float_eq` crate instead. this would essentially mean switching to a less accurate comparison. since some time has passed now since i originally encountered this problem, i think that just updating the values compared against is the best move at this time, though i am not necessarily against moving to use of `float_eq` at some point in future if this causes significant problems for users of older rust versions, or if we encounter further such issues from rust stdlib changes. note that in the original issue (see [3]) there were four functions whose doc-tests were failing, yet only three have needed to be modified here. the lack of needing to fix the fourth function's tests is presumably as a result of the changes made in rust v1.63. (the original issue was noticed with a v1.60 nightly). [1]: rust-lang/rust#90247 [2]: rust-lang/rust#96051 [3]: #48
- Loading branch information