discipline icon indicating copy to clipboard operation
discipline copied to clipboard

Add implementation of equals/hashCode laws

Open denisrosset opened this issue 9 years ago • 1 comments

As a working example, discipline could provide an "AnyRefLaws" implementation that checks the behavior of the default equals and hashCode methods.

In particular, the implementation could work from:

  • a makeClone method that creates a deep copy of an instance,
  • two particular instances that are guaranteed to compare as != with differing hashCode.

See for example: https://github.com/denisrosset/alasc/blob/master/scalacheck-binding/src/main/scala/net.alasc/laws/AnyRefLaws.scala

I'd gladly provide a PR if there is interest.

denisrosset avatar Jan 06 '15 17:01 denisrosset

I like the idea of Discipline providing some default laws that can easily be shared and used. If @larsrh wants to go that direction I think these laws would be very helpful.

non avatar Jan 06 '15 18:01 non