23 #ifndef KDAB_NO_UNIT_TESTS
27 #ifdef TEMPORARILY_REMOVED
28 #include <trinav/ascshared/libfakes/fakes.h>
35 : mName( n ), mFailed( 0 ), mSucceeded( 0 ) {}
39 else fail( file, line ) <<
'"' << expression <<
"\" is NULL, expected non-NULL" << std::endl;
44 else fail( file, line ) <<
'"' << expression <<
"\" is not NULL, expected NULL" << std::endl;
48 void KDAB::UnitTest::Test::_assertIsNaN( qreal
d,
const char * expression,
const char * file,
unsigned int line ) {
49 if ( std::isnan( d ) ) success();
50 else fail( file, line ) <<
'"' << expression <<
"\" yielded " << d <<
"; expected NaN" << std::endl;
53 void KDAB::UnitTest::Test::_assertIsNotNaN( qreal d,
const char * expression,
const char * file,
unsigned int line ) {
54 if ( !std::isnan( d ) ) success();
55 else fail( file, line ) <<
'"' << expression <<
"\" yielded nan; expected something else" << std::endl;
61 else fail( file, line ) <<
'"' << expression <<
"\" != TRUE" << std::endl;
66 else fail( file, line ) <<
'"' << expression <<
"\" != FALSE" << std::endl;
70 if ( qAbs( x1/x2 - 1.0f ) <= prec * std::numeric_limits<float>::epsilon() ) success();
71 else fail( file, line ) << x1 <<
" (" << expr1 <<
") deviates from expected "
72 << x2 <<
" (" << expr2 <<
") by more than "
73 << prec <<
" (" << exprP <<
") epsilons." << std::endl;
77 if ( qAbs( x1/x2 - 1.0 ) <= prec * std::numeric_limits<qreal>::epsilon() ) success();
78 else fail( file, line ) << x1 <<
" (" << expr1 <<
") deviates from expected "
79 << x2 <<
" (" << expr2 <<
") by more than "
80 << prec <<
" (" << exprP <<
") epsilons." << std::endl;
84 if ( qAbs( x1/x2 - 1.0l ) <= prec * std::numeric_limits<long double>::epsilon() ) success();
85 else fail( file, line ) << x1 <<
" (" << expr1 <<
") deviates from expected "
86 << x2 <<
" (" << expr2 <<
") by more than "
87 << prec <<
" (" << exprP <<
") epsilons." << std::endl;
92 return std::cerr <<
"FAIL: " << file <<
':' << line <<
": ";
95 #endif // KDAB_NO_UNIT_TESTS