Hedgehog


Gen Module

Namespace: Hedgehog

Assembly: Hedgehog.dll

Types and nested modules

Type/Module Description

Operators

Builder

Functions and values

Function or value Description

alpha

Full Usage: alpha

Returns: Gen<char>

Returns: Gen<char>

alphaNum

Full Usage: alphaNum

Returns: Gen<char>

Returns: Gen<char>

apply gx gf

Full Usage: apply gx gf

Parameters:
    gx : Gen<'a>
    gf : Gen<('a -> 'b)>

Returns: Gen<'b>

gx : Gen<'a>
gf : Gen<('a -> 'b)>
Returns: Gen<'b>

array range g

Full Usage: array range g

Parameters:
Returns: Gen<'a array>

Generates an array using a 'Range' to determine the length.

range : Range<int>
g : Gen<'a>
Returns: Gen<'a array>

ascii

Full Usage: ascii

Returns: Gen<char>

Generates an ASCII character: '\000'..'\127'

Returns: Gen<char>

bind k m

Full Usage: bind k m

Parameters:
    k : 'a -> Gen<'b>
    m : Gen<'a>

Returns: Gen<'b>

k : 'a -> Gen<'b>
m : Gen<'a>
Returns: Gen<'b>

bool

Full Usage: bool

Returns: Gen<bool>

Generates a random boolean.

Returns: Gen<bool>

byte range

Full Usage: byte range

Parameters:
Returns: Gen<byte>

Generates a random byte.

range : Range<byte>
Returns: Gen<byte>

char lo hi

Full Usage: char lo hi

Parameters:
    lo : char
    hi : char

Returns: Gen<char>

lo : char
hi : char
Returns: Gen<char>

choice xs0

Full Usage: choice xs0

Parameters:
    xs0 : seq<Gen<'a>>

Returns: Gen<'a>

Randomly selects one of the gens in the list. The input list must be non-empty.

xs0 : seq<Gen<'a>>
Returns: Gen<'a>

choiceRec nonrecs recs

Full Usage: choiceRec nonrecs recs

Parameters:
    nonrecs : seq<Gen<'a>>
    recs : seq<Gen<'a>>

Returns: Gen<'a>

Randomly selects from one of the gens in either the non-recursive or the recursive list. When a selection is made from the recursive list, the size is halved. When the size gets to one or less, selections are no longer made from the recursive list. The first argument (i.e. the non-recursive input list) must be non-empty.

nonrecs : seq<Gen<'a>>
recs : seq<Gen<'a>>
Returns: Gen<'a>

constant x

Full Usage: constant x

Parameters:
    x : 'a

Returns: Gen<'a>

x : 'a
Returns: Gen<'a>

create shrink random

Full Usage: create shrink random

Parameters:
    shrink : 'a -> seq<'a>
    random : Random<'a>

Returns: Gen<'a>

shrink : 'a -> seq<'a>
random : Random<'a>
Returns: Gen<'a>

dateTime range

Full Usage: dateTime range

Parameters:
Returns: Gen<DateTime>

Generates a random DateTime using the specified range. For example: let range = Range.constantFrom (DateTime (2000, 1, 1)) DateTime.MinValue DateTime.MaxValue Gen.dateTime range

range : Range<DateTime>
Returns: Gen<DateTime>

dateTimeOffset range

Full Usage: dateTimeOffset range

Parameters:
Returns: Gen<DateTimeOffset>

Generates a random DateTimeOffset using the specified range.

range : Range<DateTimeOffset>
Returns: Gen<DateTimeOffset>

decimal range

Full Usage: decimal range

Parameters:
Returns: Gen<decimal>

Generates a random decimal floating-point number.

range : Range<decimal>
Returns: Gen<decimal>

delay f

Full Usage: delay f

Parameters:
    f : unit -> Gen<'a>

Returns: Gen<'a>

f : unit -> Gen<'a>
Returns: Gen<'a>

digit

Full Usage: digit

Returns: Gen<char>

Returns: Gen<char>

double range

Full Usage: double range

Parameters:
Returns: Gen<double>

Generates a random 64-bit floating point number.

range : Range<double>
Returns: Gen<double>

filter p g

Full Usage: filter p g

Parameters:
    p : 'a -> bool
    g : Gen<'a>

Returns: Gen<'a>

Generates a value that satisfies a predicate.

p : 'a -> bool
g : Gen<'a>
Returns: Gen<'a>

frequency xs0

Full Usage: frequency xs0

Parameters:
    xs0 : seq<int * Gen<'a>>

Returns: Gen<'a>

Uses a weighted distribution to randomly select one of the gens in the list. This generator shrinks towards the first generator in the list. The input list must be non-empty.

xs0 : seq<int * Gen<'a>>
Returns: Gen<'a>

generateTree g

Full Usage: generateTree g

Parameters:
Returns: Tree<'a>

Run a generator. The size passed to the generator is always 30; if you want another size then you should explicitly use 'resize'.

g : Gen<'a>
Returns: Tree<'a>

guid

Full Usage: guid

Returns: Gen<Guid>

Generates a random globally unique identifier.

Returns: Gen<Guid>

int16 range

Full Usage: int16 range

Parameters:
Returns: Gen<int16>

Generates a random signed 16-bit integer.

range : Range<int16>
Returns: Gen<int16>

int32 range

Full Usage: int32 range

Parameters:
Returns: Gen<int32>

Generates a random signed 32-bit integer.

range : Range<int32>
Returns: Gen<int32>

int64 range

Full Usage: int64 range

Parameters:
Returns: Gen<int64>

Generates a random signed 64-bit integer.

range : Range<int64>
Returns: Gen<int64>

integral range

Full Usage: integral range

Parameters:
Returns: Gen<^a>

Generates a random number in the given inclusive range.

range : Range<^a>
Returns: Gen<^a>

item xs0

Full Usage: item xs0

Parameters:
    xs0 : seq<'a>

Returns: Gen<'a>

Randomly selects one of the values in the list. The input list must be non-empty.

xs0 : seq<'a>
Returns: Gen<'a>

latin1

Full Usage: latin1

Returns: Gen<char>

Generates a Latin-1 character: '\000'..'\255'

Returns: Gen<char>

list range gen

Full Usage: list range gen

Parameters:
Returns: Gen<List<'a>>

Generates a list using a 'Range' to determine the length.

range : Range<int>
gen : Gen<'a>
Returns: Gen<List<'a>>

lower

Full Usage: lower

Returns: Gen<char>

Returns: Gen<char>

map f g

Full Usage: map f g

Parameters:
    f : 'a -> 'b
    g : Gen<'a>

Returns: Gen<'b>

f : 'a -> 'b
g : Gen<'a>
Returns: Gen<'b>

map2 f gx gy

Full Usage: map2 f gx gy

Parameters:
    f : 'a -> 'b -> 'c
    gx : Gen<'a>
    gy : Gen<'b>

Returns: Gen<'c>

f : 'a -> 'b -> 'c
gx : Gen<'a>
gy : Gen<'b>
Returns: Gen<'c>

map3 f gx gy gz

Full Usage: map3 f gx gy gz

Parameters:
    f : 'a -> 'b -> 'c -> 'd
    gx : Gen<'a>
    gy : Gen<'b>
    gz : Gen<'c>

Returns: Gen<'d>

f : 'a -> 'b -> 'c -> 'd
gx : Gen<'a>
gy : Gen<'b>
gz : Gen<'c>
Returns: Gen<'d>

map4 f gx gy gz gw

Full Usage: map4 f gx gy gz gw

Parameters:
    f : 'a -> 'b -> 'c -> 'd -> 'e
    gx : Gen<'a>
    gy : Gen<'b>
    gz : Gen<'c>
    gw : Gen<'d>

Returns: Gen<'e>

f : 'a -> 'b -> 'c -> 'd -> 'e
gx : Gen<'a>
gy : Gen<'b>
gz : Gen<'c>
gw : Gen<'d>
Returns: Gen<'e>

mapRandom f g

Full Usage: mapRandom f g

Parameters:
Returns: Gen<'b>

f : Random<Tree<'a>> -> Random<Tree<'b>>
g : Gen<'a>
Returns: Gen<'b>

mapTree f g

Full Usage: mapTree f g

Parameters:
Returns: Gen<'b>

f : Tree<'a> -> Tree<'b>
g : Gen<'a>
Returns: Gen<'b>

noShrink g

Full Usage: noShrink g

Parameters:
Returns: Gen<'a>

Prevent a 'Gen' from shrinking.

g : Gen<'a>
Returns: Gen<'a>

ofRandom r

Full Usage: ofRandom r

Parameters:
Returns: Gen<'a>

r : Random<Tree<'a>>
Returns: Gen<'a>

option g

Full Usage: option g

Parameters:
Returns: Gen<'a option>

Generates a 'None' part of the time.

g : Gen<'a>
Returns: Gen<'a option>

renderSample gen

Full Usage: renderSample gen

Parameters:
    gen : Gen<'a>

Returns: string

gen : Gen<'a>
Returns: string

resize n g

Full Usage: resize n g

Parameters:
    n : int
    g : Gen<'a>

Returns: Gen<'a>

Overrides the size parameter. Returns a generator which uses the given size instead of the runtime-size parameter.

n : int
g : Gen<'a>
Returns: Gen<'a>

sample size count g

Full Usage: sample size count g

Parameters:
    size : Size
    count : int
    g : Gen<'a>

Returns: seq<'a>

size : Size
count : int
g : Gen<'a>
Returns: seq<'a>

sampleTree size count g

Full Usage: sampleTree size count g

Parameters:
    size : Size
    count : int
    g : Gen<'a>

Returns: seq<Tree<'a>>

size : Size
count : int
g : Gen<'a>
Returns: seq<Tree<'a>>

sbyte range

Full Usage: sbyte range

Parameters:
Returns: Gen<sbyte>

Generates a random signed byte.

range : Range<sbyte>
Returns: Gen<sbyte>

scale f g

Full Usage: scale f g

Parameters:
    f : int -> int
    g : Gen<'a>

Returns: Gen<'a>

Adjust the size parameter, by transforming it with the given function.

f : int -> int
g : Gen<'a>
Returns: Gen<'a>

seq range g

Full Usage: seq range g

Parameters:
Returns: Gen<seq<'a>>

Generates a sequence using a 'Range' to determine the length.

range : Range<int>
g : Gen<'a>
Returns: Gen<seq<'a>>

shrink f g

Full Usage: shrink f g

Parameters:
Returns: Gen<'a>

Apply an additional shrinker to all generated trees.

f : 'a -> List<'a>
g : Gen<'a>
Returns: Gen<'a>

shrinkLazy f g

Full Usage: shrinkLazy f g

Parameters:
    f : 'a -> seq<'a>
    g : Gen<'a>

Returns: Gen<'a>

Apply an additional shrinker to all generated trees.

f : 'a -> seq<'a>
g : Gen<'a>
Returns: Gen<'a>

single range

Full Usage: single range

Parameters:
Returns: Gen<single>

Generates a random 32-bit floating point number.

range : Range<single>
Returns: Gen<single>

sized f

Full Usage: sized f

Parameters:
Returns: Gen<'a>

Used to construct generators that depend on the size parameter.

f : Size -> Gen<'a>
Returns: Gen<'a>

some g

Full Usage: some g

Parameters:
    g : Gen<'a option>

Returns: Gen<'a>

Runs an option generator until it produces a 'Some'.

g : Gen<'a option>
Returns: Gen<'a>

string range g

Full Usage: string range g

Parameters:
Returns: Gen<string>

Generates a random string using 'Range' to determine the length and the specified character generator.

range : Range<int>
g : Gen<char>
Returns: Gen<string>

toRandom arg1

Full Usage: toRandom arg1

Parameters:
    arg0 : Gen<'a>

Returns: Random<Tree<'a>>

arg0 : Gen<'a>
Returns: Random<Tree<'a>>

tryFilter p g

Full Usage: tryFilter p g

Parameters:
    p : 'a -> bool
    g : Gen<'a>

Returns: Gen<'a option>

Tries to generate a value that satisfies a predicate.

p : 'a -> bool
g : Gen<'a>
Returns: Gen<'a option>

tryFinally after m

Full Usage: tryFinally after m

Parameters:
    after : unit -> unit
    m : Gen<'a>

Returns: Gen<'a>

after : unit -> unit
m : Gen<'a>
Returns: Gen<'a>

tryWith k m

Full Usage: tryWith k m

Parameters:
    k : exn -> Gen<'a>
    m : Gen<'a>

Returns: Gen<'a>

k : exn -> Gen<'a>
m : Gen<'a>
Returns: Gen<'a>

tuple g

Full Usage: tuple g

Parameters:
Returns: Gen<'a * 'a>

g : Gen<'a>
Returns: Gen<'a * 'a>

tuple3 g

Full Usage: tuple3 g

Parameters:
Returns: Gen<'a * 'a * 'a>

g : Gen<'a>
Returns: Gen<'a * 'a * 'a>

tuple4 g

Full Usage: tuple4 g

Parameters:
Returns: Gen<'a * 'a * 'a * 'a>

g : Gen<'a>
Returns: Gen<'a * 'a * 'a * 'a>

uint16 range

Full Usage: uint16 range

Parameters:
Returns: Gen<uint16>

Generates a random unsigned 16-bit integer.

range : Range<uint16>
Returns: Gen<uint16>

uint32 range

Full Usage: uint32 range

Parameters:
Returns: Gen<uint32>

Generates a random unsigned 32-bit integer.

range : Range<uint32>
Returns: Gen<uint32>

uint64 range

Full Usage: uint64 range

Parameters:
Returns: Gen<uint64>

Generates a random unsigned 64-bit integer.

range : Range<uint64>
Returns: Gen<uint64>

unicode

Full Usage: unicode

Returns: Gen<char>

Generates a Unicode character, excluding noncharacters ('\65534', '\65535') and invalid standalone surrogates ('\000'..'\65535' excluding '\55296'..'\57343').

Returns: Gen<char>

unicodeAll

Full Usage: unicodeAll

Returns: Gen<char>

Generates a Unicode character, including invalid standalone surrogates: '\000'..'\65535'

Returns: Gen<char>

upper

Full Usage: upper

Returns: Gen<char>

Returns: Gen<char>

zip gx gy

Full Usage: zip gx gy

Parameters:
Returns: Gen<'a * 'b>

gx : Gen<'a>
gy : Gen<'b>
Returns: Gen<'a * 'b>

zip3 gx gy gz

Full Usage: zip3 gx gy gz

Parameters:
Returns: Gen<'a * 'b * 'c>

gx : Gen<'a>
gy : Gen<'b>
gz : Gen<'c>
Returns: Gen<'a * 'b * 'c>

zip4 gx gy gz gw

Full Usage: zip4 gx gy gz gw

Parameters:
Returns: Gen<'a * 'b * 'c * 'd>

gx : Gen<'a>
gy : Gen<'b>
gz : Gen<'c>
gw : Gen<'d>
Returns: Gen<'a * 'b * 'c * 'd>