Skip to content

Commit 7a6f5ec

Browse files
author
Isaac Brodsky
committed
Add test driver for h3-pg#56
1 parent 4b574f0 commit 7a6f5ec

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/apps/testapps/testPolygonToCellsReported.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,30 @@ SUITE(polygonToCells_reported) {
157157
t_assert(actualNumIndexes == 4353, "got expected polygonToCells size");
158158
free(hexagons);
159159
}
160+
161+
TEST(h3pg_56) {
162+
LatLng testVerts[] = {{H3_EXPORT(degsToRads)(72.1254917),
163+
H3_EXPORT(degsToRads)(-110.0018386)},
164+
{H3_EXPORT(degsToRads)(72.5810473),
165+
H3_EXPORT(degsToRads)(-110.0018638)},
166+
{H3_EXPORT(degsToRads)(72.108825),
167+
H3_EXPORT(degsToRads)(-110.0018377)},
168+
{H3_EXPORT(degsToRads)(72.1254917),
169+
H3_EXPORT(degsToRads)(-110.0018386)}};
170+
GeoLoop testGeoLoop = {.numVerts = 4, .verts = testVerts};
171+
GeoPolygon testPolygon;
172+
testPolygon.geoloop = testGeoLoop;
173+
testPolygon.numHoles = 0;
174+
175+
int res = 8;
176+
int numHexagons = H3_EXPORT(maxPolygonToCellsSize)(&testPolygon, res);
177+
t_assert(numHexagons == 153382344, "number of hexagons estimated is very large");
178+
H3Index *hexagons = calloc(numHexagons, sizeof(H3Index));
179+
180+
H3_EXPORT(polygonToCells)(&testPolygon, res, hexagons);
181+
int actualNumIndexes = countNonNullIndexes(hexagons, numHexagons);
182+
183+
t_assert(actualNumIndexes == 0, "actual number of cells is zero");
184+
free(hexagons);
185+
}
160186
}

0 commit comments

Comments
 (0)