test-check 2017-07-25

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))))

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

there's a ticket for that

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

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

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

but I'd be happy to be wrong about that

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

Or: why is it a vector?

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

Ah, that makes sense. Thanks!

👍 1