test-check

moxaj 2017-07-25T21:29:53.732355Z

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

moxaj 2017-07-25T21:31:19.773954Z

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

2017-07-25T21:31:24.776298Z

there's a ticket for that

2017-07-25T21:31:34.780879Z

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

2017-07-25T21:32:21.802523Z

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

2017-07-25T21:32:43.812587Z

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

2017-07-25T21:33:01.820682Z

but I'd be happy to be wrong about that

moxaj 2017-07-25T21:38:06.959448Z

I see

peeja 2017-07-25T22:01:52.574883Z

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

peeja 2017-07-25T22:01:59.577711Z

Or: why is it a vector?

2017-07-25T22:07:49.716397Z

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

peeja 2017-07-25T22:08:04.722065Z

Ah, that makes sense. Thanks!

👍 1