Skip to content
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

CHANGE: PartialEq for Distributions #1217

Closed
Will-Low opened this issue Feb 10, 2022 · 2 comments
Closed

CHANGE: PartialEq for Distributions #1217

Will-Low opened this issue Feb 10, 2022 · 2 comments

Comments

@Will-Low
Copy link

Will-Low commented Feb 10, 2022

Summary

I'd like to be able to compare distributions to one another, defined as comparing their fields for equality. I'm trying to understand if there is a reason why this isn't currently implemented.

Details

I think this could be added to distributions by just added the PartialEq derive macro.

Motivation

When conducting unit tests, I'd like to be able to compare a created distributions to an expected distribution to they can be considered equal. In #560, it appears this idea was discussed, but people didn't think there was a need. I personally think the unit test case is compelling.

Alternatives

I'm not aware of another way of handling the equality check, since the distribution fields are private.

@dhardy
Copy link
Member

dhardy commented Feb 10, 2022

I can see some utility of PartialEq for distributions in unittests and don't see a reason not to have it. @vks do you agree?

@vks
Copy link
Collaborator

vks commented Feb 10, 2022

Sure, why not. We also implemented it for the RNGs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants