reiddraper / simple-check

QuickCheck for Clojure
http://reiddraper.github.io/simple-check/
286 stars 18 forks source link

Investigate clojure.test integration #4

Closed cemerick closed 11 years ago

cemerick commented 11 years ago

Aside from making simple-check properties trivially runnable from e.g. Leiningen, I think this will give us a lot of reporting flexibility to potentially address #2 so that people can independently choose their level of verbosity, etc.

cemerick commented 11 years ago

Beyond the reporting stuffs, it seems that a reasonable next step is something like a defspec macro that wraps up a property, generators, and a default trial count into a clojure.test var. Is this something that you have already kicking around in a scratch file somewhere (clojure.test-based or not), or should I see what I can put together?

cemerick commented 11 years ago

OK, I couldn't help myself, it was easy enough. :-P

This actually is the perfect hook for adding :name metadata to property-funs, so that the periodic trial report looks nice even with HOFs:

Passing trial 32623 / 1.0E7 for (partial consistent-collation? (var n/encode-int))

The nomenclature of defspec may not be suitable, and perhaps it's undesirable given the precedent over in test.generative, but it's roughly the last bit in what I was looking for in terms of clojure.test convenience (i.e. works with lein test, easily callable directly, and can be scaled up or down at the REPL in terms of number of trials).