|
TTS v4.0.0
The Tiny Test System
|
Macros for performing tests taking floating-point precision into account. More...
Macros | |
| #define | TTS_ABSOLUTE_EQUAL(L, R, N, ...) |
| Checks if the absolute distance between values is less or equal to a threshold. | |
| #define | TTS_IEEE_EQUAL(L, R, ...) |
| Checks if two values are exactly within 0 ULP. | |
| #define | TTS_RELATIVE_EQUAL(L, R, N, ...) |
| Checks if values are within a given relative distance. | |
| #define | TTS_ULP_EQUAL(L, R, N, ...) |
| Checks if two values are within a given ULP distance. | |
| #define | TTS_ULP_RANGE_CHECK(Producer, RefType, NewType, RefFunc, NewFunc, Ulpmax) |
| Generate a range based test between two functions. | |
| #define TTS_ABSOLUTE_EQUAL | ( | L, | |
| R, | |||
| N, | |||
| ... ) |
#include <tts/test/precision.hpp>
Checks if the absolute distance between values is less or equal to a threshold.
This comparison is performed by using the proper tts::absolute_distance overload.
L and R must have the same type. A mismatch is a compile-time error: the distance would be measured after promotion to the common type, hence in the unit of that type rather than the one under test.
| L,R | Expressions to compare. |
| N | Maximum absolute distance accepted between L and R. |
| ... | Optional tag. If equals to REQUIRED, this test will stop the program if it fails. |
| #define TTS_IEEE_EQUAL | ( | L, | |
| R, | |||
| ... ) |
#include <tts/test/precision.hpp>
Checks if two values are exactly within 0 ULP.
This also allow for infinites and NaNs to be compared equal if both values are the same infinites or are both $NaN$. This comparison is performed by using the proper tts::ulp_distance overload.
| L,R | Expressions to compare. |
| ... | Optional tag. If equals to REQUIRED, this test will stop the program if it fails. |
| #define TTS_RELATIVE_EQUAL | ( | L, | |
| R, | |||
| N, | |||
| ... ) |
#include <tts/test/precision.hpp>
Checks if values are within a given relative distance.
This comparison is performed by using the proper tts::relative_distance overload.
L and R must have the same type. A mismatch is a compile-time error: the distance would be measured after promotion to the common type, hence in the unit of that type rather than the one under test.
| L,R | Expressions to compare. |
| N | Maximum relative distance accepted between L and R, as a ratio: 0.005 is half a percent. abs(L-R) / max(abs(L), abs(R), 1) is what gets compared to it. |
| ... | Optional tag. If equals to REQUIRED, this test will stop the program if it fails. |
| #define TTS_ULP_EQUAL | ( | L, | |
| R, | |||
| N, | |||
| ... ) |
#include <tts/test/precision.hpp>
Checks if two values are within a given ULP distance.
This comparison is performed by using the proper tts::ulp_distance overload.
L and R must have the same type. A mismatch is a compile-time error: the distance would be measured after promotion to the common type, hence in the unit of that type rather than the one under test.
| L,R | Expressions to compare. |
| N | Maximum ULPs accepted between L and R. |
| ... | Optional tag. If equals to REQUIRED, this test will stop the program if it fails. |
| #define TTS_ULP_RANGE_CHECK | ( | Producer, | |
| RefType, | |||
| NewType, | |||
| RefFunc, | |||
| NewFunc, | |||
| Ulpmax ) |
#include <tts/test/ranges.hpp>
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.
| Producer | Data set generator to use. |
| RefType | Type to use as reference function input. |
| NewType | Type to use as challenger function input. |
| RefFunc | Reference function to compare to. |
| NewFunc | Challenger function to be compared to the reference one. |
| Ulpmax | Maximal ULPs acceptable for passing the test. |