package bam
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=d8d40b5abf6242d32194cf0b0eb030fe901d67cb1c53ac7ed77d47bb8a0c754f
sha512=7a7b52e6b1acf16faa4cd514bb947f733e54aa3a52719225734de3dbd869f14156c16532f2ba115cbcad640b0ecc54611021f5d8632213e07d331a5600a03a14
doc/bam/Bam/Std/index.html
Module Bam.Std
Source
Main module defining basic generators.
This module contains the various strinking strategies which can be used with the generators below.
bind gen f
returns a new generator depending on another generator. This should be the main building block to construct new generator. To understand how shrinking works with this operator please read shrinking
.
root gen f
applies f
on the original value generated by gen
and forgets about the shrinking. Hence, f
is always applied to a single value. More details in shrinking
.
crunch i gen
returns a new generator with a more aggressive shrinking. It increases the number of values that will be used during the shrinking. More details in shrinking
.
of_seq seq
returns a generator that will produce successively the values of the sequence until the sequence is empty. Those values are intended to be used as the root argument of other generators.
int ?root ?shrinker ?(min=0) ?(max=Int.max_int) ()
is a generator for integers. Bounds are inclusive.
Default strategy is Shrinker.t.Int
0
.
val int32 :
?root:int32 ->
?shrinker:int32 Shrinker.t ->
?min:int32 ->
?max:int32 ->
unit ->
int32 t
int ?root ?shrinker ?(min=0) ?(max=Int.max_int) ()
is a generator for integers. Bounds are inclusive.
Default strategy is Shrinker.t.Int
0
.
val int64 :
?root:int64 ->
?shrinker:int64 Shrinker.t ->
?min:int64 ->
?max:int64 ->
unit ->
int64 t
int ?root ?shrinker ?(min=0) ?(max=Int.max_int) ()
is a generator for integers. Bounds are inclusive.
Default strategy is Shrinker.t.Int
0
.
val float :
?root:float ->
?shrinker:float Shrinker.t ->
?min:float ->
?max:float ->
unit ->
float t
float ?root ?shrinker ?(min=0.) ?(max=Float.max_float) ()
generates integers. Bounds are inclusive.
Default strategy is Shrinker.t.Float
0.
.
pair ?shrinker left right ()
generates a pair using the left
and right
generators.
Default strategy is Shrinker.t.Pair_left
.
bool ?shrinker ()
generates a boolean.x
Default strategy is Shrinker.t.Bool
false
.
char ?root ?shrinker ?(printable=true) ()
generates a char.
Default strategy is Shrinker.t.Char
'a
.
list ?shrinker ~size gen ()
generates a list of values using gen
.
Default strategy is Shrinker.t.Prefix
.
val string :
?shrinker:Char.t list Shrinker.t ->
?char:Char.t t ->
size:int t ->
unit ->
string t
string ?shrinker ?char ~size ()
is mostly an alias for list ?shrinker ~char:(char ())
.
val bytes :
?shrinker:Char.t list Shrinker.t ->
?char:Char.t t ->
size:int t ->
unit ->
bytes t
bytes ?shrinker ?char ~size ()
is mostly an alias for list ?shrinker ~char:(char ~printable:false ()) ()
.
oneof ?shrinker list
pick one generator of the list according to the distribution defined by the first elements of the list.
Default strategy is the same as for int
. This generator can be thought as a repeated list of generators. The shrinker will choose particular index from the list.
oneofg ?shrinker list
is an alias for oneof ?shrinker (List.map (fun gen -> (1, gen)) list)
oneofl ?shrinker list
is an alias for oneofg ?shrinker (List.map Gen.return list