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 _max_size)
 
void WithMinSize (unsigned _min_size)
 
void WithSize (unsigned _size)
 

Public Attributes

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

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
auto domain = ContainerOf<std::set<std::string>>(Arbitrary<std::string>());
// 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:28

Member Function Documentation

◆ WithMaxSize()

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

◆ WithMinSize()

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

◆ WithSize()

void zeroerr::ContainerOfBase::WithSize ( unsigned  _size)
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: