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));
}
}
};