Fork me on GitHub
#test-check
<
2017-08-14
>
frankitox15:08:23

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.

frankitox15:08:40

com.gfredericks.test.chuck.generators/string-from-regex can only be used in the JVM scope, right?

gfredericks15:08:43

@franquito yes -- you'll see a pull request for a clojurescript port; I can't remember if it's usable or not

gfredericks15:08:51

if you end up trying it out, do leave feedback on that PR about how it goes

gfredericks15:08:06

I've been meaning to review that PR for months now 😭

frankitox15:08:19

Well, then I'll give it a try and see what happens, I just need a simple regexp

frankitox15:08:09

Haha I see! Yeah, It must be a huge pain to maintain some open source project

frankitox15:08:18

Apart from It's size

lucasbradstreet18:08:29

@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 🙂

gfredericks18:08:38

@lucasbradstreet you prevented shrinking because it would spend a long time without getting very far?

lucasbradstreet18:08:25

Yeah, because testing my invariants was on the order of seconds, so I tried some more aggressive heuristics to reduce the search space.

lucasbradstreet18:08:41

Maybe not a very typical example that you want to allow for though 😛

gfredericks18:08:39

I've been in that situation before, I don't want to disregard it

gfredericks18:08:23

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

gfredericks18:08:40

but I suppose you could disable the default shrinking first, which you're already doing

lucasbradstreet18:08:46

Ahhh. I missed that aspect of the word “fallback”

gfredericks18:08:09

@lucasbradstreet also FYI with a mild amount of assuming-implementation-details, you can do this already

gfredericks18:08:17

so if you want to try it out that would be informative for me

lucasbradstreet18:08:34

Can you point me to where I should look?

gfredericks18:08:50

@lucasbradstreet are you familiar with the idea of a shrink tree?

lucasbradstreet18:08:59

At a high level yes.

gfredericks19:08:20

the simpler thing is writing replace-shrink, that takes [g f] where f is a function from x to [x]

lucasbradstreet19:08:27

Can’t say I’ve looked into exactly how rose trees work though.

gfredericks19:08:55

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

gfredericks19:08:06

and it's lazy because it's huge

gfredericks19:08:39

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

lucasbradstreet19:08:37

OK, with you up to here.

gfredericks19:08:55

I'll spit something out real quick that will probably work

lucasbradstreet19:08:33

Cool. I can set aside some time later today to give it some testing

gfredericks19:08:57

⇑ just off the top of my head, I didn't run it or compile it or parse it or anything

gfredericks19:08:21

but that should at least point you to the right functions, which would be the hard part otherwise

gfredericks19:08:46

feel free to ping me if you try it and can't get it to work

lucasbradstreet19:08:06

Will do. Thanks!