Fork me on GitHub
#test-check
<
2017-07-25
>
moxaj21:07:53

question: is there any way to control how a recursive generator shrinks? for example, the following can return [[[[false]]]] as the minimal failing example:

(tc/quick-check 100
  (tc.prop/for-all [value (tc.gen/recursive-gen tc.gen/vector tc.gen/boolean)]
    (every? true? (flatten value))))

moxaj21:07:19

however, if a recursive generator could shrink towards the children of the actual compound generator, it could produce [false] as the minimal failing value

gfredericks21:07:24

there's a ticket for that

gfredericks21:07:34

I'm not sure if it's an easy fix or not

gfredericks21:07:21

according to the comments, my past self wasn't sure either

gfredericks21:07:43

my guess is that identifying subtrees in a generic way might be difficult or impossible

gfredericks21:07:01

but I'd be happy to be wrong about that

peeja22:07:52

When is [:shrink :smallest] not a vector of one element?

peeja22:07:59

Or: why is it a vector?

gfredericks22:07:49

@peeja when the prop/for-all has multiple clauses, the vector has more elements

peeja22:07:04

Ah, that makes sense. Thanks!