Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Catch::Generators Namespace Reference

Namespaces

namespace  pf
 

Classes

struct  as
 
class  ChunkGenerator
 
class  FilterGenerator
 
class  FixedValuesGenerator
 
class  Generators
 
struct  GeneratorTracker
 
class  GeneratorUntypedBase
 
class  GeneratorWrapper
 
struct  IGenerator
 
class  MapGenerator
 
class  RandomFloatingGenerator
 
class  RandomIntegerGenerator
 
class  RangeGenerator
 
class  RepeatGenerator
 
class  SingleValueGenerator
 
class  TakeGenerator
 

Typedefs

template<typename Func , typename U >
using MapFunctionReturnType = typename std::remove_reference<typename std::remove_cv<typename std::result_of<Func(U)>::type>::type>::type
 
using GeneratorBasePtr = std::unique_ptr<GeneratorUntypedBase>
 

Functions

auto acquireGeneratorTracker (SourceLineInfo const &lineInfo) -> IGeneratorTracker &
 
template<typename T >
GeneratorWrapper< Tvalue (T &&value)
 
template<typename T >
GeneratorWrapper< Tvalues (std::initializer_list< T > values)
 
template<typename... Ts>
GeneratorWrapper< std::tuple< Ts... > > table (std::initializer_list< std::tuple< typename std::decay< Ts >::type... > > tuples)
 
template<typename T , typename... Gs>
auto makeGenerators (GeneratorWrapper< T > &&generator, Gs... moreGenerators) -> Generators< T >
 
template<typename T >
auto makeGenerators (GeneratorWrapper< T > &&generator) -> Generators< T >
 
template<typename T , typename... Gs>
auto makeGenerators (T &&val, Gs... moreGenerators) -> Generators< T >
 
template<typename T , typename U , typename... Gs>
auto makeGenerators (as< T >, U &&val, Gs... moreGenerators) -> Generators< T >
 
template<typename L >
auto generate (SourceLineInfo const &lineInfo, L const &generatorExpression) -> decltype(std::declval< decltype(generatorExpression())>().get())
 
template<typename T >
GeneratorWrapper< Ttake (size_t target, GeneratorWrapper< T > &&generator)
 
template<typename T , typename Predicate >
GeneratorWrapper< Tfilter (Predicate &&pred, GeneratorWrapper< T > &&generator)
 
template<typename T >
GeneratorWrapper< Trepeat (size_t repeats, GeneratorWrapper< T > &&generator)
 
template<typename Func , typename U , typename T = MapFunctionReturnType<Func, U>>
GeneratorWrapper< Tmap (Func &&function, GeneratorWrapper< U > &&generator)
 
template<typename T >
GeneratorWrapper< std::vector< T > > chunk (size_t size, GeneratorWrapper< T > &&generator)
 
template<typename T >
std::enable_if< std::is_integral< T >::value &&!std::is_same< T, bool >::value, GeneratorWrapper< T > >::type random (T a, T b)
 
template<typename T >
std::enable_if< std::is_floating_point< T >::value, GeneratorWrapper< T > >::type random (T a, T b)
 
template<typename T >
GeneratorWrapper< Trange (T const &start, T const &end, T const &step)
 
template<typename T >
GeneratorWrapper< Trange (T const &start, T const &end)
 

Typedef Documentation

◆ GeneratorBasePtr

typedef std::unique_ptr< GeneratorUntypedBase > Catch::Generators::GeneratorBasePtr = std::unique_ptr<GeneratorUntypedBase>

Definition at line 26 of file catch_interfaces_generatortracker.h.

◆ MapFunctionReturnType

template<typename Func , typename U >
using Catch::Generators::MapFunctionReturnType = typename std::remove_reference<typename std::remove_cv<typename std::result_of<Func(U)>::type>::type>::type

Definition at line 180 of file catch_generators_generic.hpp.

Function Documentation

◆ acquireGeneratorTracker()

auto Catch::Generators::acquireGeneratorTracker ( SourceLineInfo const & lineInfo) -> IGeneratorTracker &

Definition at line 27 of file catch_generators.cpp.

27 {
28 return getResultCapture().acquireGeneratorTracker( lineInfo );
29 }
IResultCapture & getResultCapture()
virtual auto acquireGeneratorTracker(SourceLineInfo const &lineInfo) -> IGeneratorTracker &=0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ chunk()

template<typename T >
GeneratorWrapper< std::vector< T > > Catch::Generators::chunk ( size_t size,
GeneratorWrapper< T > && generator )

Definition at line 232 of file catch_generators_generic.hpp.

232 {
234 pf::make_unique<ChunkGenerator<T>>(size, std::move(generator))
235 );
236 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ filter()

template<typename T , typename Predicate >
GeneratorWrapper< T > Catch::Generators::filter ( Predicate && pred,
GeneratorWrapper< T > && generator )

Definition at line 88 of file catch_generators_generic.hpp.

88 {
89 return GeneratorWrapper<T>(std::unique_ptr<IGenerator<T>>(pf::make_unique<FilterGenerator<T, Predicate>>(std::forward<Predicate>(pred), std::move(generator))));
90 }

◆ generate()

template<typename L >
auto Catch::Generators::generate ( SourceLineInfo const & lineInfo,
L const & generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get())

Definition at line 188 of file catch_generators.hpp.

188 {
189 using UnderlyingType = typename decltype(generatorExpression())::type;
190
191 IGeneratorTracker& tracker = acquireGeneratorTracker( lineInfo );
192 if (!tracker.hasGenerator()) {
193 tracker.setGenerator(pf::make_unique<Generators<UnderlyingType>>(generatorExpression()));
194 }
195
196 auto const& generator = static_cast<IGenerator<UnderlyingType> const&>( *tracker.getGenerator() );
197 return generator.get();
198 }
auto acquireGeneratorTracker(SourceLineInfo const &lineInfo) -> IGeneratorTracker &
virtual auto getGenerator() const -> Generators::GeneratorBasePtr const &=0
virtual void setGenerator(Generators::GeneratorBasePtr &&generator)=0
virtual auto hasGenerator() const -> bool=0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeGenerators() [1/4]

template<typename T , typename U , typename... Gs>
auto Catch::Generators::makeGenerators ( as< T > ,
U && val,
Gs... moreGenerators ) -> Generators<T>

Definition at line 178 of file catch_generators.hpp.

178 {
179 return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... );
180 }
auto makeGenerators(GeneratorWrapper< T > &&generator, Gs... moreGenerators) -> Generators< T >
#define value
Definition pkcs11.h:157
#define T(meth, val, expected)
Here is the call graph for this function:

◆ makeGenerators() [2/4]

template<typename T >
auto Catch::Generators::makeGenerators ( GeneratorWrapper< T > && generator) -> Generators<T>

Definition at line 170 of file catch_generators.hpp.

170 {
171 return Generators<T>(std::move(generator));
172 }
Here is the call graph for this function:

◆ makeGenerators() [3/4]

template<typename T , typename... Gs>
auto Catch::Generators::makeGenerators ( GeneratorWrapper< T > && generator,
Gs... moreGenerators ) -> Generators<T>

Definition at line 166 of file catch_generators.hpp.

166 {
167 return Generators<T>(std::move(generator), std::forward<Gs>(moreGenerators)...);
168 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeGenerators() [4/4]

template<typename T , typename... Gs>
auto Catch::Generators::makeGenerators ( T && val,
Gs... moreGenerators ) -> Generators<T>

Definition at line 174 of file catch_generators.hpp.

174 {
175 return makeGenerators( value( std::forward<T>( val ) ), std::forward<Gs>( moreGenerators )... );
176 }
Here is the call graph for this function:

◆ map()

template<typename Func , typename U , typename T = MapFunctionReturnType<Func, U>>
GeneratorWrapper< T > Catch::Generators::map ( Func && function,
GeneratorWrapper< U > && generator )

Definition at line 184 of file catch_generators_generic.hpp.

184 {
185 return GeneratorWrapper<T>(
186 pf::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator))
187 );
188 }

◆ random() [1/2]

template<typename T >
std::enable_if< std::is_integral< T >::value &&!std::is_same< T, bool >::value, GeneratorWrapper< T > >::type Catch::Generators::random ( T a,
T b )

Definition at line 69 of file catch_generators_specific.hpp.

69 {
71 pf::make_unique<RandomIntegerGenerator<T>>(a, b)
72 );
73}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
Here is the call graph for this function:

◆ random() [2/2]

template<typename T >
std::enable_if< std::is_floating_point< T >::value, GeneratorWrapper< T > >::type Catch::Generators::random ( T a,
T b )

Definition at line 78 of file catch_generators_specific.hpp.

Here is the call graph for this function:

◆ range() [1/2]

template<typename T >
GeneratorWrapper< T > Catch::Generators::range ( T const & start,
T const & end )

Definition at line 125 of file catch_generators_specific.hpp.

125 {
126 static_assert(std::is_integral<T>::value && !std::is_same<T, bool>::value, "Type must be an integer");
127 return GeneratorWrapper<T>(pf::make_unique<RangeGenerator<T>>(start, end));
128}
Here is the call graph for this function:

◆ range() [2/2]

template<typename T >
GeneratorWrapper< T > Catch::Generators::range ( T const & start,
T const & end,
T const & step )

Definition at line 119 of file catch_generators_specific.hpp.

119 {
120 static_assert(std::is_integral<T>::value && !std::is_same<T, bool>::value, "Type must be an integer");
121 return GeneratorWrapper<T>(pf::make_unique<RangeGenerator<T>>(start, end, step));
122}
Here is the call graph for this function:

◆ repeat()

template<typename T >
GeneratorWrapper< T > Catch::Generators::repeat ( size_t repeats,
GeneratorWrapper< T > && generator )

Definition at line 141 of file catch_generators_generic.hpp.

141 {
142 return GeneratorWrapper<T>(pf::make_unique<RepeatGenerator<T>>(repeats, std::move(generator)));
143 }

◆ table()

template<typename... Ts>
GeneratorWrapper< std::tuple< Ts... > > Catch::Generators::table ( std::initializer_list< std::tuple< typename std::decay< Ts >::type... > > tuples)

Definition at line 157 of file catch_generators.hpp.

157 {
158 return values<std::tuple<Ts...>>( tuples );
159 }
GeneratorWrapper< T > values(std::initializer_list< T > values)
Here is the call graph for this function:

◆ take()

template<typename T >
GeneratorWrapper< T > Catch::Generators::take ( size_t target,
GeneratorWrapper< T > && generator )

Definition at line 47 of file catch_generators_generic.hpp.

47 {
48 return GeneratorWrapper<T>(pf::make_unique<TakeGenerator<T>>(target, std::move(generator)));
49 }
Here is the call graph for this function:

◆ value()

template<typename T >
GeneratorWrapper< T > Catch::Generators::value ( T && value)

Definition at line 103 of file catch_generators.hpp.

103 {
104 return GeneratorWrapper<T>(pf::make_unique<SingleValueGenerator<T>>(std::forward<T>(value)));
105 }

◆ values()

template<typename T >
GeneratorWrapper< T > Catch::Generators::values ( std::initializer_list< T > values)

Definition at line 107 of file catch_generators.hpp.

107 {
108 return GeneratorWrapper<T>(pf::make_unique<FixedValuesGenerator<T>>(values));
109 }
Here is the call graph for this function:
Here is the caller graph for this function: