Skip to content
Permalink
Browse files

Fix failing test

  • Loading branch information
nyalldawson committed Jun 28, 2016
1 parent ec49c40 commit 724d3e083288dd14321938ee1aadcd81662d9e16
Showing with 10 additions and 3 deletions.
  1. +8 −1 src/core/qgstestutils.h
  2. +2 −2 tests/src/core/testqgsgeometryutils.cpp
@@ -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
@@ -19,6 +19,7 @@
#include "qgslinestringv2.h"
#include "qgspolygonv2.h"
#include "qgsmultipolygonv2.h"
#include "qgstestutils.h"

class TestQgsGeometryUtils: public QObject
{
@@ -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 );
}


0 comments on commit 724d3e0

Please sign in to comment.
You can’t perform that action at this time.