Logo FsCheck

Arb Type

Static members

Static member Description

Arb.Array(elements)

Full Usage: Arb.Array(elements)

Parameters:
Returns: Arbitrary<'T[]>
Type parameters: 'T

Generates one-dimensional arrays. The length of the generated array is between 0 and size. The sum of the sizes of the elements is equal to the size of the generated array.

elements : Arbitrary<'T>
Returns: Arbitrary<'T[]>

Arb.Convert(arb, convertTo, convertFrom)

Full Usage: Arb.Convert(arb, convertTo, convertFrom)

Parameters:
Returns: Arbitrary<'U>
Type parameters: 'T, 'U

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.

arb : Arbitrary<'T>
convertTo : Func<'T, 'U>
convertFrom : Func<'U, 'T>
Returns: Arbitrary<'U>

Arb.Filter(arb, filter)

Full Usage: Arb.Filter(arb, filter)

Parameters:
Returns: Arbitrary<'T>
Type parameters: 'T

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

arb : Arbitrary<'T>
filter : Func<'T, bool>
Returns: Arbitrary<'T>

Arb.From(gen, shrinker)

Full Usage: Arb.From(gen, shrinker)

Parameters:
    gen : Gen<'Value>
    shrinker : Func<'Value, 'Value seq>

Returns: Arbitrary<'Value>
Type parameters: 'Value

Construct an Arbitrary instance from a generator and shrinker.

gen : Gen<'Value>
shrinker : Func<'Value, 'Value seq>
Returns: Arbitrary<'Value>

Arb.From(gen)

Full Usage: Arb.From(gen)

Parameters:
    gen : Gen<'Value>

Returns: Arbitrary<'Value>
Type parameters: 'Value

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

gen : Gen<'Value>
Returns: Arbitrary<'Value>

Arb.MapFilter(arb, map, filter)

Full Usage: Arb.MapFilter(arb, map, filter)

Parameters:
Returns: Arbitrary<'T>
Type parameters: 'T
 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.where 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.
arb : Arbitrary<'T>
map : Func<'T, 'T>
filter : Func<'T, bool>
Returns: Arbitrary<'T>

Arb.Nullable(value)

Full Usage: Arb.Nullable(value)

Parameters:
Returns: Arbitrary<Nullable<'T>>
Type parameters: 'T (requires (new : unit -> 'T) and struct and :> System.ValueType)

Generates nullable values that are null 1/8 of the time.

value : Arbitrary<'T>
Returns: Arbitrary<Nullable<'T>>

Arb.ToArbitrary(gen, shrinker)

Full Usage: Arb.ToArbitrary(gen, shrinker)

Parameters:
    gen : Gen<'Value>
    shrinker : Func<'Value, 'Value seq>

Returns: Arbitrary<'Value>
Type parameters: 'Value

Construct an Arbitrary instance from a generator and shrinker.

gen : Gen<'Value>
shrinker : Func<'Value, 'Value seq>
Returns: Arbitrary<'Value>

Arb.ToArbitrary(generator)

Full Usage: Arb.ToArbitrary(generator)

Parameters:
    generator : Gen<'T>

Returns: Arbitrary<'T>
Type parameters: 'T

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

generator : Gen<'T>
Returns: Arbitrary<'T>

Arb.Zip(t1, t2)

Full Usage: Arb.Zip(t1, t2)

Parameters:
Returns: Arbitrary<'T1 * 'T2>
Type parameters: 'T1, 'T2

Generates 2-tuples.

t1 : Arbitrary<'T1>
t2 : Arbitrary<'T2>
Returns: Arbitrary<'T1 * 'T2>

Type something to start searching.