Skip to content

Unify and deduplicate float tests #141726

@RalfJung

Description

@RalfJung

We currently have at least two somewhat independent places where float functions are being tested:

  • in coretests/tests/float/mod.rs
  • in coretests/tests/floats/f*.rs
  • in std/tests/floats/f*.rs
  • In tests/ui/float/conv-bits-runtime-const.rs

Confusingly, coretests also tests things that are actually in std. The ones in num have infrastructure to also run tests in const, but do not have infrastructure to e.g. only run f128 tests on targets where that is reliable. For this reason, some tests are duplicated.

We should make sure we have one canonical place for all these tests that can serve the needs of all of them, and avoid duplication.

Cc @tgross35

Mentoring instructions

The main goal is to port the tests that are still in coretests/tests/floats/f*.rs to use the infrastructure that we built in coretests/tests/float/mod.rs. So to help:

  • pick a test or a set of related tests in coretests/tests/floats/f64.rs
  • compare that with the versions in the other f*.rs files to see if they have anything beyond what f64 has
  • add a new test in float/mod.rs that replaces the ones in f*.rs; see the existing tests there for examples

Metadata

Metadata

Assignees

Labels

A-floating-pointArea: Floating point numbers and arithmeticA-testsuiteArea: The testsuite used to check the correctness of rustcC-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.E-tediousCall for participation: An issue involves lots of work and is better handled as many small tasks.T-libsRelevant to the library team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions