-
Notifications
You must be signed in to change notification settings - Fork 387
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
Request: Implement IEquatable #299
Comments
I intentionally left out Now that I browse the code, I see we do have an
To be clear, we would still not implement the Just an example of the problem:
|
On a side-note, we have discussed adding an alternative version of the nuget using |
We are always using |
Thanks for the extensive reply :-) Then I know why IEquatable is not implemented. |
@eriove Ah, yes, I was actually not thinking in the context of unit tests. For those cases I agree a |
@angularsen Then it makes sense, I would personally prefer if the delta was a relative difference instead, but I'm guessing that is dependent of the application. Since the relative difference would be a double and the absolute difference would be a quantity it would be possible to add both. How useful is it outside testing though? I'm currently working on libraries without any GUI so I'm very focused on unit test as use cases :-) |
I don't know if this is in demand and whether obsoleting the existing equality methods will cause a furious uproar, I haven't used the equality myself in any cases I can think of. Maybe we should start by obsoleting them and then see if someone actually comes around to ask about it? |
|
We still recommend using the |
Could classes like Force and Torque implement IEquatable, in addition to IComparable which is already implemented? This will make life easier when verifying that two Force or Torque objects are equal in automated tests.
Example: Can then write: Assert.AreEqual(force1, force2);
Instead of: Assert.AreEqual(0, force1.CompareTo(force2)); or Assert.IsTrue(force1.CompareTo(force2) == 0);
The text was updated successfully, but these errors were encountered: