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

Test cellsToLinkedMultiPolygon for children of pentagon #916

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
6 changes: 4 additions & 2 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ on:

jobs:
tests:
name: Test Compile ${{ matrix.build_type }}
runs-on: macos-latest
name: ${{ matrix.build_type }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [macos-12, macos-13, macos-latest]
build_type: ["Debug", "Release"]

steps:
Expand Down
18 changes: 18 additions & 0 deletions src/apps/testapps/testCellsToLinkedMultiPolygon.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@ SUITE(cellsToLinkedMultiPolygon) {
H3_EXPORT(destroyLinkedMultiPolygon)(&polygon);
}

TEST(pentagonChldren) {
ajfriend marked this conversation as resolved.
Show resolved Hide resolved
// children of pentagon 0x80ebfffffffffff
H3Index kids[] = {0x81ea3ffffffffff, 0x81eabffffffffff,
0x81eafffffffffff, 0x81eb3ffffffffff,
0x81eb7ffffffffff, 0x81ebbffffffffff};
int numCells = ARRAY_SIZE(kids);
Comment on lines +76 to +80
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this happen for any set of res 1 children of a res 0 pentagon?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See the notebook here: https://gist.github.com/ajfriend/5594157463b88eb8d4cae35705657d8d

At res 1, it only happens for 80ebfffffffffff. (but it also happens for res 2... let me get a list)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At res 2, exactly two pentagons of the 12 do not work: 8009fffffffffff and 80c3fffffffffff


LinkedGeoPolygon polygon;
t_assertSuccess(
H3_EXPORT(cellsToLinkedMultiPolygon)(kids, numCells, &polygon));

// Since these are the children of a cell, we exepect a single loop with
// no holes.
ajfriend marked this conversation as resolved.
Show resolved Hide resolved
t_assert(countLinkedLoops(&polygon) == 1, "1 loop added to polygon");

H3_EXPORT(destroyLinkedMultiPolygon)(&polygon);
}

// TODO: This test asserts incorrect behavior - we should be creating
// multiple polygons, each with their own single loop. Update when the
// algorithm is corrected.
Expand Down
Loading