Skip to content

Commit

Permalink
MAX_H3_RES should be tested inclusive (#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacbrodsky authored Mar 11, 2024
1 parent 094699b commit d00624c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
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

0 comments on commit d00624c

Please sign in to comment.