TTS v4.1.0
The Tiny Test System
Loading...
Searching...
No Matches

Holds the limits and special values of a type T. More...

Detailed Description

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

Holds the limits and special values of a type T.

Each member is a value of T and an edge case for the test data. A specialization for a user-defined type can provide limits of its own.

Examples

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("limits generator example")
{
// Create a limits generator for float
// Basic sanity checks
TTS_EXPECT(l.nan != l.nan);
TTS_EQUAL(l.inf, std::numeric_limits<float>::infinity());
TTS_EQUAL(l.valmax, std::numeric_limits<float>::max());
TTS_EQUAL(l.valmin, std::numeric_limits<float>::lowest());
TTS_EQUAL(l.maxflint, static_cast<float>(1u << std::numeric_limits<float>::digits));
};
Template Parameters
TType whose limits are held

Public Attributes

T inf
 \(+\infty\), for floating-point base types.
T maxflint
 Largest \(M\) with every integer of \([-M, M]\) exact, for floating-point base types.
T mindenormal
 Smallest positive subnormal value, for floating-point base types.
T minf
 \(-\infty\), for floating-point base types.
T mone
 \(-1\), for floating-point base types.
T mzero
 \(-0\), for floating-point base types.
T nan
 Quiet NaN, for floating-point base types.
T one
 \(1\).
T smallestposval
 Smallest positive normal value, for floating-point base types.
T valmax
 Largest representable value of the base type.
T valmin
 Lowest representable value of the base type, its most negative one.
T zero
 \(0\).

(Note that these are not member symbols.)

template<typename T>
auto limits (tts::type< T >)
 Returns the limits and special values of a type T.