-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
Test machinery for implicit functions #316
Conversation
This is the first step towards quickspeccing the implicit library
------------------------------------------------------------------------------ | ||
-- | The number of decimal points we need to agree to assume two 'Double's are | ||
-- equal. | ||
epsilon :: Int |
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.
because of the nature of floating point, anything that looks at decimal position is going to be fragile. there's functions for taking the 'integer' part and the 'multiplier' part and examining those seperately, for cases like this.
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.
https://hackage.haskell.org/package/ieee-0.7/docs/Numeric-IEEE.html
take a look at sameSignificandBits . i think. I'm good with merging this without this, it seems good enough already.
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.
I'd prefer to merge this as is, but wouldn't push back too strongly if you're keen on it.
And just a general point: the addition of another test system means we should probably have a TESTING.md file, describing all of the different test systems. |
This PR adds quickcheck machinery for testing implicit functions. It:
Arbitrary
generators using the public interface, so that we can generate random symbolic objects.Observe
instance for each, saying that two symbolic objects are equal if theirgetImplicit
functions agree at all points. Future work should also ensure they have equalgetBox
es, but due torotate3
being currently broken, this isn't true today.The property tests have some unhappy results;
getBox (rotate3 z)
is broken, and thatrotate3 (x, y, z)
forx, y, z not in {0, 1}
doesn't seem to satisfy any compositional properties. Fortunately these should both be fixed in #314.There's also quite a lot of implicit bug workarounds in the
isValid
functions, necessary for working around partiality (like #304 and #306) in the library.