FsCheck


Arb

Namespace: FsCheck

Nested types and modules

TypeDescription
Default

Functions and values

Function or valueDescription
convert convertTo convertFrom a
Signature: convertTo:('a -> 'b) -> convertFrom:('b -> 'a) -> a:Arbitrary<'a> -> Arbitrary<'b>
Type parameters: 'a, 'b

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.

CompiledName: Convert

filter pred a
Signature: pred:('a -> bool) -> a:Arbitrary<'a> -> Arbitrary<'a>
Type parameters: 'a

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.

CompiledName: Filter

from
Signature: Arbitrary<'Value>
Type parameters: 'Value

Get the Arbitrary instance for the given type.

CompiledName: From

fromGen gen
Signature: gen:Gen<'Value> -> Arbitrary<'Value>
Type parameters: 'Value

Construct an Arbitrary instance from a generator. Shrink is not supported for this type.

CompiledName: From

fromGenShrink (gen, shrinker)
Signature: (gen:Gen<'Value> * shrinker:('Value -> seq<'Value>)) -> Arbitrary<'Value>
Type parameters: 'Value

Construct an Arbitrary instance from a generator and shrinker.

CompiledName: From

fromGenShrinkFunc (gen, shrinker)
Signature: (gen:Gen<'Value> * shrinker:Func<'Value,seq<'Value>>) -> Arbitrary<'Value>
Type parameters: 'Value

Construct an Arbitrary instance from a generator and shrinker.

CompiledName: From

generate
Signature: Gen<'Value>
Type parameters: 'Value

Returns a Gen<'Value>

CompiledName: Generate

mapFilter mapper pred a
Signature: mapper:('a -> 'a) -> pred:('a -> bool) -> a:Arbitrary<'a> -> Arbitrary<'a>
Type parameters: 'a

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.

CompiledName: MapFilter

register ()
Signature: unit -> TypeClassComparison
Type parameters: 't

Register the generators that are static members of the type argument.

CompiledName: Register

registerByType t
Signature: t:Type -> TypeClassComparison

Register the generators that are static members of the given type.

CompiledName: Register

shrink a
Signature: a:'Value -> seq<'Value>
Type parameters: 'Value

Returns the immediate shrinks for the given value based on its type.

CompiledName: Shrink

shrinkNumber n
Signature: n:^?74105 -> seq<^?74105>
Type parameters: ^?74105, ^?74106, ^?74107, ^?74108

A generic shrinker that should work for most number-like types.

toGen arb
Signature: arb:Arbitrary<'Value> -> Gen<'Value>
Type parameters: 'Value
toShrink arb
Signature: arb:Arbitrary<'Value> -> 'Value -> seq<'Value>
Type parameters: 'Value
Fork me on GitHub