OpenVPN 3 Core Library
Loading...
Searching...
No Matches
test_generators.hpp File Reference
#include <rapidcheck/gtest.h>
#include <algorithm>
#include <utility>
#include <string>
#include <tuple>
#include <array>
#include <string_view>
#include <bitset>
#include <sstream>
#include <vector>
#include "openvpn/addr/ip.hpp"
#include "openvpn/tun/builder/capture.hpp"
Include dependency graph for test_generators.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rc::Arbitrary< RedirectGatewayFlagsValues >
 Template specialization for generating arbitrary RedirectGatewayFlagsValues. More...
 
struct  rc::Arbitrary< openvpn::TunBuilderCapture::RouteBase >
 Specialization of Arbitrary for the RouteBase type. More...
 
struct  rc::Arbitrary< openvpn::TunBuilderCapture::Route >
 Specialization of the Arbitrary template for TunBuilderCapture::Route. More...
 
struct  rc::Arbitrary< openvpn::TunBuilderCapture::RouteAddress >
 Specialization of the Arbitrary struct for RouteAddress. More...
 
struct  rc::Arbitrary< std::variant< T, Ts... > >
 Specialization of Arbitrary for creating arbitrary std::variant values. More...
 

Namespaces

namespace  rc
 

Typedefs

using rc::RedirectGatewayFlagsValues = openvpn::RedirectGatewayFlags::Flags
 
using rc::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 rc::atLeastOneFalse () -> Gen< std::array< bool, N > >
 Generates an array of booleans that contains at least one false.
 
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.
 
auto rc::IPv4Octet (const bool valid=true) -> Gen< int >
 Generates a valid or invalid IPv4 octet value.
 
auto rc::IPv4Address (const bool valid=true) -> Gen< std::string >
 Generates a random IPv4 address.
 
auto rc::asciiPrintableCode () -> Gen< int >
 Generates a random printable ASCII character code.
 
auto rc::hexChar (const bool valid=true) -> Gen< std::string >
 Generates a valid or invalid hexadecimal character.
 
auto rc::IPv6HextetValue (const bool valid=true) -> Gen< std::string >
 Generates a hextet value of an IPv6 address.
 
std::string rc::removeLeadingZerosFromHextet (const std::string &hextet)
 Removes leading zeros from a hextet (IPv6 segment).
 
void rc::removeLeadingZerosFromHextets (std::vector< std::string > &hextets)
 Removes leading zeros from a vector of hextets.
 
void rc::replaceSequenceOfZerosWithDoubleColon (std::vector< std::string > &hextets)
 Replaces the longest sequence of consecutive "0" strings in a vector with "::".
 
std::string rc::stringifyHextetsToAddressWithColons (const std::vector< std::string > &hextets)
 Converts a vector of hextets to an IPv6 address string with colons.
 
std::string rc::compressIPv6Address (std::vector< std::string > hextets)
 Compress an IPv6 address by simplifying its representation.
 
auto rc::IPv6Address (const bool valid=true) -> Gen< std::string >
 Generates a random IPv6 address.
 
auto rc::alpha (const bool valid=true) -> Gen< char >
 Generates alphabetic or non-alphabetic characters.
 
auto rc::from_allowed_chars (const std::string_view &allowed_chars, const bool valid=true) -> Gen< char >
 Generates characters based on an allowed character set.
 
auto rc::string_from_allowed_chars (const std::string_view &allowed_chars, const bool valid=true) -> Gen< std::string >
 Generates strings based on allowed characters.
 
auto rc::port (const bool valid=true) -> Gen< int >
 Generates a port number value.
 
auto rc::calculateIPPrefixRange (const std::string &ipAddress) -> std::tuple< int, int >
 Calculates the valid IP prefix range for a given IP address.
 

Variables

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