ZeroErr
Loading...
Searching...
No Matches
zeroerr::ContainerOfBase Struct Reference

ContainerOf is a domain that generates random containers filled with elements from an inner domain. More...

#include <container_of.h>

Inheritance diagram for zeroerr::ContainerOfBase:

Public Member Functions

void WithMaxSize (unsigned value)
void WithMinSize (unsigned value)
void WithSize (unsigned value)

Public Attributes

int min_size = 0
int max_size = 100
int size = -1

Protected Member Functions

void validate () const
unsigned randomSize (Rng &rng) const
template<class Inner, class Corpus>
void mutate (Rng &rng, Corpus &v, bool only_shrink, const Inner &inner) const

Static Protected Member Functions

static int checkedSize (unsigned value)

Detailed Description

ContainerOf is a domain that generates random containers filled with elements from an inner domain.

Template Parameters
TThe container type to generate (e.g. vector, list, set)
InnerDomainThe domain type used to generate the container elements

This domain allows generating containers where each element is generated by an inner domain. It supports configuring the size constraints of the generated containers.

Example:

// Generate vectors of ints between 0-100
auto domain = ContainerOf<std::vector<int>>(InRange(0, 100));
// Generate sets of strings
// Configure size constraints
domain.WithMinSize(5); // At least 5 elements
domain.WithMaxSize(10); // At most 10 elements
domain.WithSize(7); // Exactly 7 elements
Arbitrary is a domain that generates random values of a given type.
Definition arbitrary.h:42
InRange is a domain that generates random values within a specified range.
Definition in_range.h:31
std::enable_if< detail::is_associative_container< T >::value, AssociativeContainerOf< T, Inner > >::type ContainerOf(Inner &&inner)
Definition container_of.h:174

Member Function Documentation

◆ checkedSize()

int zeroerr::ContainerOfBase::checkedSize ( unsigned value)
inlinestaticprotected

◆ mutate()

template<class Inner, class Corpus>
void zeroerr::ContainerOfBase::mutate ( Rng & rng,
Corpus & v,
bool only_shrink,
const Inner & inner ) const
inlineprotected

◆ randomSize()

unsigned zeroerr::ContainerOfBase::randomSize ( Rng & rng) const
inlineprotected

◆ validate()

void zeroerr::ContainerOfBase::validate ( ) const
inlineprotected

◆ WithMaxSize()

void zeroerr::ContainerOfBase::WithMaxSize ( unsigned value)
inline

◆ WithMinSize()

void zeroerr::ContainerOfBase::WithMinSize ( unsigned value)
inline

◆ WithSize()

void zeroerr::ContainerOfBase::WithSize ( unsigned value)
inline

Member Data Documentation

◆ max_size

int zeroerr::ContainerOfBase::max_size = 100

◆ min_size

int zeroerr::ContainerOfBase::min_size = 0

◆ size

int zeroerr::ContainerOfBase::size = -1

The documentation for this struct was generated from the following file: