reiddraper / simple-check

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

macro modifications #12

Closed AlexBaranosky closed 11 years ago

AlexBaranosky commented 11 years ago

Here for you to take a look at. Willing to discuss/debate merits of any of this stuff. Reverting is easy enough.

reiddraper commented 11 years ago

All looks great on first glance, will take a look in a bit more detail later this evening or tomorrow. Thanks!

reiddraper commented 11 years ago

What do you think about a default of 1000 times instead of 100? Will that encourage people to write quicker-running tests?

cemerick commented 11 years ago

The reason why I didn't provide a default in the first place is that per-test runtimes do vary, sometimes significantly, or what anyone might want to achieve in a default configuration (i.e. maybe they want lein test to be quick, maybe they want the default to be incredibly thorough). Maybe that's not clear-headed thinking, but FWIW, etc.

AlexBaranosky commented 11 years ago

@cemerick I'm leaning to just removing the default.

reiddraper commented 11 years ago

Both the Haskell and Erlang QC successfully (imho) use a default number of times. I care less about there being a default in the clojure.test macro (defspec) though than I care about there being one in simple-check.core/quickcheck, because I'm more likely to be playing with the latter in the REPL.

AlexBaranosky commented 11 years ago

For lack of a better place to put this idea. I was wondering:

  1. is such-that a function that has the same name in the Haskell/Erlang QuickChecks?
  2. any objection to swapping the arg order on it, to be better for use with partial or ->>?
  3. any thoughts on changing its name to gen/filter? Not sure if I love or hate this idea. It seems nice to think of filtering over the Generator context, much like you've got the return/fmap/bind operations.
reiddraper commented 11 years ago

is such-that is a function that draws meaning from the Haskell/Erlang QuickChecks?

Yes, it's in both. Here's the Haskell documentation about it. Though I agree it'd be easier with the args reversed for partial application. I'm also kind of on the fence about the name change.

AlexBaranosky commented 11 years ago

@reiddraper want me to put the default back at 1000?

AlexBaranosky commented 11 years ago

Added ::defspec metadata to each test var. Enables me to add this to my project.clj

:test-selectors {:default (fn [v] true)
                 :specs :simple-check.clojure-test/defspec}

and be able to run only the defspecs:

> lein test :specs

mind you if you do renamed defspec to defproperty, this metadata should probably change to ::property.

reiddraper commented 11 years ago

@cemerick any objection to swapping the order of defspec args like this?

cemerick commented 11 years ago

@reiddraper I don't think so, no.