Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for edge cases with bbox overlap and out-of-bounds polygons #817

Merged
merged 4 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions src/apps/testapps/testPolyfillInternal.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ static GeoPolygon sfGeoPolygon = {
{0.6599990002976, -2.1376771158464}}},
.numHoles = 0};

static GeoPolygon invalidGeoPolygon = {
.geoloop = {.numVerts = 4,
.verts = (LatLng[]){{NAN, -2.1364398519396},
{0.6595011102219, NAN},
{NAN, -2.1354884206045},
{0.6581220034068, NAN}}},
.numHoles = 0};

SUITE(polyfillInternal) {
TEST(iterInitPolygonCompact_errors) {
IterCellsPolygonCompact iter;
Expand Down Expand Up @@ -142,24 +134,6 @@ SUITE(polyfillInternal) {
t_assert(iter.cell == H3_NULL, "Got null output for invalid cell");
}

TEST(iterStepPolygonCompact_invalidPolygonErrors) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test covered a block that AFAIK is now unreachable.

IterCellsPolygonCompact iter;

// Start with a good polygon, otherwise we error out early
iter =
iterInitPolygonCompact(&sfGeoPolygon, 5, CONTAINMENT_OVERLAPPING);
t_assertSuccess(iter.error);

// Give the iterator a bad polygon and a cell at target res
iter._polygon = &invalidGeoPolygon;
iter.cell = 0x85283473fffffff;

iterStepPolygonCompact(&iter);
t_assert(iter.error == E_LATLNG_DOMAIN,
"Got expected error for invalid polygon");
t_assert(iter.cell == H3_NULL, "Got null output for invalid cell");
}

TEST(iterDestroyPolygonCompact) {
IterCellsPolygonCompact iter =
iterInitPolygonCompact(&sfGeoPolygon, 9, CONTAINMENT_CENTER);
Expand Down
Loading
Loading