reiddraper / simple-check

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

More generators #18

Closed si14 closed 11 years ago

si14 commented 11 years ago

This PR adds strictly positive/negative integers (so they can't be equal to 0) and an optional parameter to vector so it's length can be provided explicitly. The latter allows to construct proper matrices of given size; the latter will allow to generate all possible matrices as soon as nested properties will work (or is there any other way to do so right now?).

reiddraper commented 11 years ago

I put a couple comments inline, but overall this all looks great. Thanks!

si14 commented 11 years ago

I've updated this PR taking your comments into account. Does this look better to you?

reiddraper commented 11 years ago

This doesn't appear to be working as expected:

user=> (gen/sample (gen/vector gen/int 2 2))
([0 0 0 0 0] [-1 2 -1 0 -1] [2 -1 2] [0 4 3 -4] [3 -2 -3 3 3] [5 -2 5] [3 -6 -6] [-4 3 -6 3 6] [-8 4 4 3] [8 -3 7 -5])
si14 commented 11 years ago

My bad. Fixed.