Closed FreezyLemon closed 2 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 89.30%. Comparing base (
aa276c8
) to head (110fa86
). Report is 37 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Just noticed I missed some #[should_panic]
tests that I still want to rewrite. And I guess I can also write some tests for the testing_boiler itself, now that it's being used for almost all unit tests
The changed lines have 100% coverage, but total coverage still went down because the PR removes circa 700 lines.
I really appreciate this, I think it'll add a lot of value for contributors to have a consistent approach for tests.
I've no qualms with choices of names. I believe at this point, all arguments in new
methods are stored in the struct. If that changes (sim to #198), then tests should be added with it.
I've reviewed the minimal functional changes to the boiler and I think it's fair to specify f64
until we actually implement over generic or multiple floats. These error messages will be more specific now as well, thanks 👍!
I believe that the only way this PR could allow behavior of the library to change in the future is if tests aren't the same, so my plan is to do some semantic diff and make sure everything in a pre-existing test module is a rename (or deletion, in the cases you footnote).
Sound reasonable?
Yeah, of course.
I think the auto-merge broke something here, master
doesn't build atm.
See #277.
The unit tests are a bit messy at the moment. Duplicate code, subtly inconsistent behavior (
test_case
), bad naming, no documentation etc.I tried to clean it up a bit. This also makes the problems mentioned in #108 easier to spot (ctrl-f "test_exact"). List of changes:
try_create
andcreate_case
->create_ok
(dropped some verification but that really shouldn't matter[^1]. If it does, I can change this)bad_create_case
->create_err
(new:create_err
returns the error, can be used for verification when more specific errors are returned)test_case
-> eithertest_exact
ortest_relative
, depending on old behavior (some implementations usedassert_eq
, others usedassert_relative_eq
)test_almost
->test_absolute
get_value
->create_and_get
#[should_panic]
tests to usetest_none
instead. Reads better IMHOThere are a few smaller things that could help further (re-enabling rustfmt for unit tests, dis-allowing
clippy::excessive_precision
), but those are less clear-cut, so I kept it to this changeset for now.[^1]: The type of verification being done was extremely rudimentary, e.g.
let dist = Dist::new(7.5, 3.5);
and thenassert_eq!(dist.a(), 7.5);
plusassert_eq!(dist.b(), 3.5);
.