Next: TEST_RUN_FP, Previous: TEST_FP, Up: Test Macros
test a floating point expression against a value, within a tolerance range
#include <testlib.h> TEST_FP_TOL(desc, expr, res, tol ) TEST_FP_TOL_LINE(line, desc, expr, res, tol ) TEST_FPABS_TOL(desc, expr, res, tol ) TEST_FPABS_TOL_LINE(line, desc, expr, res, tol )
- line
- the line number to output
- desc
- a short description of the test being performed
- expr
- a floating point expression to evaluate
- res
- the expected result of the floating point expression
- tol
- the tolerance within which the expr and the res are equivalent.
TEST_FP_TOL
is called to determine the equivalence of a floating
point expression against an expected result within a specified tolerance
range. If the relative numeric difference between the two values is less than
the specified tolerance, they are considered equivalent.
TEST_FPABS_TOL
is similar, but uses an absolute tolerance check.
TEST_FP_TOL( "float equiv", 33 * 2.2, 36, 2 );