TTS v3.0.0
The Tiny Test System
 
Loading...
Searching...
No Matches
tts::value< T > Struct Template Reference

Defines a data generator that always return the same value. More...

Detailed Description

template<typename T>
struct tts::value< T >

Defines a data generator that always return the same value.

This generator produces always the same value provided at construction converted to the target type.

Template Parameters
TType of the value to be produced

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <array>
TTS_CASE_WITH("Test tts::value generator",
(std::array<float, 10>, int, double),
tts::value {13.37})<typename T>(T const& args)
{
if constexpr(std::is_arithmetic_v<T>) { TTS_EQUAL(args, static_cast<T>(13.37)); }
else
{
for(std::size_t i = 0; i < args.size(); ++i)
{
TTS_EQUAL(args[ i ], static_cast<typename T::value_type>(13.37));
}
}
};
#define TTS_EQUAL(LHS, RHS,...)
Performs equality comparison between two expressions.
Definition relation.hpp:134
#define TTS_CASE_WITH(ID, TYPES,...)
Introduces a template test case providing dynamically generated data to the test code.
Definition case.hpp:201
auto constexpr typename_
Evaluates to an object containing the name of the type T in readable form.
Definition typename.hpp:126
Defines a data generator that always return the same value.
Definition generator.hpp:137