halcheck 1.0
Loading...
Searching...
No Matches
halcheck::gen Namespace Reference

Random generation library. More...

Classes

struct  discard_exception
 An exception type thrown to indicate that the current test case is invalid. More...
 
struct  is_arbitrary
 Determines if a type supports generating arbitrary values. More...
 
struct  label_effect
 An effect for extending unique identifiers passed to other random generation functions. More...
 
struct  result_exception
 A special exception type used to indicate an abnormal but non-failing result. More...
 
struct  sample_effect
 An effect for generating random data. More...
 
struct  size_effect
 An effect for obtaining a size parameter. More...
 
struct  succeed_effect
 An effect for indicating that no more test cases should be generated for the current test. More...
 

Functions

template<typename T >
arbitrary (lib::atom id)
 Generates an arbitrary value of a given type.
 
template<typename T , typename F >
container (lib::atom id, F gen)
 Generates a random container value.
 
template<typename T , typename F >
container (lib::atom id, std::size_t size, F gen)
 Generates a random container value.
 
template<typename I >
void shuffle (lib::atom id, I begin, I end)
 
template<typename Range >
void shuffle (lib::atom id, Range &&range)
 
template<typename F >
lib::dag< lib::tuple_element_t< 1, lib::invoke_result_t< F, lib::atom > > > schedule (lib::atom id, F func)
 Generates a random lib::dag.
 
void guard (bool cond)
 Throws a gen::discard_exception if the given condition is false.
 
void succeed ()
 Indicates that no more test cases should be generated for the current test.
 
template<typename F >
lib::invoke_result_t< F, lib::atomretry (lib::atom id, std::uintmax_t max, F func)
 Executes a function. If the function calls discard, then it is retried, up to a certain number of times.
 
template<typename F >
lib::invoke_result_t< F, lib::atomretry (lib::atom id, F func)
 Executes a function. If the function calls discard, then it is retried, up to 100 times.
 
std::uintmax_t size ()
 Gets the maximum size of value that should be generated.
 
template<std::size_t... Ints>
lib::variant< std::integral_constant< std::size_t, Ints >... > index (lib::atom id, lib::index_sequence< Ints... >={})
 Generates a random std::integral_constant from the given set of indices.
 
template<typename... Fs>
lib::variant< lib::invoke_result_t< Fs, lib::atom >... > variant (lib::atom id, Fs... gens)
 Constructs a random variant.
 
template<typename T , typename... Fs>
one (lib::atom id, lib::in_place_type_t< T >, Fs... gens)
 Generates a value according to a randomly selected generator.
 
template<typename... Args>
lib::common_type_t< lib::invoke_result_t< Args, lib::atom >... > one (lib::atom id, Args... args)
 Generates a value according to a randomly selected generator.
 

Variables

struct { 
 
view 
 
class { 
 
repeat 
 
struct { 
 
element_of 
 Generates a random element of a range.
 
struct { 
 
element 
 Generates a random value from a fixed list of elements.
 
struct { 
 
make_forward_shrinks 
 
struct { 
 
label 
 Extends the unique identifiers passed to other random generation functions.
 
struct { 
 
optional 
 Generates a lib::optional.
 
static const range_t range
 Generates a random value in an closed-open interval.
 
struct { 
 
sample 
 Obtains a random value.
 
struct { 
 
shrink 
 
struct { 
 
shrink_to 
 
struct { 
 
   struct handler
 
using scope
 A type of object whose lifetime determines how long the set of effect handlers are overriden.
 
using owning_scope
 A type of object whose lifetime determines how long the set of effect handlers are overriden.
 
scope handle () &
 Overrides the behaviour of a set of effects.
 
owning_scope handle () &&
 Overrides the behaviour of a set of effects.
 
lib::invoke_result_t< F, Args... > handle (F func, Args &&...args)
 Invokes a function, handling any effects using this handler.
 
   }  
 
noshrink 
 
struct { 
 
make_shrinks 
 
struct { 
 
scale 
 Applies a multiplier to the result of gen::size.
 

Detailed Description

Random generation library.