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

Generates the same value at every call. More...

Detailed Description

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

Generates the same value at every call.

Each generated value is the one given at construction, converted to the target type through tts::conversion when it is specialized for that 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));
}
}
};