Hi Frederick! Loved the lib, there's a couple of functions that I've invented too for my project lol, but I think you took a much more clean approach.
com.gfredericks.test.chuck.generators/string-from-regex
can only be used in the JVM scope, right?
@franquito yes -- you'll see a pull request for a clojurescript port; I can't remember if it's usable or not
if you end up trying it out, do leave feedback on that PR about how it goes
I've been meaning to review that PR for months now 😭
Oh, nice!
Well, then I'll give it a try and see what happens, I just need a simple regexp
Haha I see! Yeah, It must be a huge pain to maintain some open source project
Apart from It's size
Its*
@gfredericks did the fallback shrinking strategy end up going anywhere? I’ve actually used gen/return to prevent shrinking, and then shrunk manually myself in the past, so this is pretty interesting 🙂
@lucasbradstreet you prevented shrinking because it would spend a long time without getting very far?
Yeah, because testing my invariants was on the order of seconds, so I tried some more aggressive heuristics to reduce the search space.
Maybe not a very typical example that you want to allow for though 😛
I've been in that situation before, I don't want to disregard it
my initial thought is that a fallback shrink would never speed up shrinking since it would only try it after it's tried everything else
but I suppose you could disable the default shrinking first, which you're already doing
Ahhh. I missed that aspect of the word “fallback”
@lucasbradstreet also FYI with a mild amount of assuming-implementation-details, you can do this already
so if you want to try it out that would be informative for me
Can you point me to where I should look?
@lucasbradstreet are you familiar with the idea of a shrink tree?
At a high level yes.
the simpler thing is writing replace-shrink
, that takes [g f]
where f
is a function from x
to [x]
Can’t say I’ve looked into exactly how rose trees work though.
it's just a tree of values; the root is the generated value, and the child of any node are the shrinks from that point
and it's lazy because it's huge
OK
so writing replace-shrink
just involves figuring out the exact functions to call, and the algorithm that transforms x
and f
into a lazy tree
OK, with you up to here.
I'll spit something out real quick that will probably work
Cool. I can set aside some time later today to give it some testing
⇑ just off the top of my head, I didn't run it or compile it or parse it or anything
Sure thing :)
but that should at least point you to the right functions, which would be the hard part otherwise
feel free to ping me if you try it and can't get it to work
Will do. Thanks!