Expand test suite - #46
Conversation
…improve float_approx tests
|
So the purpose of this was to address (or at least chip away at) the last limitation listed in the readme:
This work is rather sloppy (over-zealously checking some parts of the API surface while still only checking a small number of actual conversions), but it did find something at least: I considered writing a test suite using (Also: should |
dhardy
left a comment
There was a problem hiding this comment.
Notes for myself.
These tests are simultaneously repetitive, inexhaustive and inconsistent in style. And mostly cover trivial stuff. But with a few tweaks they have some value.
Cleans up the test suite per scope constraints: no
srcchanges, no cast-mirrors-conv tautology tests, minimal array/tuple coverage, usestdconsts where appropriate.Changes
tests/common/mod.rs— dropassert_ok_eq,assert_range,assert_inexactwrappers; useassert_eq!withOk(...)/Err(Error::Range)/Err(Error::Inexact)directlycast_approx_mirrors_conv_approxtest fromconv_approx.rs— testing thatcastmirrorsconvis a tautology sinceCastis a blanket impl overConvfloat_approx.rs— replace raw bit-pattern construction withstdconsts:f64::MIN_POSITIVE / 2.0for subnormal,(f32::MIN_POSITIVE as f64) / 2.0for small-normal-instead of bit manipulationpositive_zero, etc.)(1151u64) << 52→1151u64 << 52src/impl_float.rsto master — a prior commit restructured theif/else ifinConvApprox<f64> for f32; reverted without touching anything elseBefore / After (representative)