You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently Arb.choice takes Gen instances as parameters and combines the edgecases and the arb values. Such that you get the edgecases first when you call .values() on the resulting Arb instance. In addition the edgecases in the passed in Arbs are not available via the edgecases() function on the resulting Arb, instead you get an empty list.
As this might might not be expected, and invoking choice on an Exhaustive is counter intuitive, after discussing with @sksamuel in slack, it's been suggested that we:
Change Arb.choice to accept vararg Arb<A>
Combine the edgecases from the provided Arbs, and make available via resulting Arb.edgecases
Expect values from the provided Arb instances to be available via the resulting .values()
deprecate the existing one and replace it with the below
Use @JvmName to keep the same function name with the varargs
Something like:
fun <A> Arb.Companion.choice(vararg arbs: Arb<A>): Arb<A> = arb (arbs.flatMap(Arb<A>::edgecases)){ rs ->
val iters = arbs.map { it.values(rs).iterator() }
...
I'm happy to have a go at this.
The text was updated successfully, but these errors were encountered:
jaymoid
pushed a commit
to jaymoid/kotest
that referenced
this issue
Apr 25, 2020
jaymoid
changed the title
Arb.choice should take Arb instances and not combines edge cases and values.
Arb.choice should take Arb instances and not combine edgecases into arb.values().
Apr 25, 2020
Currently
Arb.choice
takes Gen instances as parameters and combines the edgecases and the arb values. Such that you get the edgecases first when you call.values()
on the resulting Arb instance. In addition the edgecases in the passed in Arbs are not available via theedgecases()
function on the resulting Arb, instead you get an empty list.As this might might not be expected, and invoking
choice
on an Exhaustive is counter intuitive, after discussing with @sksamuel in slack, it's been suggested that we:Arb.choice
to acceptvararg Arb<A>
Arb.edgecases
.values()
Something like:
I'm happy to have a go at this.
The text was updated successfully, but these errors were encountered: