Welcome! Please see the About page for a little more info on how this works.

0 votes
in test.check by

test.check has generators for first-order types, but not for functions.

In the original QuickCheck, an additional type class ("Arbitrary") handles
functions.

If I implemented this and submitted a patch, would it be likely to be included?

Background: I wrote my own Clojure QuickCheck clone here:

https://bitbucket.org/sperber/deinprogramm.quickcheck

This has arbitraries and function generators, but not all of test.check's goodies.

I'm trying to decide whether to continue maintaining my QuickCheck clone or
instead to contribute ot test.check, so feedback would be much appreciated.

5 Answers

0 votes
by

Comment made by: reiddraper

I'd love a patch for this! Would you like to write up a quick implementation proposal first, so we can iron out any architectural details before looking at the code?

0 votes
by

Comment made by: sperber

Would you be willing to look at my QuickCheck clone as a starting point? Its general implementation approach is very similar to yours, so I think you should feel right at home.

The caveat is that it introduces a type separate from generators - the "arbitrary", corresponding to the Arbitray' type class in the Haskell code. Doing this to test.check' would change the API, so maybe there, the Generator' type should be extended by an optional transformer' field.

0 votes
by

Comment made by: reiddraper

Sure, I've already read through it a bit, but need to read in more detail. How does your implementation handle printing (showing) functions? Do functions shrink? Have you seen (link: http://dl.acm.org/citation.cfm?id=2364516 text: Showing and Shrinking Functions by Claessen )?

0 votes
by

Comment made by: sperber

Yes. Haven't done that yet, but it would be on my list. Given that functions are objects in Clojure, I think printing should be a little easier than in Haskell.

0 votes
by
Reference: https://clojure.atlassian.net/browse/TCHECK-38 (reported by alex+import)
...