OpenVPN 3 Core Library
Loading...
Searching...
No Matches
rc Namespace Reference

Namespaces

namespace  helpers
 

Classes

struct  Arbitrary< openvpn::IP::Addr::Version >
 V4 or V6, the versions an address string can carry. More...
 
struct  Arbitrary< openvpn::IP::AddrMaskPair >
 
struct  Arbitrary< openvpn::TunBuilderCapture::Route >
 Specialization of the Arbitrary template for TunBuilderCapture::Route. More...
 
struct  Arbitrary< openvpn::TunBuilderCapture::RouteAddress >
 Specialization of the Arbitrary struct for RouteAddress. More...
 
struct  Arbitrary< openvpn::TunBuilderCapture::RouteBase >
 Specialization of Arbitrary for the RouteBase type. More...
 
struct  Arbitrary< RedirectGatewayFlagsValues >
 Template specialization for generating arbitrary RedirectGatewayFlagsValues. More...
 
struct  Arbitrary< std::variant< T, Ts... > >
 Specialization of Arbitrary for creating arbitrary std::variant values. More...
 

Typedefs

using RedirectGatewayFlagsValues = openvpn::RedirectGatewayFlags::Flags
 
using RouteBased = std::variant< openvpn::TunBuilderCapture::Route, openvpn::TunBuilderCapture::RouteAddress, openvpn::TunBuilderCapture::RouteBase >
 Alias representing a route-based variant type.
 

Functions

template<size_t N>
auto atLeastOneFalse () -> Gen< std::array< bool, N > >
 Generates an array of booleans that contains at least one false.
 
template<size_t N>
auto generateValidityFlags (const bool all_valid=true) -> Gen< std::array< bool, N > >
 Generates an array of validity flags for component testing.
 
auto IPv4Octet (const bool valid=true) -> Gen< int >
 Generates a valid or invalid IPv4 octet value.
 
auto IPv4Address (const bool valid=true) -> Gen< std::string >
 Generates a random IPv4 address.
 
auto asciiPrintableCode () -> Gen< int >
 Generates a random printable ASCII character code.
 
auto hexChar (const bool valid=true) -> Gen< std::string >
 Generates a valid or invalid hexadecimal character.
 
auto IPv6HextetValue (const bool valid=true) -> Gen< std::string >
 Generates a hextet value of an IPv6 address.
 
std::string removeLeadingZerosFromHextet (const std::string &hextet)
 Removes leading zeros from a hextet (IPv6 segment).
 
void removeLeadingZerosFromHextets (std::vector< std::string > &hextets)
 Removes leading zeros from a vector of hextets.
 
void replaceSequenceOfZerosWithDoubleColon (std::vector< std::string > &hextets)
 Replaces the longest sequence of consecutive "0" strings in a vector with "::".
 
std::string stringifyHextetsToAddressWithColons (const std::vector< std::string > &hextets)
 Converts a vector of hextets to an IPv6 address string with colons.
 
std::string compressIPv6Address (std::vector< std::string > hextets)
 Compress an IPv6 address by simplifying its representation.
 
auto IPv6Address (const bool valid=true) -> Gen< std::string >
 Generates a random IPv6 address.
 
auto alpha (const bool valid=true) -> Gen< char >
 Generates alphabetic or non-alphabetic characters.
 
auto from_allowed_chars (const std::string_view &allowed_chars, const bool valid=true) -> Gen< char >
 Generates characters based on an allowed character set.
 
auto string_from_allowed_chars (const std::string_view &allowed_chars, const bool valid=true) -> Gen< std::string >
 Generates strings based on allowed characters.
 
auto port (const bool valid=true) -> Gen< int >
 Generates a port number value.
 
auto calculateIPPrefixRange (const std::string &ipAddress) -> std::tuple< int, int >
 Calculates the valid IP prefix range for a given IP address.
 
auto genDnsDomain (const bool valid=true) -> Gen< openvpn::DnsDomain >
 Generates a DnsDomain.
 
auto genDnsAddress (const bool valid=true) -> Gen< openvpn::DnsAddress >
 Generates a DNS address.
 
auto genDnsAddressAsStr (const bool valid=true) -> Gen< std::string >
 Generates a DNS address as a string.
 
auto genDnsServer () -> Gen< openvpn::DnsServer >
 Generates a DNS server.
 
auto genDNSOptions () -> Gen< openvpn::DnsOptions >
 Generates random DNS options.
 
auto genIPAddressString (const openvpn::IP::Addr::Version version, const bool valid=true) -> Gen< std::string >
 Generates an address string of version; valid is IPv4Address()/IPv6Address()'s.
 
auto genIPAddr (const openvpn::IP::Addr::Version version) -> Gen< openvpn::IP::Addr >
 
auto genIPAddr () -> Gen< openvpn::IP::Addr >
 
auto genPrefixLength (const openvpn::IP::Addr::Version version, const bool valid=true) -> Gen< unsigned int >
 Generates a prefix length for an address of version.
 
auto genAddrMaskPair (const openvpn::IP::Addr::Version version) -> Gen< openvpn::IP::AddrMaskPair >
 Generates a well-formed AddrMaskPair of version: an address and a contiguous netmask.
 
auto genNonCanonicalAddrMaskPair (const openvpn::IP::Addr::Version version) -> Gen< openvpn::IP::AddrMaskPair >
 Generates a pair of version whose address has a host bit set, so is_canonical() is false.
 
auto genNetmaskString (const openvpn::IP::Addr::Version version, const bool valid=true) -> Gen< std::string >
 Generates a netmask of version rendered as an address string.
 
auto genMaskToken (const openvpn::IP::Addr::Version version, const bool valid=true) -> Gen< std::string >
 Generates the netmask term of an AddrMaskPair input for an address of version.
 
auto genAddrMaskPairString (const openvpn::IP::Addr::Version version, const bool valid=true) -> Gen< std::string >
 Generates an AddrMaskPair::from_string input for an address of version.
 

Variables

static const std::string ALPHA_CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
static const std::string DIGITS = "1234567890"
 

Typedef Documentation

◆ RedirectGatewayFlagsValues

◆ RouteBased

Alias representing a route-based variant type.

This alias holds one of three possible route-related types: openvpn::TunBuilderCapture::Route, openvpn::TunBuilderCapture::RouteAddress, or openvpn::TunBuilderCapture::RouteBase.

Definition at line 506 of file test_generators.hpp.

Function Documentation

◆ alpha()

auto rc::alpha ( const bool  valid = true) -> Gen<char>
inline

Generates alphabetic or non-alphabetic characters.

Creates a generator that produces either valid alphabetic characters (A-Z, a-z) or non-alphabetic characters, depending on the input parameter. When generating valid alphabetic characters, it selects from a predefined set of characters. For invalid characters, it uses a character generator with a predicate that ensures the character is not alphabetic.

Parameters
validIf true (default), generates valid alphabetic characters. If false, generates non-alphabetic characters.
Returns
Gen<char> A generator that produces characters according to the specified criteria:
  • When valid=true: returns a generator for alphabetic characters (A-Z, a-z)
  • When valid=false: returns a generator for non-alphabetic characters

Definition at line 556 of file test_generators.hpp.

◆ asciiPrintableCode()

auto rc::asciiPrintableCode ( ) -> Gen<int>
inline

Generates a random printable ASCII character code.

This function generates an integer value representing printable ASCII character, ranging from 32 (space) to 126 (tilde) without 37 (percent sign)

Returns
A generator producing printable ASCII character code.
Warning
It does not generate percent sign (%)

Example usage:

auto code = *asciiPrintableCode();
auto asciiPrintableCode() -> Gen< int >
Generates a random printable ASCII character code.

Definition at line 159 of file test_generators.hpp.

Here is the caller graph for this function:

◆ atLeastOneFalse()

template<size_t N>
auto rc::atLeastOneFalse ( ) -> Gen<std::array<bool, N>>

Generates an array of booleans that contains at least one false.

This template function generates an array of booleans of size N such that at least one of the elements in the array is false.

Template Parameters
NThe size of the array to be generated.
Returns
A generator that produces array where at least one boolean value is false.

Example usage:

auto falseBoolean = *atLeastOneFalse<5>();

Definition at line 44 of file test_generators.hpp.

◆ calculateIPPrefixRange()

auto rc::calculateIPPrefixRange ( const std::string &  ipAddress) -> std::tuple<int, int>
inline

Calculates the valid IP prefix range for a given IP address.

This function takes an IPv4 address as a string and calculates the minimum and maximum valid prefix lengths. It converts the address to its integer representation and determines the smallest prefix that can correctly represent the network containing this address based on the position of the least significant '1' bit.

For example:

  • For 192.168.1.0, the range would be {24, 32}
  • For 10.0.0.0, the range would be {7, 32}
Parameters
ipAddressAn IPv4 address in dotted decimal notation (e.g., "192.168.1.0")
Returns
A tuple containing:
  • First element: The minimum valid prefix length (between 0 and 32)
  • Second element: The maximum valid prefix length (always 32)

Definition at line 658 of file test_generators.hpp.

◆ compressIPv6Address()

std::string rc::compressIPv6Address ( std::vector< std::string >  hextets)
inline

Compress an IPv6 address by simplifying its representation.

This function takes a list of hextets (hexadecimal segments of an IPv6 address), removes leading zeros from each hextet, replaces the largest contiguous sequence of zeroed hextets with a double colon (::), and converts the simplified hextets back into a string representation of the IPv6 address.

Parameters
hextetsA vector of strings, where each string represents one hextet of an IPv6 address.
Returns
A string containing the compressed IPv6 address.

Definition at line 325 of file test_generators.hpp.

Here is the caller graph for this function:

◆ from_allowed_chars()

auto rc::from_allowed_chars ( const std::string_view &  allowed_chars,
const bool  valid = true 
) -> Gen<char>
inline

Generates characters based on an allowed character set.

Creates a generator that either produces characters from a specified set of allowed characters, or characters that are specifically not in that set, depending on the valid parameter. When valid is true, it generates only characters from the allowed set. When valid is false, it generates only characters that are not in the allowed set.

Parameters
allowed_charsA string_view containing the set of allowed characters
validBoolean flag to determine whether to generate characters from the allowed set (true) or characters not in the allowed set (false). Defaults to true.
Returns
Gen<char> A character generator that produces either valid or invalid characters based on the allowed_chars set

Definition at line 581 of file test_generators.hpp.

Here is the caller graph for this function:

◆ genAddrMaskPair()

auto rc::genAddrMaskPair ( const openvpn::IP::Addr::Version  version) -> Gen<openvpn::IP::AddrMaskPair>
inline

Generates a well-formed AddrMaskPair of version: an address and a contiguous netmask.

Only valid pairs are drawn, so AddrMaskPair::operator<< can render a counterexample; a pair with a mismatched or non-contiguous netmask would throw from to_string() on the failure path.

Definition at line 1052 of file test_generators.hpp.

Here is the caller graph for this function:

◆ genAddrMaskPairString()

auto rc::genAddrMaskPairString ( const openvpn::IP::Addr::Version  version,
const bool  valid = true 
) -> Gen<std::string>
inline

Generates an AddrMaskPair::from_string input for an address of version.

valid true selects a bare address or an address with an accepted mask term. valid false selects a malformed address, an address with a rejected mask term, three terms, the empty string or an alphabetic token.

Definition at line 1153 of file test_generators.hpp.

◆ genDnsAddress()

auto rc::genDnsAddress ( const bool  valid = true) -> Gen<openvpn::DnsAddress>
inline

Generates a DNS address.

Creates a generator that produces instances of the openvpn::DnsAddress class. The generator can create either valid or invalid DNS addresses based on the provided parameter. It combines an IP address (either IPv4 or IPv6) with an optional port number. The port is randomly included or excluded, and its value is not validated during DnsAddress validation.

Parameters
validA boolean flag indicating whether to generate a valid (true ) or invalid (false ) DNS address. Defaults to true.
Returns
A generator that produces openvpn::DnsAddress objects with either valid or invalid address values.

Example usage:

// Generate a valid DNS address
auto validDnsAddr = *genDnsAddress();
// Generate an invalid DNS address
auto invalidDnsAddr = *genDnsAddress(false);
auto genDnsAddress(const bool valid=true) -> Gen< openvpn::DnsAddress >
Generates a DNS address.

Definition at line 855 of file test_generators.hpp.

Here is the caller graph for this function:

◆ genDnsAddressAsStr()

auto rc::genDnsAddressAsStr ( const bool  valid = true) -> Gen<std::string>
inline

Generates a DNS address as a string.

This function creates a generator that produces instances of the openvpn::DnsAddress class, where the address is represented as a string. The generator can create either valid or invalid DNS addresses based on the provided parameter. It combines an IP address (either IPv4 or IPv6) with an optional port number. The port is randomly included or excluded.

Parameters
validFlag indicating the address should be constrained to valid values.
Returns
Gen<openvpn::DnsAddress> A generator that produces std::string objects with either valid or invalid address values.

Definition at line 884 of file test_generators.hpp.

◆ genDnsDomain()

auto rc::genDnsDomain ( const bool  valid = true) -> Gen<openvpn::DnsDomain>
inline

Generates a DnsDomain.

Creates a generator that produces instances of the openvpn::DnsDomain class. The generator can create either valid or invalid DNS domain names based on the provided parameter. It uses the helpers::genHost function to generate appropriate domain strings.

Parameters
validA boolean flag indicating whether to generate valid (true ) or invalid (false ) domain names. Defaults to true.
Returns
A generator that produces openvpn::DnsDomain objects with either valid or invalid domain values.

Example usage:

// Generate a valid DNS domain
auto validDomain = *genDnsDomain();
// Generate an invalid DNS domain
auto invalidDomain = *genDnsDomain(false);
auto genDnsDomain(const bool valid=true) -> Gen< openvpn::DnsDomain >
Generates a DnsDomain.

Definition at line 826 of file test_generators.hpp.

Here is the caller graph for this function:

◆ genDNSOptions()

auto rc::genDNSOptions ( ) -> Gen<openvpn::DnsOptions>
inline

Generates random DNS options.

This function creates a generator for openvpn::DnsOptions objects with randomized values. It generates random DNS servers with priorities, search domains, and a boolean flag indicating whether the options should be derived from DHCP options.

The generator uses helper functions to create components of the DnsOptions structure including

  • A random boolean for the from_dhcp_options flag
  • A vector of DnsDomain objects for search domains
  • A map of DNS servers with integer priorities
Returns
A generator for random openvpn::DnsOptions.

Definition at line 948 of file test_generators.hpp.

◆ genDnsServer()

auto rc::genDnsServer ( ) -> Gen<openvpn::DnsServer>
inline

Generates a DNS server.

Creates a generator that produces random openvpn::DnsServer instances with populated fields. The generator creates:

The vector sizes for addresses and domains are limited to a maximum of 100 elements.

Returns
A generator that produces random openvpn::DnsServer instances.

Definition at line 917 of file test_generators.hpp.

Here is the caller graph for this function:

◆ generateValidityFlags()

template<size_t N>
auto rc::generateValidityFlags ( const bool  all_valid = true) -> Gen<std::array<bool, N>>

Generates an array of validity flags for component testing.

Template Parameters
NNumber of validity flags to generate
Parameters
all_validIf true, generates all flags as valid (true). If false, generates flags with at least one invalid (false) value.
Returns
Generator producing an array of N boolean flags. When all_valid is true : returns array with all elements set to true When all_valid is false : returns array with at least one element set to false

Example usage:

// Generate flags for testing URL components (all valid)
auto [scheme_is_valid, authority_is_valid] = *generateValidityFlags<2>(true);
// Generate flags with at least one invalid component
auto [scheme_is_valid, authority_is_valid] = *generateValidityFlags<2>(false);

Definition at line 78 of file test_generators.hpp.

◆ genIPAddr() [1/2]

auto rc::genIPAddr ( ) -> Gen<openvpn::IP::Addr>
inline

Definition at line 1014 of file test_generators.hpp.

Here is the caller graph for this function:

◆ genIPAddr() [2/2]

auto rc::genIPAddr ( const openvpn::IP::Addr::Version  version) -> Gen<openvpn::IP::Addr>
inline

Definition at line 1007 of file test_generators.hpp.

◆ genIPAddressString()

auto rc::genIPAddressString ( const openvpn::IP::Addr::Version  version,
const bool  valid = true 
) -> Gen<std::string>
inline

Generates an address string of version; valid is IPv4Address()/IPv6Address()'s.

Definition at line 998 of file test_generators.hpp.

Here is the caller graph for this function:

◆ genMaskToken()

auto rc::genMaskToken ( const openvpn::IP::Addr::Version  version,
const bool  valid = true 
) -> Gen<std::string>
inline

Generates the netmask term of an AddrMaskPair input for an address of version.

The valid set is a legal prefix length, a contiguous netmask of version, and the empty token, which AddrMaskPair::from_string reads as an all-ones netmask. With valid false the token is one from_string rejects for an address of version: a prefix length above the address size, a non-contiguous netmask, or a netmask of the other version.

Definition at line 1126 of file test_generators.hpp.

Here is the caller graph for this function:

◆ genNetmaskString()

auto rc::genNetmaskString ( const openvpn::IP::Addr::Version  version,
const bool  valid = true 
) -> Gen<std::string>
inline

Generates a netmask of version rendered as an address string.

valid selects a contiguous mask, which openvpn::IP::Addr::prefix_len() converts back to a prefix length, over a mask with one interior zero bit, which it rejects as malformed.

Definition at line 1105 of file test_generators.hpp.

Here is the caller graph for this function:

◆ genNonCanonicalAddrMaskPair()

auto rc::genNonCanonicalAddrMaskPair ( const openvpn::IP::Addr::Version  version) -> Gen<openvpn::IP::AddrMaskPair>
inline

Generates a pair of version whose address has a host bit set, so is_canonical() is false.

The prefix length stays below the address size so that a host bit exists to set.

Definition at line 1081 of file test_generators.hpp.

◆ genPrefixLength()

auto rc::genPrefixLength ( const openvpn::IP::Addr::Version  version,
const bool  valid = true 
) -> Gen<unsigned int>
inline

Generates a prefix length for an address of version.

valid selects [0, address size], the range openvpn::IP::Addr::netmask_from_prefix_len accepts, over values above it, with the bounds over-represented in the valid form. The invalid range stops below 2^32: above that openvpn::parse_number wraps the value modulo its destination type before any range guard sees it and AddrMaskPair::from_string accepts the input, so a wider bound admits "invalid" prefix lengths that parse.

Definition at line 1030 of file test_generators.hpp.

Here is the caller graph for this function:

◆ hexChar()

auto rc::hexChar ( const bool  valid = true) -> Gen<std::string>
inline

Generates a valid or invalid hexadecimal character.

This function generates a single hexadecimal character. If valid is true, it generates a value within the valid ranges of 0-9, A-F, and a-f. If valid is false, it generates a character outside of these ranges to represent an invalid hexadecimal character.

Parameters
validA boolean flag indicating whether to generate a valid or invalid hexadecimal character. Default is true.
Returns
A generator producing either valid or invalid hexadecimal character.

Example usage:

auto hex_generator = *hexChar();
auto hexChar(const bool valid=true) -> Gen< std::string >
Generates a valid or invalid hexadecimal character.

Definition at line 185 of file test_generators.hpp.

Here is the caller graph for this function:

◆ IPv4Address()

auto rc::IPv4Address ( const bool  valid = true) -> Gen<std::string>
inline

Generates a random IPv4 address.

This function generates a random IPv4 address. The validity of the octets can be controlled by the valid parameter. If valid is true, all four octets will be valid. Otherwise, at least one octet will be invalid. The resulting IPv4 address is formatted as X.X.X.X where X is a number between 0 and 255 (or an invalid value if valid is false).

Parameters
validA boolean flag indicating whether the generated address should be valid. Defaults to true.
Returns
A generator producing either valid on invalid IPv4 address.

Example usage:

auto address = *IPv4Address();
auto IPv4Address(const bool valid=true) -> Gen< std::string >
Generates a random IPv4 address.

Definition at line 129 of file test_generators.hpp.

Here is the caller graph for this function:

◆ IPv4Octet()

auto rc::IPv4Octet ( const bool  valid = true) -> Gen<int>
inline

Generates a valid or invalid IPv4 octet value.

This function generates a value that represents an IPv4 octet. If valid is true, it generates a value within the valid range of 0 to 255. If valid is false, it generates values outside this range to represent an invalid octet.

Parameters
validA boolean flag indicating whether to generate a valid or invalid octet value. Default is true.
Returns
A generator producing either valid IPv4 octet value (0-255) or invalid value.

Example usage:

auto octet = *IPv4Octet();
auto IPv4Octet(const bool valid=true) -> Gen< int >
Generates a valid or invalid IPv4 octet value.

Definition at line 100 of file test_generators.hpp.

Here is the caller graph for this function:

◆ IPv6Address()

auto rc::IPv6Address ( const bool  valid = true) -> Gen<std::string>
inline

Generates a random IPv6 address.

This function generates a random IPv6 address. The validity of the hextets can be controlled by the valid parameter. If valid is true, all eight hextets will be valid. Otherwise, at least one hextet will be invalid. The resulting IPv6 address is formatted as X:X:X:X:X:X:X:X where X is a hextet (4 hex chars) within the valid ranges of 0-9, A-F, and a-f.

This function generates either a valid or an invalid IPv6 address.

Parameters
validA boolean flag indicating whether the generated IPv6 address should be valid. Defaults to true.
Returns
A generator that produces a valid or invalid IPv6 address.

Example usage:

auto address = *IPv6Address();
auto IPv6Address(const bool valid=true) -> Gen< std::string >
Generates a random IPv6 address.

Definition at line 349 of file test_generators.hpp.

Here is the caller graph for this function:

◆ IPv6HextetValue()

auto rc::IPv6HextetValue ( const bool  valid = true) -> Gen<std::string>
inline

Generates a hextet value of an IPv6 address.

This function generates a hextet (4 characters) value of an IPv6 address, which may consist of valid or invalid hexadecimal characters based on the valid parameter.

Parameters
validA boolean indicating whether the generated hextet should only contain valid hexadecimal characters. If set to true, all characters will be valid. If set to false, at least one character will be invalid. Default is true.
Returns
A generator producing either valid or invalid hextet value.

Example usage:

auto hextet = *IPv6HextetValue();
auto IPv6HextetValue(const bool valid=true) -> Gen< std::string >
Generates a hextet value of an IPv6 address.

Definition at line 226 of file test_generators.hpp.

Here is the caller graph for this function:

◆ port()

auto rc::port ( const bool  valid = true) -> Gen<int>
inline

Generates a port number value.

Creates a generator that produces either valid or invalid port numbers. If valid is true, generates numbers in the valid port range [0, 65535]. If valid is false, generates numbers outside the valid port range.

Parameters
validBoolean flag to determine if valid (true) or invalid (false) port numbers should be generated. Defaults to true.
Returns
Gen<int> A generator that produces port numbers according to the valid parameter.

Definition at line 630 of file test_generators.hpp.

Here is the caller graph for this function:

◆ removeLeadingZerosFromHextet()

std::string rc::removeLeadingZerosFromHextet ( const std::string &  hextet)
inline

Removes leading zeros from a hextet (IPv6 segment).

This function trims all leading zeros from a given hextet string. If the hextet only contains zeros (or is empty), it returns "0".

Parameters
hextetThe input string representing a hextet (e.g., "0001", "0ABC").
Returns
A string without leading zeros.

Definition at line 251 of file test_generators.hpp.

Here is the caller graph for this function:

◆ removeLeadingZerosFromHextets()

void rc::removeLeadingZerosFromHextets ( std::vector< std::string > &  hextets)
inline

Removes leading zeros from a vector of hextets.

This function modifies a vector of IPv6 hextets by removing leading zeros from each hextet using the removeLeadingZerosFromHextet transformation. The operation is performed in-place.

Parameters
hextetsA reference to a vector of strings representing IPv6 hextets. Each hextet will be stripped of its leading zeros.

Definition at line 265 of file test_generators.hpp.

Here is the caller graph for this function:

◆ replaceSequenceOfZerosWithDoubleColon()

void rc::replaceSequenceOfZerosWithDoubleColon ( std::vector< std::string > &  hextets)
inline

Replaces the longest sequence of consecutive "0" strings in a vector with "::".

This function finds the longest contiguous sequence of "0" strings in the provided hextets vector, replaces it with a single "::", and removes the other "0" strings in the sequence. If there are multiple sequences of the same length, it acts on the first one found.

Parameters
hextetsA vector of strings representing the hextets (subdivisions) of an IPv6 address.

Definition at line 278 of file test_generators.hpp.

Here is the caller graph for this function:

◆ string_from_allowed_chars()

auto rc::string_from_allowed_chars ( const std::string_view &  allowed_chars,
const bool  valid = true 
) -> Gen<std::string>
inline

Generates strings based on allowed characters.

Creates a generator that produces strings either containing only allowed characters or containing at least one character not in the allowed set. When valid is true, it generates strings using only allowed characters. When valid is false, it generates strings that contain at least one character not present in allowed_chars.

Parameters
allowed_charsA string_view containing the set of allowed characters
validBoolean flag to control generation mode:
  • true : generate strings using only allowed characters
  • false : generate strings containing at least one invalid character (defaults to true)
Returns
A generator that produces std::string values according to the specified constraints

Definition at line 609 of file test_generators.hpp.

Here is the caller graph for this function:

◆ stringifyHextetsToAddressWithColons()

std::string rc::stringifyHextetsToAddressWithColons ( const std::vector< std::string > &  hextets)
inline

Converts a vector of hextets to an IPv6 address string with colons.

This function takes a vector of strings representing hextets (parts of an IPv6 address) and constructs a colon-separated IPv6 address. The function ensures that colons are correctly placed between the hextets, and it avoids adding redundant colons around "::" which represents a compressed sequence of zeroes in an IPv6 address.

Parameters
hextetsA vector of strings, where each string represents a hextet or "::".
Returns
A string representation of the IPv6 address with colons separating the hextets.

Definition at line 302 of file test_generators.hpp.

Here is the caller graph for this function:

Variable Documentation

◆ ALPHA_CHARACTERS

const std::string rc::ALPHA_CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
static

Definition at line 538 of file test_generators.hpp.

◆ DIGITS

const std::string rc::DIGITS = "1234567890"
static

Definition at line 539 of file test_generators.hpp.