Skip to content

Commit cad7a8f

Browse files
committedDec 16, 2016
Add QGSCOMPARENOTNEAR(value,not_expected,epsilon) macro
1 parent aaeaf97 commit cad7a8f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎src/core/qgstestutils.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@
3232
QVERIFY( qgsDoubleNear( value, expected, epsilon ) ); \
3333
}
3434

35+
#define QGSCOMPARENOTNEAR(value,not_expected,epsilon) { \
36+
bool _xxxresult = qgsDoubleNear( value, not_expected, epsilon ); \
37+
if ( _xxxresult ) \
38+
{ \
39+
qDebug( "Expecting %f to be differerent from %f (diff %f > %f)", static_cast< double >( value ), static_cast< double >( not_expected ), qAbs( static_cast< double >( not_expected ) - value ), static_cast< double >( epsilon ) ); \
40+
} \
41+
QVERIFY( !qgsDoubleNear( value, not_expected, epsilon ) ); \
42+
}
43+
3544
#define QGSCOMPARENEARPOINT(point1,point2,epsilon) { \
3645
QGSCOMPARENEAR( point1.x(), point2.x(), epsilon ); \
3746
QGSCOMPARENEAR( point1.y(), point2.y(), epsilon ); \

0 commit comments

Comments
 (0)
Please sign in to comment.