Make XCTAssertEqual with accuracy more generic #319
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Equality with accuracy isn't limited to floating point tests. Sometimes integer (or other numeric types) need to be accurate within certain bounds for the purposes of testing. This change allows any numeric type that has magnitude and distance to be used with
XCTAssertEqual(_:_:accuracy:)
andXCTAssertNotEqual(_:_:accuracy:)
.CC @gormster as the original author of #294 which this PR revives. That PR was automatically closed when the repo changed its default branch to 'main', and I was unable to edit and reopen that PR to the new branch so I opened this new PR to finish landing that change. I rebased those original PR changes, and edited them further to incorporate my own review feedback to remove the
Strideable
protocol requirement, consolidated some related unit tests and added several more tests.This now matches the current Xcode 12 behavior, noted in the release notes as bug 58481784.