Clojurians
# test-check

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

moxaj 00:29: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))))

moxaj 00:31: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

gfredericks 00:31:24

there's a ticket for that

gfredericks 00:31:34

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

gfredericks 00:32:21

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

gfredericks 00:32:43

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

gfredericks 00:33:01

but I'd be happy to be wrong about that

moxaj 00:38:06

I see

peeja 01:01:52

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

peeja 01:01:59

Or: why is it a vector?

gfredericks 01:07:49

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

peeja 01:08:04

Ah, that makes sense. Thanks!

nberger 17:28:51

@peeja: I'd love to help finding that transducer. I've been working on a refactoring that might be of help. The main idea is to make it easier to see the quick-check loop as a state machine. I think we could be closer to extract a transducer from there. The changes are in the test.check.refactor branch in my fork, let me know if you have any questions or comments

nberger 17:44:07

-- that's related to your message from a few days ago :slightly_smiling_face: