-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/3099 nan tolerance #3240
Conversation
import io.kotest.matchers.MatcherResult | ||
import kotlin.math.abs | ||
|
||
open class ToleranceMatcher<T : Number>(private val expected: T, private val tolerance: Double) : Matcher<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting solution by using Number
!
8b28b2a
to
873af26
Compare
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Just need to fix the test @piotrb5e3 and I think we're good! |
In my opinion we should revert the unification of ToleranceMatchers. It'll lead to some duplicate code, but it will let us be as correct as possible which I think is more important. |
I agree |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Pull request was closed
@piotrb5e3 Could you give maintainers access to your branch so we can fix the git history? |
@LeoColman Should I add specific people to the access list for this branch? Allow edits by maintainers is already enabled. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hi,
This is a proposed solution to #3099.
I unified the code of all tolerance matchers and improved handling around NaNs.
It has one issue: since the new code operates all on doubles, the old "Match close enough numbers" test fails, as the ranges of acceptable values are slightly different with double rounding. Not really sure what to do about it.
I'd also happily remove
FloatToleranceMatcher
, but I'm not sure if it's not part of the API.