Skip to content

Commit

Permalink
Test tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 2, 2021
1 parent d787754 commit 0fc9a39
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
30 changes: 15 additions & 15 deletions tests/src/analysis/testqgszonalstatistics.cpp
Expand Up @@ -321,27 +321,27 @@ void TestQgsZonalStatistics::testSmallPolygons()
QgsFeatureIterator it = vectorLayer->getFeatures( request );
bool fetched = it.nextFeature( f );
QVERIFY( fetched );
QGSCOMPARENEAR( f.attribute( "ncount" ).toDouble(), 0.698248, 0.001 );
QGSCOMPARENEAR( f.attribute( "nsum" ).toDouble(), 588.711, 0.001 );
QCOMPARE( f.attribute( "nmin" ).toDouble(), 826.0 );
QCOMPARE( f.attribute( "nmax" ).toDouble(), 851.0 );
QGSCOMPARENEAR( f.attribute( "nmean" ).toDouble(), 843.125292, 0.001 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "ncount" ) ).toDouble(), 0.698248, 0.001 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "nsum" ) ).toDouble(), 588.711, 0.01 );
QCOMPARE( f.attribute( QStringLiteral( "nmin" ) ).toDouble(), 826.0 );
QCOMPARE( f.attribute( QStringLiteral( "nmax" ) ).toDouble(), 851.0 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "nmean" ) ).toDouble(), 843.125292, 0.01 );

fetched = it.nextFeature( f );
QVERIFY( fetched );
QGSCOMPARENEAR( f.attribute( "ncount" ).toDouble(), 0.240808, 0.001 );
QGSCOMPARENEAR( f.attribute( "nsum" ).toDouble(), 208.030921, 0.001 );
QCOMPARE( f.attribute( "nmin" ).toDouble(), 859.0 );
QCOMPARE( f.attribute( "nmax" ).toDouble(), 868.0 );
QGSCOMPARENEAR( f.attribute( "nmean" ).toDouble(), 863.887500, 0.001 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "ncount" ) ).toDouble(), 0.240808, 0.001 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "nsum" ) ).toDouble(), 208.030921, 0.01 );
QCOMPARE( f.attribute( QStringLiteral( "nmin" ) ).toDouble(), 859.0 );
QCOMPARE( f.attribute( QStringLiteral( "nmax" ) ).toDouble(), 868.0 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "nmean" ) ).toDouble(), 863.887500, 0.01 );

fetched = it.nextFeature( f );
QVERIFY( fetched );
QGSCOMPARENEAR( f.attribute( "ncount" ).toDouble(), 0.259522, 0.001 );
QGSCOMPARENEAR( f.attribute( "nsum" ).toDouble(), 224.300747, 0.001 );
QCOMPARE( f.attribute( "nmin" ).toDouble(), 851.0 );
QCOMPARE( f.attribute( "nmax" ).toDouble(), 872.0 );
QGSCOMPARENEAR( f.attribute( "nmean" ).toDouble(), 864.285638, 0.001 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "ncount" ) ).toDouble(), 0.259522, 0.001 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "nsum" ) ).toDouble(), 224.300747, 0.01 );
QCOMPARE( f.attribute( QStringLiteral( "nmin" ) ).toDouble(), 851.0 );
QCOMPARE( f.attribute( QStringLiteral( "nmax" ) ).toDouble(), 872.0 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "nmean" ) ).toDouble(), 864.285638, 0.01 );
}

void TestQgsZonalStatistics::testShortName()
Expand Down
4 changes: 2 additions & 2 deletions tests/src/geometry_checker/testqgsgeometrychecks.cpp
Expand Up @@ -1202,7 +1202,7 @@ void TestQgsGeometryChecks::testGapCheckPointInPoly()
QgsFeature f;
testContext.second[layers["gap_layer_point_in_poly.shp"]]->getFeature( 1, f );
const double areaOld = f.geometry().area();
QCOMPARE( areaOld, 19913.135772452362 );
QGSCOMPARENEAR( areaOld, 19913.135772452362, 0.0001 );

QgsGeometryCheck::Changes changes;
const QMap<QString, int> mergeAttrs;
Expand Down Expand Up @@ -1257,7 +1257,7 @@ void TestQgsGeometryChecks::testOverlapCheckToleranceBug()
const QgsPoint pointOld_2 = f.geometry().vertexAt( 2 );

// Just making sure we've got the right feature/point
QCOMPARE( areaOld, 10442.710061549426 );
QGSCOMPARENEAR( areaOld, 10442.710061549426, 0.0002 );
QGSCOMPARENEARPOINT( pointOld_1, QgsPoint( 2537221.53079314017668366, 1152360.02460834058001637 ), 0.00001 );
QGSCOMPARENEARPOINT( pointOld_2, QgsPoint( 2537366.84566075634211302, 1152360.28978145681321621 ), 0.00001 );

Expand Down

0 comments on commit 0fc9a39

Please sign in to comment.