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

◆ TTS_RELATIVE_EQUAL

#define TTS_RELATIVE_EQUAL (   L,
  R,
  N,
  ... 
)    TTS_PRECISION(L,R,N,"%" , ::tts::relative_distance, 8, __VA_ARGS__ )

Checks if values are within a given relative distance expressed as a percentage.

This comparison is performed by using the proper tts::relative_distance overload.

Parameters
L,RExpressions to compare.
NMaximum relative percentage accepted between L and R.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN
#include <tts/tts.hpp>
TTS_CASE("Relative distance")
{
TTS_RELATIVE_EQUAL(42.f , 42.f , 0 );
TTS_RELATIVE_EQUAL('A' , 80LL , 18.75 );
TTS_RELATIVE_EQUAL(1. , 2.f , 100. );
TTS_RELATIVE_EQUAL(1 , 10 , 900., REQUIRED );
};
#define TTS_CASE(ID)
Introduces a new test scenario and registers it into the current test driver.
Definition: case.hpp:147
#define TTS_RELATIVE_EQUAL(L, R, N,...)
Checks if values are within a given relative distance expressed as a percentage.
Definition: precision.hpp:101