wheatley
library
Classes
Candidate <T >
Represents a value that is a candidate that could possibly falsify a property. Candidate s can be shrunk to make
them "simpler", in order to find the simplest possible input that still falsifies the property.
Extensions
Function2Ext
on Out Function(In1 , In2 )
Function3Ext
on Out Function(In1 , In2 , In3 )
Function4Ext
on Out Function(In1 , In2 , In3 , In4 )
Function5Ext
on Out Function(In1 , In2 , In3 , In4 , In5 )
Function6Ext
on Out Function(In1 , In2 , In3 , In4 , In5 , In6 )
Function7Ext
on Out Function(In1 , In2 , In3 , In4 , In5 , In6 , In7 )
Function8Ext
on Out Function(In1 , In2 , In3 , In4 , In5 , In6 , In7 , In8 )
GeneratorExtensions
on Generator <T >
Useful methods on Generator s.
StringGeneratorExtension
on Generator <String >
Tuple2GeneratorExtension
on (Generator <T1 > , Generator <T2 > )
Tuple3GeneratorExtension
on (Generator <T1 > , Generator <T2 > , Generator <T3 > )
Tuple4GeneratorExtension
on (Generator <T1 > , Generator <T2 > , Generator <T3 > , Generator <T4 > )
Tuple5GeneratorExtension
on (Generator <T1 > , Generator <T2 > , Generator <T3 > , Generator <T4 > , Generator <T5 > )
Tuple6GeneratorExtension
on (Generator <T1 > , Generator <T2 > , Generator <T3 > , Generator <T4 > , Generator <T5 > , Generator <T6 > )
Tuple7GeneratorExtension
on (Generator <T1 > , Generator <T2 > , Generator <T3 > , Generator <T4 > , Generator <T5 > , Generator <T6 > , Generator <T7 > )
Tuple8GeneratorExtension
on (Generator <T1 > , Generator <T2 > , Generator <T3 > , Generator <T4 > , Generator <T5 > , Generator <T6 > , Generator <T7 > , Generator <T8 > )
Functions
always <T > (T value )
→ Generator <T >
Always generates the same value.
bigInt ({BigInt ? min , BigInt ? max , BigInt ? shrinkInterval })
→ Generator <BigInt >
Generates a random BigInt value uniformly distributed in the range from min
, inclusive, to max
,
exclusive.
dateTime ({DateTime ? min = const NoDateTimeProvided() , DateTime ? max })
→ Generator <DateTime >
A generator that returns DateTime s.
duration ({Duration ? min = const NoDurationProvided() , Duration ? max })
→ Generator <Duration >
A generator that returns Duration s.
float ({double ? min , double ? max , double shrinkInterval = 1 })
→ Generator <double >
Generates a random floating point value uniformly distributed in the range from min
, inclusive, to max
,
exclusive.
forAll <T > (Generator <T > generator , {ExploreConfig config = const ExploreConfig() , void log (String message ) = print })
→ Future <void > Function(FutureOr <void > (T ) )
Executes the given body with a bunch of parameters, trying to break it.
forAll2 <T1 , T2 > (Generator <T1 > generator1 , Generator <T2 > generator2 , {ExploreConfig config = const ExploreConfig() , void log (String message ) = print })
→ Future <void > Function(FutureOr <void > (T1 , T2 ) )
forAll3 <T1 , T2 , T3 > (Generator <T1 > generator1 , Generator <T2 > generator2 , Generator <T3 > generator3 , {ExploreConfig config = const ExploreConfig() , void log (String message ) = print })
→ Future <void > Function(FutureOr <void > (T1 , T2 , T3 ) )
forAll4 <T1 , T2 , T3 , T4 > (Generator <T1 > generator1 , Generator <T2 > generator2 , Generator <T3 > generator3 , Generator <T4 > generator4 , {ExploreConfig config = const ExploreConfig() , void log (String message ) = print })
→ Future <void > Function(FutureOr <void > (T1 , T2 , T3 , T4 ) )
forAll5 <T1 , T2 , T3 , T4 , T5 > (Generator <T1 > generator1 , Generator <T2 > generator2 , Generator <T3 > generator3 , Generator <T4 > generator4 , Generator <T5 > generator5 , {ExploreConfig config = const ExploreConfig() , void log (String message ) = print })
→ Future <void > Function(FutureOr <void > (T1 , T2 , T3 , T4 , T5 ) )
forAll6 <T1 , T2 , T3 , T4 , T5 , T6 > (Generator <T1 > generator1 , Generator <T2 > generator2 , Generator <T3 > generator3 , Generator <T4 > generator4 , Generator <T5 > generator5 , Generator <T6 > generator6 , {ExploreConfig config = const ExploreConfig() , void log (String message ) = print })
→ Future <void > Function(FutureOr <void > (T1 , T2 , T3 , T4 , T5 , T6 ) )
forAll7 <T1 , T2 , T3 , T4 , T5 , T6 , T7 > (Generator <T1 > generator1 , Generator <T2 > generator2 , Generator <T3 > generator3 , Generator <T4 > generator4 , Generator <T5 > generator5 , Generator <T6 > generator6 , Generator <T7 > generator7 , {ExploreConfig config = const ExploreConfig() , void log (String message ) = print })
→ Future <void > Function(FutureOr <void > (T1 , T2 , T3 , T4 , T5 , T6 , T7 ) )
forAll8 <T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 > (Generator <T1 > generator1 , Generator <T2 > generator2 , Generator <T3 > generator3 , Generator <T4 > generator4 , Generator <T5 > generator5 , Generator <T6 > generator6 , Generator <T7 > generator7 , Generator <T8 > generator8 , {ExploreConfig config = const ExploreConfig() , void log (String message ) = print })
→ Future <void > Function(FutureOr <void > (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ) )
generator <T > ({required T generate (Random random , int size ), Iterable <T > shrink (T input )?, void dispose (T value )? })
→ Generator <T >
Creates a new, simple Generator that produces values and knows how to
simplify them.
integer ({int ? min , int ? max , int shrinkInterval = 1 })
→ Generator <int >
Generates a random integer uniformly distributed in the range from min
, inclusive, to max
, exclusive.
listOf <T > (Generator <T > item , {int minSize = 0 , int ? maxSize })
→ Generator <List <T > >
Generates a list of random length, containing items from the provided item
generator.
mapOf <K , V > (Generator <K > key , Generator <V > value , {int minSize = 0 , int ? maxSize })
→ Generator <Map <K , V > >
Generates a map of random size, containing items from the provided key
, and value
generators.
negativeDouble ({double shrinkInterval = 1 })
→ Generator <double >
negativeInteger ({int ? min })
→ Generator <int >
nonNegativeDouble ({double shrinkInterval = 1 })
→ Generator <double >
nonNegativeInteger ({int ? max })
→ Generator <int >
nonPositiveDouble ({double shrinkInterval = 1 })
→ Generator <double >
nonPositiveInteger ({int ? min })
→ Generator <int >
number ({num ? min , num ? max , num shrinkInterval = 1.0 })
→ Generator <num >
Generates a random number uniformly distributed in the range from min
, inclusive, to max
, exclusive.
oneOf <T > (Iterable <T > values )
→ Generator <T >
Chooses between the given values. Values further at the front of the list are considered less complex.
positiveDouble ({double shrinkInterval = 1 })
→ Generator <double >
positiveInteger ({int ? max })
→ Generator <int >
setOf <T > (Set <T > items , {int minSize = 0 , int ? maxSize })
→ Generator <Set <T > >
Generates a set of random length, containing items from the provided set of items items
.items
string ({String chars = asciiAlphaNumeric , int minSize = 0 , int ? maxSize })
→ Generator <String >
A generator that returns String s.
Typedefs
Generator <T >
= Candidate <T > Function(Random random , int size )
A Generator makes it possible to use Wheatley to test type T
.
Generates a new Candidate of type T
, using size
as a rough
complexity estimate. The random
instance should be used as a source for
all pseudo-randomness.