Ir al contenido principal
Versión: 5.2.x

Generadores de Arrow

[Traducción Beta No Oficial]

Esta página fue traducida por PageTurner AI (beta). No está respaldada oficialmente por el proyecto. ¿Encontraste un error? Reportar problema →

Kotest ofrece un módulo opcional que proporciona generadores para Arrow.

nota

Para utilizarlo, añade io.kotest.extensions:kotest-property-arrow:version e io.arrow-kt:arrow-core:arrow-version a tu build. Lo mismo aplica para el módulo de ópticas kotest-property-arrow-optics, añadiendo también io.arrow-kt:arrow-optics:arrow-version.

GeneratorDescription
Either
Arb.either(arbL, arbR)Generates approx 50/50 of left and right from the underlying generators.
Arb.right(arb)Generates instances of [Either.Right] using the given arb.
Arb.left(arb)Generates instances of [Either.Left] using the given arb.
NonEmptyList
Arb.nel(arb)Generates NonEmptyList instances with a size randomly choosen between 1 and 100, with elements populated from the given arb.
Arb.nel(arb, range)Generates NonEmptyList instances with a size randomly chosen from the given range, with elements populated from the given arb.
Option
Exhaustive.option(a)Returns an Exhaustive that contains a None and a Some with the given value.
Exhaustive.none(a)Returns an Exhaustive that contains None.
Arb.option(arb)Generates both None and Some with Some's populated with values from the given arb.
Arb.some(arb)Generates Some's populated with values from the given arb.
Arb.none()A constant arb that returns None. Equivalent to Exhaustive.None and provided only for use when an Arb is required.
Endo
Arb.endo(arb)Wraps values from the underlying arb in Endo instances.
Eval
Arb<A>.evalNow()Wraps values from the receiver in Eval.now.
Validated
Arb.validated(invalid, valid)Generates approx 50/50 of valid and invalid Validated instances using the supplied arbs for values
Arb.validatedNel(invalid, valid)Generates approx 50/50 of valid and invalid ValidatedNel instances using the supplied arbs for values