Skip to content

Commit

Permalink
Work around test issues with varying versions of PROJ (#3560)
Browse files Browse the repository at this point in the history
* Add range for crop because of varying proj precision.

* Fix tests for PROJ 8.1.1

* More test workaround for proj.
  • Loading branch information
abellgithub committed Oct 7, 2021
1 parent 0f004db commit 1a7415f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
10 changes: 10 additions & 0 deletions test/unit/filters/CropFilterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,17 @@ TEST(CropFilterTest, test_crop_polygon_reprojection)
PointViewSet viewSet = crop.execute(table);
EXPECT_EQ(viewSet.size(), 1u);
view = *viewSet.begin();
//ABELL - I'd like to do the following, but we don't necessarily have proj.h
/**
#if defined(PROJ_VERSION_NUMBER) && PROJ_VERSION_NUMBER > 80101
EXPECT_EQ(view->size(), 45u);
#else
EXPECT_EQ(view->size(), 47u);
#endif
**/
// So instead...
EXPECT_GE(view->size(), 45u);
EXPECT_LE(view->size(), 47u);

FileUtils::closeFile(wkt_stream);
}
Expand Down
41 changes: 40 additions & 1 deletion test/unit/io/EptReaderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,21 @@ TEST(EptReaderTest, boundedCrop)
}

EXPECT_EQ(eptNp, sourceNp);

//ABELL - A change in proj changed the numbers, but we don't necessarily have proj.h
/**
#if defined(PROJ_VERSION_NUMBER) && PROJ_VERSION_NUMBER > 80101
EXPECT_EQ(eptNp, 45u);
EXPECT_EQ(sourceNp, 45u);
#else
EXPECT_EQ(eptNp, 47u);
EXPECT_EQ(sourceNp, 47u);
#endif
**/
EXPECT_GE(eptNp, 45u);
EXPECT_GE(sourceNp, 45u);
EXPECT_LE(eptNp, 47u);
EXPECT_LE(sourceNp, 47u);
}

TEST(EptReaderTest, polygonAndBoundsCrop)
Expand Down Expand Up @@ -769,8 +782,20 @@ TEST(EptReaderTest, boundedCropReprojection)
sourceNp += view->size();

EXPECT_EQ(eptNp, sourceNp);
//ABELL - We don't necessarily have proj.h, so we can't do this:
/**
#if defined(PROJ_VERSION_NUMBER) && PROJ_VERSION_NUMBER > 80101
EXPECT_EQ(eptNp, 45u);
EXPECT_EQ(sourceNp, 45u);
#else
EXPECT_EQ(eptNp, 47u);
EXPECT_EQ(sourceNp, 47u);
#endif
**/
EXPECT_GE(eptNp, 45u);
EXPECT_GE(sourceNp, 45u);
EXPECT_LE(eptNp, 47u);
EXPECT_LE(sourceNp, 47u);
}


Expand Down Expand Up @@ -811,9 +836,23 @@ TEST(EptReaderTest, ogrCrop)
for (const PointViewPtr& view : source.execute(sourceTable))
sourceNp += view->size();

EXPECT_EQ(eptNp, sourceNp);
//ABELL - PROJ changed to make the number of points that pass the filter different from
// what's in the file we've got stored.
// EXPECT_EQ(eptNp, sourceNp);
//ABELL - We don't necessarily have proj.h, so can't do the following:
/**
#if defined(PROJ_VERSION_NUMBER) && PROJ_VERSION_NUMBER > 80101
EXPECT_EQ(eptNp, 89u);
EXPECT_EQ(sourceNp, 89u);
#else
EXPECT_EQ(eptNp, 86u);
EXPECT_EQ(sourceNp, 86u);
#endif
**/
EXPECT_LE(eptNp, 89u);
EXPECT_LE(sourceNp, 89u);
EXPECT_GE(eptNp, 86u);
EXPECT_GE(sourceNp, 86u);
}

} // namespace pdal

0 comments on commit 1a7415f

Please sign in to comment.