Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 28, 2016
1 parent ec49c40 commit 724d3e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/core/qgstestutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@
* @note added in QGIS 2.16
*/

#define QGSCOMPARENEAR(a,b,epsilon) { bool _xxxresult = qgsDoubleNear( a, b, epsilon ); if ( !_xxxresult ) { qDebug( "Expecting %f got %f (diff %f > %f)", static_cast< double >( a ), static_cast< double >( b ), qAbs( static_cast< double >( a ) - b ), static_cast< double >( epsilon ) ); } QVERIFY( _xxxresult ); }
#define QGSCOMPARENEAR(a,b,epsilon) { \
bool _xxxresult = qgsDoubleNear( a, b, epsilon ); \
if ( !_xxxresult ) \
{ \
qDebug( "Expecting %f got %f (diff %f > %f)", static_cast< double >( a ), static_cast< double >( b ), qAbs( static_cast< double >( a ) - b ), static_cast< double >( epsilon ) ); \
} \
QVERIFY( qgsDoubleNear( a, b, epsilon ) ); \
}


#endif // QGSTESTUTILS_H
4 changes: 2 additions & 2 deletions tests/src/core/testqgsgeometryutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgslinestringv2.h"
#include "qgspolygonv2.h"
#include "qgsmultipolygonv2.h"
#include "qgstestutils.h"

class TestQgsGeometryUtils: public QObject
{
Expand Down Expand Up @@ -413,8 +414,7 @@ void TestQgsGeometryUtils::testSqrDistToLine()
p1.x(), p1.y(),
p2.x(), p2.y(),
rx, ry, epsilon );
sqrDist = qRound( sqrDist * 100 ) / 100;
QCOMPARE( sqrDist, 11.83 );
QGSCOMPARENEAR( sqrDist, 11.83, 0.01 );
}


Expand Down

0 comments on commit 724d3e0

Please sign in to comment.