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

MAX_H3_RES should be tested inclusive #820

Merged
merged 1 commit into from
Mar 11, 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
8 changes: 4 additions & 4 deletions src/apps/testapps/testDirectedEdge.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ SUITE(directedEdge) {
H3Index pentagon;
H3Index edge;

for (int res = 0; res < MAX_H3_RES; res++) {
for (int res = 0; res <= MAX_H3_RES; res++) {
t_assertSuccess(H3_EXPORT(getPentagons)(res, pentagons));
for (int p = 0; p < NUM_PENTAGONS; p++) {
pentagon = pentagons[p];
Expand Down Expand Up @@ -342,7 +342,7 @@ SUITE(directedEdge) {
const int expectedVertices[][2] = {{3, 4}, {1, 2}, {2, 3},
{5, 0}, {4, 5}, {0, 1}};

for (int res = 0; res < MAX_H3_RES; res++) {
for (int res = 0; res <= MAX_H3_RES; res++) {
t_assertSuccess(H3_EXPORT(latLngToCell)(&sfGeo, res, &sf));
t_assertSuccess(H3_EXPORT(cellToBoundary)(sf, &boundary));
t_assertSuccess(H3_EXPORT(originToDirectedEdges)(sf, edges));
Expand Down Expand Up @@ -371,7 +371,7 @@ SUITE(directedEdge) {
const int expectedVertices[][3] = {{-1, -1, -1}, {2, 3, 4}, {4, 5, 6},
{8, 9, 0}, {6, 7, 8}, {0, 1, 2}};

for (int res = 1; res < MAX_H3_RES; res += 2) {
for (int res = 1; res <= MAX_H3_RES; res += 2) {
setH3Index(&pentagon, res, 24, 0);
t_assertSuccess(H3_EXPORT(cellToBoundary)(pentagon, &boundary));
t_assertSuccess(H3_EXPORT(originToDirectedEdges)(pentagon, edges));
Expand Down Expand Up @@ -409,7 +409,7 @@ SUITE(directedEdge) {
const int expectedVertices[][3] = {{-1, -1}, {1, 2}, {2, 3},
{4, 0}, {3, 4}, {0, 1}};

for (int res = 0; res < MAX_H3_RES; res += 2) {
for (int res = 0; res <= MAX_H3_RES; res += 2) {
setH3Index(&pentagon, res, 24, 0);
t_assertSuccess(H3_EXPORT(cellToBoundary)(pentagon, &boundary));
t_assertSuccess(H3_EXPORT(originToDirectedEdges)(pentagon, edges));
Expand Down
12 changes: 6 additions & 6 deletions src/apps/testapps/testPolygonToCellsExperimental.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ SUITE(polygonToCells) {
}

TEST(polygonToCellsNullPolygon) {
for (int res = 0; res < MAX_H3_RES; res++) {
for (int res = 0; res <= MAX_H3_RES; res++) {
for (uint32_t flags = 0; flags < CONTAINMENT_INVALID; flags++) {
int64_t numHexagons;
t_assertSuccess(H3_EXPORT(maxPolygonToCellsSizeExperimental)(
Expand All @@ -707,7 +707,7 @@ SUITE(polygonToCells) {
}

TEST(polygonToCellsPointPolygon_CenterContainment) {
for (int res = 0; res < MAX_H3_RES; res++) {
for (int res = 0; res <= MAX_H3_RES; res++) {
int64_t numHexagons;
t_assertSuccess(H3_EXPORT(maxPolygonToCellsSizeExperimental)(
&pointGeoPolygon, res, CONTAINMENT_CENTER, &numHexagons));
Expand All @@ -726,7 +726,7 @@ SUITE(polygonToCells) {
}

TEST(polygonToCellsPointPolygon_FullContainment) {
for (int res = 0; res < MAX_H3_RES; res++) {
for (int res = 0; res <= MAX_H3_RES; res++) {
int64_t numHexagons;
t_assertSuccess(H3_EXPORT(maxPolygonToCellsSizeExperimental)(
&pointGeoPolygon, res, CONTAINMENT_FULL, &numHexagons));
Expand All @@ -745,7 +745,7 @@ SUITE(polygonToCells) {
}

TEST(polygonToCellsPointPolygon_Overlapping) {
for (int res = 0; res < MAX_H3_RES; res++) {
for (int res = 0; res <= MAX_H3_RES; res++) {
int64_t numHexagons;
t_assertSuccess(H3_EXPORT(maxPolygonToCellsSizeExperimental)(
&pointGeoPolygon, res, CONTAINMENT_OVERLAPPING, &numHexagons));
Expand All @@ -764,7 +764,7 @@ SUITE(polygonToCells) {
}

TEST(polygonToCellsPointPolygon_OverlappingBBox) {
for (int res = 0; res < MAX_H3_RES; res++) {
for (int res = 0; res <= MAX_H3_RES; res++) {
int64_t numHexagons;
t_assertSuccess(H3_EXPORT(maxPolygonToCellsSizeExperimental)(
&pointGeoPolygon, res, CONTAINMENT_OVERLAPPING_BBOX,
Expand All @@ -785,7 +785,7 @@ SUITE(polygonToCells) {
}

TEST(polygonToCellsOutOfBoundsPolygon) {
for (int res = 0; res < MAX_H3_RES; res++) {
for (int res = 0; res <= MAX_H3_RES; res++) {
for (uint32_t flags = 0; flags < CONTAINMENT_INVALID; flags++) {
int64_t numHexagons;
t_assertSuccess(H3_EXPORT(maxPolygonToCellsSizeExperimental)(
Expand Down
Loading