tts v2.3.0
The Tiny Test System
 
Loading...
Searching...
No Matches

◆ TTS_ULP_RANGE_CHECK

#define TTS_ULP_RANGE_CHECK (   Producer,
  RefType,
  NewType,
  RefFunc,
  NewFunc,
  Ulpmax 
)

Generate a range based test between two functions.

Evaluates the histogram of ULP difference between two functions run on the same data set and that they lie in a given ULP distance. This comparison is performed by using the proper tts::ulp_distance overload.

Parameters
ProducerData set generator to use.
RefTypeType to use as reference function input.
NewTypeType to use as challenger function input.
RefFuncReference function to compare to.
NewFuncChallenger function to be compared to the reference one.
UlpmaxMaximal ULPs acceptable for passing the test.

Example

#define TTS_MAIN
#include <tts/tts.hpp>
float ok_x (float x) { return x; }
float bad_x(float x) { return x + x*1e-7f; }
TTS_CASE( "Test range check" )
{
TTS_ULP_RANGE_CHECK ( [] (auto i, auto c) { return (100.f*i)/c; }
, float, float , ok_x, bad_x
, 2.
);
};
#define TTS_CASE(ID)
Introduces a new test scenario and registers it into the current test driver.
Definition: case.hpp:147
#define TTS_ULP_RANGE_CHECK(Producer, RefType, NewType, RefFunc, NewFunc, Ulpmax)
Generate a range based test between two functions.
Definition: ranges.hpp:274