FsCheck


ArbitraryExtensions

Namespace: FsCheck
Attributes:
[<Extension>]

Extensons to transform Arbitrary instances into other Arbitrary instances.

Static members

Static memberDescription
ArbitraryExtensions.Convert(...)
Signature: (arb:Arbitrary<'?200956> * convertTo:Func<'?200956,'?200957> * convertFrom:Func<'?200957,'?200956>) -> Arbitrary<'?200957>
Type parameters: '?200956, '?200957 Attributes:
[<Extension>]

Construct an Arbitrary instance for a type that can be mapped to and from another type (e.g. a wrapper), based on a Arbitrary instance for the source type and two mapping functions.

ArbitraryExtensions.Filter(arb, filter)
Signature: (arb:Arbitrary<'?200959> * filter:Func<'?200959,bool>) -> Arbitrary<'?200959>
Type parameters: '?200959 Attributes:
[<Extension>]

Return an Arbitrary instance that is a filtered version of an existing arbitrary instance. The generator uses Gen.suchThat, and the shrinks are filtered using Seq.filter with the given predicate.

ArbitraryExtensions.MapFilter(...)
Signature: (arb:Arbitrary<'?200961> * map:Func<'?200961,'?200961> * filter:Func<'?200961,bool>) -> Arbitrary<'?200961>
Type parameters: '?200961 Attributes:
[<Extension>]

Return an Arbitrary instance that is a mapped and filtered version of an existing arbitrary instance. The generator uses Gen.map with the given mapper and then Gen.suchThat with the given predicate, and the shrinks are filtered using Seq.filter with the given predicate. This is sometimes useful if using just a filter would reduce the chance of getting a good value from the generator - and you can map the value instead. E.g. PositiveInt.

Fork me on GitHub