https://kotlinlang.org logo
Title
s

simon.vergauwen

12/01/2020, 7:57 PM
Is there a way to build a combination of
Arb
with frequencies like `Arb.choose` which takes into account all the edgecases of all provided
Arb
? I just encountered a bug that was happening on an edgecase value but it only arises when I raise iterations to 100K or so, using the following Arb.
s

sam

12/01/2020, 8:02 PM
So you want Arb.choose that uses edgecases. I guess it should do that (or at least another version should).
But it doesn't exist currently
l

LeoColman

12/01/2020, 8:05 PM
can't you go for
arb.choose().plusEdgeCases
or something like that?
I don't remember the exact function
s

sam

12/01/2020, 8:05 PM
yeah its something like that
but you'd have to add them together from the arbs yourself
s

simon.vergauwen

12/01/2020, 8:14 PM
Yes, that's exactly what I want. I don't think I have
plusEdgeCases
yet, but that could work for me now 🙂
Thanks for the tip! In my case it's a valid solution, but I was under the impression it would force all edgecses on me but perhaps I should be using
Exhaustive
then.
m

mitch

12/05/2020, 10:50 AM
Thanks @simon.vergauwen! @sam i think that's a good point.
Arb.choice
currently takes into account the edgecases of the input arbs however none of the others do. Imo it's the right thing for us to collate the edgecases. Maybe this is something we can address https://github.com/kotest/kotest/blob/f48822058eedcb6b5a677a5287fd36115de291e4/kotest-property/src/commonMain/kotlin/io/kotest/property/arbitrary/combinations.kt
s

sam

12/05/2020, 1:15 PM
Yeah we should do it
👍 2
m

mitch

12/05/2020, 8:48 PM
Thanks @sam! pr raised
s

simon.vergauwen

12/07/2020, 8:38 AM
Awesome 👏 👏 Thanks!