Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QDOC_CATCH_GENERATORS_ROOT_NAMESPACE Namespace Reference

Namespaces

namespace  QDOC_CATCH_GENERATORS_PRIVATE_NAMESPACE
 \variable PathGeneratorConfiguration::multi_device_path_probability
 
namespace  QDOC_CATCH_GENERATORS_QCHAR_ALPHABETS_NAMESPACE
 

Classes

class  PathGeneratorConfiguration
 Defines some parameters to customize the generation of paths by a PathGenerator. More...
 

Functions

template<typename T >
Catch::Generators::GeneratorWrapper< T > cycle (Catch::Generators::GeneratorWrapper< T > &&generator)
 Returns a generator that behaves like generator until generator is exhausted, repeating the same generation that generator produced, infinitely, afterwards.
 
template<typename T >
Catch::Generators::GeneratorWrapper< T > oneof (std::vector< Catch::Generators::GeneratorWrapper< T > > &&generators, const std::vector< double > &weights)
 Returns a generator whose set of elements is the union of the set of elements of the generators in generators.
 
template<typename T >
Catch::Generators::GeneratorWrapper< T > uniform_oneof (std::vector< Catch::Generators::GeneratorWrapper< T > > &&generators)
 Returns a generator whose set of elements is the union of the set of elements of the generators in generators and in which the distribution of the generated elements is uniform over generators.
 
template<typename T >
Catch::Generators::GeneratorWrapper< T > uniformly_valued_oneof (std::vector< Catch::Generators::GeneratorWrapper< T > > &&generators, const std::vector< std::size_t > &amounts)
 Returns a generator whose set of elements is the union of the set of elements of the generators in generators and in which the distribution of the generated elements is uniform over the elements of generators.
 
Catch::Generators::GeneratorWrapper< std::vector< double > > k_partition_of_r (double r, std::size_t k)
 Returns a generator that generates collections of k elements whose sum is r.
 
Catch::Generators::GeneratorWrapper< QStringpath (Catch::Generators::GeneratorWrapper< QString > &&device_generator, Catch::Generators::GeneratorWrapper< QString > &&root_component_generator, Catch::Generators::GeneratorWrapper< QString > &&directory_generator, Catch::Generators::GeneratorWrapper< QString > &&filename_generator, Catch::Generators::GeneratorWrapper< QString > &&separator_generator, PathGeneratorConfiguration configuration=PathGeneratorConfiguration{})
 Returns a generator that produces QStrings that represent a path in a filesystem.
 
Catch::Generators::GeneratorWrapper< QStringrelaxed_portable_posix_path (double absolute_path_probability=0.5, double directory_path_probability=0.5)
 Returns a generator that generates strings representing POSIX compatible paths.
 
Catch::Generators::GeneratorWrapper< QStringtraditional_dos_path (double absolute_path_probability=0.5, double directory_path_probability=0.5, double multi_device_path_probability=0.5)
 Returns a generator that produces strings that represents traditional DOS paths as defined in \l {https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#traditional-dos-paths}.
 
Catch::Generators::GeneratorWrapper< QStringnative_path (double absolute_path_probability=0.5, double directory_path_probability=0.5)
 Returns a generator that generates QStrings that represents paths native to the underlying OS.
 
Catch::Generators::GeneratorWrapper< QStringnative_relative_path (double directory_path_probability=0.5)
 Returns a generator that generates QStrings that represents paths native to the underlying OS and that are always {Relative}.
 
Catch::Generators::GeneratorWrapper< QStringnative_relative_file_path ()
 Returns a generator that generates QStrings that represents paths native to the underlying OS and that are always {Relative} and {To a File}.
 
Catch::Generators::GeneratorWrapper< QStringnative_relative_directory_path ()
 Returns a generator that generates QStrings that represents paths native to the underlying OS and that are always {Relative} and {To a Directory}.
 
Catch::Generators::GeneratorWrapper< QCharcharacter (char16_t lower_bound=std::numeric_limits< char16_t >::min(), char16_t upper_bound=std::numeric_limits< char16_t >::max())
 Returns a generator of that generates elements of QChar whose ucs value is in the range [lower_bound, upper_bound].
 
Catch::Generators::GeneratorWrapper< QStringstring (Catch::Generators::GeneratorWrapper< QChar > &&character_generator, qsizetype minimum_length, qsizetype maximum_length)
 Returns a generator that generates elements of QString from some amount of elements taken from character_generator.
 
Catch::Generators::GeneratorWrapper< QStringempty_string ()
 Returns an infinite generator whose elements are the empty QString.
 

Function Documentation

◆ character()

Catch::Generators::GeneratorWrapper< QChar > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::character ( char16_t lower_bound = std::numeric_limits<char16_t>::min(),
char16_t upper_bound = std::numeric_limits<char16_t>::max() )
inline

Returns a generator of that generates elements of QChar whose ucs value is in the range [lower_bound, upper_bound].

When lower_bound = upper_bound, the generator infinitely generates the same character.

Definition at line 56 of file qchar_generator.h.

◆ cycle()

template<typename T >
Catch::Generators::GeneratorWrapper< T > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::cycle ( Catch::Generators::GeneratorWrapper< T > && generator)
inline

Returns a generator that behaves like generator until generator is exhausted, repeating the same generation that generator produced, infinitely, afterwards.

This is generally intended to produce infinite generators from finite ones.

For example, consider a generator that produces values based on another generator that it owns. If the owning generator needs to produce more values that the owned generator can support, it might fail at some point. By cycling over the owned generator, we can extend the sequence of produced values so that enough are generated, in a controlled way.

The type T should generally be copyable for this generator to work.

Definition at line 76 of file cycle_generator.h.

◆ empty_string()

Catch::Generators::GeneratorWrapper< QString > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::empty_string ( )
inline

Returns an infinite generator whose elements are the empty QString.

Definition at line 87 of file qstring_generator.h.

◆ k_partition_of_r()

Catch::Generators::GeneratorWrapper< std::vector< double > > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::k_partition_of_r ( double r,
std::size_t k )
inline

Returns a generator that generates collections of k elements whose sum is r.

r must be a real number greater or euqal to zero and k must be a natural number greater than zero.

The generated partitions tends to be uniformely distributed over the set of partitions of r.

Definition at line 109 of file k_partition_of_r_generator.h.

◆ native_path()

Catch::Generators::GeneratorWrapper< QString > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::native_path ( double absolute_path_probability = 0.5,
double directory_path_probability = 0.5 )
inline

Returns a generator that generates QStrings that represents paths native to the underlying OS.

On Windows, paths that refer to a drive always refer to the root drive.

native* functions should always be chosen when using paths for testing interfacing with the filesystem itself.

System outside Linux, macOS or Windows are not supported.

Definition at line 739 of file path_generator.h.

◆ native_relative_directory_path()

Catch::Generators::GeneratorWrapper< QString > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::native_relative_directory_path ( )
inline

Returns a generator that generates QStrings that represents paths native to the underlying OS and that are always {Relative} and {To a Directory}.

System outside Linux, macOS or Windows are not supported.

Definition at line 849 of file path_generator.h.

◆ native_relative_file_path()

Catch::Generators::GeneratorWrapper< QString > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::native_relative_file_path ( )
inline

Returns a generator that generates QStrings that represents paths native to the underlying OS and that are always {Relative} and {To a File}.

System outside Linux, macOS or Windows are not supported.

Definition at line 838 of file path_generator.h.

◆ native_relative_path()

Catch::Generators::GeneratorWrapper< QString > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::native_relative_path ( double directory_path_probability = 0.5)
inline

Returns a generator that generates QStrings that represents paths native to the underlying OS and that are always {Relative}.

Avoids generating paths that refer to a directory that is not included in the path itself.

System outside Linux, macOS or Windows are not supported.

Definition at line 770 of file path_generator.h.

◆ oneof()

template<typename T >
Catch::Generators::GeneratorWrapper< T > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::oneof ( std::vector< Catch::Generators::GeneratorWrapper< T > > && generators,
const std::vector< double > & weights )
inline

Returns a generator whose set of elements is the union of the set of elements of the generators in generators.

Each time the generator produces a value, a generator from generators is randomly chosen to produce the value.

The distribution for the choice is given by weights. The {ith} element in weights represent the percentage probability of the {ith} element of generators to be chosen.

It follows that the size of weights must be the same as the size of generators.

Furthermore, the sum of elements in weights should be a hundred.

The generator produces values until a generator that is chosen to produce a value is unable to do so. The first such generator to do so will stop the generation independently of the availability of the other generators.

Similarly, values will be produced as long as the chosen generator can produce a value, independently of the other generators being exhausted already.

Definition at line 91 of file oneof_generator.h.

◆ path()

Catch::Generators::GeneratorWrapper< QString > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::path ( Catch::Generators::GeneratorWrapper< QString > && device_generator,
Catch::Generators::GeneratorWrapper< QString > && root_component_generator,
Catch::Generators::GeneratorWrapper< QString > && directory_generator,
Catch::Generators::GeneratorWrapper< QString > && filename_generator,
Catch::Generators::GeneratorWrapper< QString > && separator_generator,
PathGeneratorConfiguration configuration = PathGeneratorConfiguration{} )
inline

Returns a generator that produces QStrings that represent a path in a filesystem.

A path is formed by the following components, loosely based on the abstraction that is used by std::filesystem::path:

\list

  • {device}: Represents the device on the filesystem that the path should be considered in terms of. This is an optional components that is sometimes present on multi-device systems, such as Windows, to distinguish which device the path refers to. When present, it always appears before any other component.
  • {root}: A special sequence that marks the path as absolute. This is an optional component that is present, always, in absolute paths.
  • {directory}: A component that represents a directory on the filesystem that the path "passes-trough". Zero or more of this components can be present in the path. A path pointing to a directory on the filesystem that is not {root} always ends with a component of this type.
  • {filename}: A component that represents a file on the filesystem. When this component is present, it is present only once and always as the last component of the path. A path that has such a component is a path that points to a file on the filesystem. For some path formats, there is no difference in the format of a {filename} and a {directory}.
  • {separator}: A component that is interleaved between other types of components to separate them so that they are recognizable. A path that points to a directory on the filesystem may sometimes have a {separator} at the end, after the ending {directory} component. \endlist

Each component is representable as a string and a path is a concatenation of the string representation of some components, with the following rules:

\list

  • There is at most one {device} component.
  • If a {device} component is present it always precedes all other components.
  • There is at most one {root} component.
  • If a {root} component is present it: \list
  • Succeeds the {device} component if it is present.
  • Precedes every other components if the {device} component is not present. \endlist
  • There are zero or more {directory} component.
  • There is at most one {filename} component.
  • If a {filename} component is present it always succeeds all other components.
  • Between any two successive {directory} components there is a {separator} component.
  • Between each successive {directory} and {filename} component there is a {separator} component.
  • If the last component is a {directory} component it can be optionally followed by a {separator} component.
  • At least one component that is not a {device}, a {root} or {separator} component is present. \endlist

For example, if "C:" is a {device} component, "\\" is a \e {root} component, "\" is a \e {separator} component, "directory" is a \e {directory} component and "filename" is a \e {filename} component, the following are all paths: "C:\directory", "C:\directory\directory", "C:filename", "directory\directory\", "\directory\filename", "filename". While the following aren't: "C:", "C:\", "directory\C:", "foo", "C:filename\", "filename\directory\filename", "filename\filename", "directorydirectory"."

The format of different components type can be the same. For example, the {root} and {separator} component in the above example. For the purpose of generation, we do not care about the format itself and consider a component of a certain type depending only on how it is generated/where it is generated from.

For example, if every component is formatted as the string "a", the string "aaa" could be a generated path. By the string alone, it is not possible to simply discern which components form it, but it would be possible to generate it if the first "a" is a {device} component, the second "a" is a {root} component and the third "a" is a {directory} or {filename} component.

A path, is further said to have some properties, pairs of which are exclusive to each other.

A path is said to be:

\list

  • {Multi-Device}: When it contains a {device} component.
  • {Absolute}: When it contains a {root} component. If the path is {Absolute} it is not {Relative}.
  • {Relative}: When it does not contain a {root} component. If the path is {Relative} it is not {Absolute}.
  • {To a Directory}: When its last component is a {directory} component or a {directory} component followed by a {separator} component. If the path is {To a Directory} it is not {To a File}.
  • {To a File}: When its last component is a {filename}. If the path is {To a File} it is not {To a Directory}. \endlist

All path are {Relative/Absolute}, {To a Directory/To a File} and {Multi-Device} or not.

Furthermore, a path that is {To a Directory} and whose last component is a {separator} component is said to {Have a Trailing Separator}.

Definition at line 469 of file path_generator.h.

◆ relaxed_portable_posix_path()

Catch::Generators::GeneratorWrapper< QString > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::relaxed_portable_posix_path ( double absolute_path_probability = 0.5,
double directory_path_probability = 0.5 )
inline

Returns a generator that generates strings representing POSIX compatible paths.

The generated paths follows the format specified in \l {https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_271}.

The optional length-requirements, such as PATH_MAX and NAME_MAX, are relaxed away as they are generally not respected by modern systems.

It is possible to set the probability of obtaining a relative or absolute path through absolute_path_probability and the one of obtaining a path potentially pointing ot a directory or on a file through directory_path_probability.

Definition at line 652 of file path_generator.h.

◆ string()

Catch::Generators::GeneratorWrapper< QString > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::string ( Catch::Generators::GeneratorWrapper< QChar > && character_generator,
qsizetype minimum_length,
qsizetype maximum_length )
inline

Returns a generator that generates elements of QString from some amount of elements taken from character_generator.

The generated strings will have a length in the range [minimum_length, maximum_length].

For compatibility with the Qt API, it is possible to provide negative bounds for the length. This is, nonetheless, considered an error such that the bounds should always be greater or equal to zero.

It is similarly considered an error to have minimum_length <= maximum_length.

The provided generator will generate elements until character_generator is exhausted.

Definition at line 79 of file qstring_generator.h.

◆ traditional_dos_path()

Catch::Generators::GeneratorWrapper< QString > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::traditional_dos_path ( double absolute_path_probability = 0.5,
double directory_path_probability = 0.5,
double multi_device_path_probability = 0.5 )
inline

Returns a generator that produces strings that represents traditional DOS paths as defined in \l {https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#traditional-dos-paths}.

The directory and filename components of a path generated in this way are, currently, restricted to use a portable character set as defined by POSIX.

Do note that most paths themselves, will not be portable, on the whole, albeit they may be valid paths on other systems, as Windows uses a path system that is generally incompatible with other systems.

Some possibly valid special path, such as a "C:" or "\" will never be generated.

Definition at line 686 of file path_generator.h.

◆ uniform_oneof()

template<typename T >
Catch::Generators::GeneratorWrapper< T > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::uniform_oneof ( std::vector< Catch::Generators::GeneratorWrapper< T > > && generators)
inline

Returns a generator whose set of elements is the union of the set of elements of the generators in generators and in which the distribution of the generated elements is uniform over generators.

Each time the generator produces a value, a generator from generators is randomly chosen to produce the value.

Each generator from generators has the same chance of being chosen.

Do note that the distribution over the set of values is not necessarily uniform.

The generator produces values until a generator that is chosen to produce a value is unable to do so. The first such generator to do so will stop the generation independently of the availability of the other generators.

Similarly, values will be produced as long as the chosen generator can produce a value, independently of the other generators being exhausted already.

Definition at line 124 of file oneof_generator.h.

◆ uniformly_valued_oneof()

template<typename T >
Catch::Generators::GeneratorWrapper< T > QDOC_CATCH_GENERATORS_ROOT_NAMESPACE::uniformly_valued_oneof ( std::vector< Catch::Generators::GeneratorWrapper< T > > && generators,
const std::vector< std::size_t > & amounts )
inline

Returns a generator whose set of elements is the union of the set of elements of the generators in generators and in which the distribution of the generated elements is uniform over the elements of generators.

The generators in generator should have a uniform distribution and be finite. If the set of elements that the generators in generator is not disjoint, the distribution will be skewed towards repeated elements.

Each time the generator produces a value, a generator from generators is randomly chosen to produce the value.

Each generator from generators has a probability of being chosen based on the proportion of the cardinality of the subset it produces.

The {ith} element of amounts should contain the cardinality of the set produced by the {ith} generator in generators.

The generator produces values until a generator that is chosen to produce a value is unable to do so. The first such generator to do so will stop the generation independently of the availability of the other generators.

Similarly, values will be produced as long as the chosen generator can produce a value, independently of the other generators being exhausted already.

Definition at line 167 of file oneof_generator.h.

References QDOC_CATCH_GENERATORS_UTILITIES_ABSOLUTE_NAMESPACE::percent_of().

+ Here is the call graph for this function: