https://kotlinlang.org logo
Title
b

bbaldino

08/04/2020, 7:27 PM
Upgrading a repo from kotlintest to kotest, is it possible to do property testing with just a specific set of values? (like kotlintest had)
s

sam

08/04/2020, 7:36 PM
You mean you want to hard code some values ?
b

bbaldino

08/04/2020, 7:36 PM
Yeah, I had:
forall(
    row(1, 10, -9),
    row(10, 1, 9),
    row(1, 32760, 9),
    row(32760, 1, -9),
    row(1234, 1234, 0)
) { a, b, expected ->
                    Vp8Utils.getExtendedPictureIdDelta(a, b) shouldBe expected
}
a generic one doesn't make much sense here, as in order to verify I'd have to do the same logic I'm testing
s

sam

08/04/2020, 7:37 PM
Arb.element(1,2,3)
you can pass in a collection or vararg
Same thing as Arb.of but I think that's 4.2 only
b

bbaldino

08/04/2020, 7:37 PM
So in this case each element would have to be the three values?
s

sam

08/04/2020, 7:37 PM
no, it's vararg
b

bbaldino

08/04/2020, 7:38 PM
Hm, ok...might be less clear this way. Maybe I'll just write them out
s

sam

08/04/2020, 7:38 PM
Your example was not a property test but a data test
so did you mean data testing in kotest ?
b

bbaldino

08/04/2020, 7:38 PM
Ah! Yes, I guess I got the terms crossed.
should be the same. If you're using a newer version, you might need to flip forall to forAll
b

bbaldino

08/04/2020, 7:39 PM
Oh, great, ok thanks Sam!
s

sam

08/04/2020, 7:39 PM
The lower case version was a hold over from Scala
b

bbaldino

08/04/2020, 7:40 PM
👍