Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 Add error return codes to h3Index.c (part 1) by isaacbrodsky · Pull Request #503 · uber/h3 · GitHub
Nothing Special   »   [go: up one dir, main page]

Skip to content
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
6 changes: 4 additions & 2 deletions examples/distance.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ double haversineDistance(double th1, double ph1, double th2, double ph2) {

int main(int argc, char *argv[]) {
// 1455 Market St @ resolution 15
H3Index h3HQ1 = stringToH3("8f2830828052d25");
H3Index h3HQ1;
stringToH3("8f2830828052d25", &h3HQ1);
// 555 Market St @ resolution 15
H3Index h3HQ2 = stringToH3("8f283082a30e623");
H3Index h3HQ2;
stringToH3("8f283082a30e623", &h3HQ2);

LatLng geoHQ1, geoHQ2;
cellToLatLng(h3HQ1, &geoHQ1);
Expand Down
3 changes: 2 additions & 1 deletion src/apps/filters/cellToBoundary.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ int main(int argc, char *argv[]) {
error("reading H3 index from stdin");
}

H3Index h3 = H3_EXPORT(stringToH3)(buff);
H3Index h3;
H3_EXPORT(stringToH3)(buff, &h3);
doCell(h3, kmlArg.found);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/apps/filters/cellToLatLng.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ int main(int argc, char *argv[]) {
error("reading H3 index from stdin");
}

H3Index h3 = H3_EXPORT(stringToH3)(buff);
H3Index h3;
H3_EXPORT(stringToH3)(buff, &h3);
doCell(h3, kmlArg.found);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/apps/filters/gridDisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ int main(int argc, char *argv[]) {
error("reading H3 index from stdin");
}

H3Index h3 = H3_EXPORT(stringToH3)(buff);
H3Index h3;
H3_EXPORT(stringToH3)(buff, &h3);
doCell(h3, k, printDistancesArg.found);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/apps/filters/gridDiskUnsafe.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ int main(int argc, char *argv[]) {
error("reading H3 index from stdin");
}

H3Index h3 = H3_EXPORT(stringToH3)(buff);
H3Index h3;
H3_EXPORT(stringToH3)(buff, &h3);
doCell(h3, k);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/apps/filters/h3ToComponents.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ int main(int argc, char *argv[]) {
error("reading H3 index from stdin");
}

H3Index h3 = H3_EXPORT(stringToH3)(buff);
H3Index h3;
H3_EXPORT(stringToH3)(buff, &h3);
doCell(h3, verboseArg.found);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/apps/filters/h3ToLocalIj.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ int main(int argc, char *argv[]) {
error("reading H3 index from stdin");
}

H3Index h3 = H3_EXPORT(stringToH3)(buff);
H3Index h3;
H3_EXPORT(stringToH3)(buff, &h3);
doCell(h3, origin);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/apps/testapps/testCellToBoundary.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ int main(int argc, char *argv[]) {
error("reading input H3 index from stdin");
}

H3Index h3 = H3_EXPORT(stringToH3)(buff);
H3Index h3;
t_assertSuccess(H3_EXPORT(stringToH3)(buff, &h3));

CellBoundary b;
readBoundary(stdin, &b);
Expand Down
5 changes: 4 additions & 1 deletion src/apps/testapps/testCellToCenterChild.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ SUITE(cellToCenterChild) {
"resolution");
t_assert(H3_EXPORT(getResolution)(centerChild) == childRes,
"center child should have correct resolution");
H3Index parent;
t_assertSuccess(
H3_EXPORT(cellToParent)(centerChild, res, &parent));
t_assert(
H3_EXPORT(cellToParent)(centerChild, res) == h3Index,
parent == h3Index,
"parent at original resolution should be initial index");
}
}
Expand Down
32 changes: 22 additions & 10 deletions src/apps/testapps/testCellToChildren.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,17 @@ static void assertSetsEqual(H3Index *set1, int len1, H3Index *set2, int len2) {
assertSubset(set2, len2, set1, len1);
}

static void checkChildren(H3Index h, int res, H3Index *expected,
int numExpected) {
int64_t numChildren = H3_EXPORT(cellToChildrenSize)(h, res);
static void checkChildren(H3Index h, int res, H3Error expectedError,
H3Index *expected, int numExpected) {
int64_t numChildren;
H3Error numChildrenError =
H3_EXPORT(cellToChildrenSize)(h, res, &numChildren);
t_assert(numChildrenError == expectedError, "Expected error code");
if (expectedError != E_SUCCESS) {
return;
}
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 imply that there are no errors we can test that won't be returned by cellToChildrenSize? I.e. there are no errors in cellToChildren that aren't in cellToChildrenSize?

Copy link
Collaborator Author
@isaacbrodsky isaacbrodsky Aug 11, 2021

Choose a reason for hiding this comment

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

cellToChildren always returns E_SUCCESS right now, so that is correct. It assumes its input has been validated by the size call.

H3Index *children = calloc(numChildren, sizeof(H3Index));
H3_EXPORT(cellToChildren)(h, res, children);
t_assertSuccess(H3_EXPORT(cellToChildren)(h, res, children));

assertSetsEqual(children, numChildren, expected, numExpected);

Expand All @@ -84,7 +90,8 @@ SUITE(cellToChildren_new) {
0x89283080dd3ffff, 0x89283080dd7ffff,
0x89283080ddbffff};

checkChildren(h, res, expected, sizeof(expected) / sizeof(H3Index));
checkChildren(h, res, E_SUCCESS, expected,
sizeof(expected) / sizeof(H3Index));
}

TEST(multipleResSteps) {
Expand All @@ -110,7 +117,8 @@ SUITE(cellToChildren_new) {
0x8a283080dc1ffff, 0x8a283080dd0ffff, 0x8a283080dc2ffff,
0x8a283080dd67fff};

checkChildren(h, res, expected, sizeof(expected) / sizeof(H3Index));
checkChildren(h, res, E_SUCCESS, expected,
sizeof(expected) / sizeof(H3Index));
}

TEST(sameRes) {
Expand All @@ -119,7 +127,8 @@ SUITE(cellToChildren_new) {

H3Index expected[] = {h};

checkChildren(h, res, expected, sizeof(expected) / sizeof(H3Index));
checkChildren(h, res, E_SUCCESS, expected,
sizeof(expected) / sizeof(H3Index));
}

TEST(childResTooCoarse) {
Expand All @@ -128,7 +137,8 @@ SUITE(cellToChildren_new) {

H3Index expected[] = {0}; // empty set; zeros are ignored

checkChildren(h, res, expected, sizeof(expected) / sizeof(H3Index));
checkChildren(h, res, E_RES_DOMAIN, expected,
8F70 sizeof(expected) / sizeof(H3Index));
}

TEST(childResTooFine) {
Expand All @@ -137,7 +147,8 @@ SUITE(cellToChildren_new) {

H3Index expected[] = {0}; // empty set; zeros are ignored

checkChildren(h, res, expected, sizeof(expected) / sizeof(H3Index));
checkChildren(h, res, E_RES_DOMAIN, expected,
sizeof(expected) / sizeof(H3Index));
}

TEST(pentagonChildren) {
Expand All @@ -160,6 +171,7 @@ SUITE(cellToChildren_new) {
0x830832fffffffff, 0x830833fffffffff, 0x830834fffffffff,
0x830835fffffffff, 0x830836fffffffff};

checkChildren(h, res, expected, sizeof(expected) / sizeof(H3Index));
checkChildren(h, res, E_SUCCESS, expected,
sizeof(expected) / sizeof(H3Index));
}
}
35 changes: 20 additions & 15 deletions src/apps/testapps/testCellToChildrenSize.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,37 @@ SUITE(cellToChildrenSize) {
TEST(cellToChildrenSize_hexagon) {
H3Index h = 0x87283080dffffff; // res 7 *hexagon*

t_assert(H3_EXPORT(cellToChildrenSize)(h, 3) == 0,
int64_t sz;
t_assert(H3_EXPORT(cellToChildrenSize)(h, 3, &sz) == E_RES_DOMAIN,
"got expected size for coarser res");
t_assert(H3_EXPORT(cellToChildrenSize)(h, 7) == 1,
"got expected size for same res");
t_assert(H3_EXPORT(cellToChildrenSize)(h, 8) == 7,
"got expected size for child res");
t_assert(H3_EXPORT(cellToChildrenSize)(h, 9) == 7 * 7,
"got expected size for grandchild res");
t_assertSuccess(H3_EXPORT(cellToChildrenSize)(h, 7, &sz));
t_assert(sz == 1, "got expected size for same res");
t_assertSuccess(H3_EXPORT(cellToChildrenSize)(h, 8, &sz));
t_assert(sz == 7, "got expected size for child res");
t_assertSuccess(H3_EXPORT(cellToChildrenSize)(h, 9, &sz));
t_assert(sz == 7 * 7, "got expected size for grandchild res");
}

TEST(cellToChildrenSize_pentagon) {
H3Index h = 0x870800000ffffff; // res 7 *pentagon*

t_assert(H3_EXPORT(cellToChildrenSize)(h, 3) == 0,
int64_t sz;
t_assert(H3_EXPORT(cellToChildrenSize)(h, 3, &sz) == E_RES_DOMAIN,
"got expected size for coarser res");
t_assert(H3_EXPORT(cellToChildrenSize)(h, 7) == 1,
"got expected size for same res");
t_assert(H3_EXPORT(cellToChildrenSize)(h, 8) == 6,
"got expected size for child res");
t_assert(H3_EXPORT(cellToChildrenSize)(h, 9) == (5 * 7) + (1 * 6),
t_assertSuccess(H3_EXPORT(cellToChildrenSize)(h, 7, &sz));
t_assert(sz == 1, "got expected size for same res");
t_assertSuccess(H3_EXPORT(cellToChildrenSize)(h, 8, &sz));
t_assert(sz == 6, "got expected size for child res");
t_assertSuccess(H3_EXPORT(cellToChildrenSize)(h, 9, &sz));
t_assert(sz == (5 * 7) + (1 * 6),
"got expected size for grandchild res");
}

TEST(cellToChildrenSize_largest_hexagon) {
H3Index h = 0x806dfffffffffff; // res 0 *hexagon*
int64_t expected = 4747561509943L; // 7^15
int64_t out = H3_EXPORT(cellToChildrenSize)(h, 15);
int64_t out;
t_assertSuccess(H3_EXPORT(cellToChildrenSize)(h, 15, &out));

t_assert(out == expected,
"got right size for children 15 levels below");
Expand All @@ -58,7 +62,8 @@ SUITE(cellToChildrenSize) {
TEST(cellToChildrenSize_largest_pentagon) {
H3Index h = 0x8009fffffffffff; // res 0 *pentagon*
int64_t expected = 3956301258286L; // 1 + 5*(7^15 - 1)/6
int64_t out = H3_EXPORT(cellToChildrenSize)(h, 15);
int64_t out;
t_assertSuccess(H3_EXPORT(cellToChildrenSize)(h, 15, &out));

t_assert(out == expected,
"got right size for children 15 levels below");
Expand Down
2 changes: 1 addition & 1 deletion src/apps/testapps/testCellToLatLng.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) {
error("parsing input (should be \"H3Index lat lng\")");

H3Index h3;
h3 = H3_EXPORT(stringToH3)(h3Str);
t_assertSuccess(H3_EXPORT(stringToH3)(h3Str, &h3));

LatLng coord;
setGeoDegs(&coord, latDegs, lngDegs);
Expand Down
12 changes: 7 additions & 5 deletions src/apps/testapps/testCellToParent.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ SUITE(cellToParent) {
for (int res = 1; res < 15; res++) {
for (int step = 0; step < res; step++) {
t_assertSuccess(H3_EXPORT(latLngToCell)(&sf, res, &child));
parent = H3_EXPORT(cellToParent)(child, res - step);
t_assertSuccess(
H3_EXPORT(cellToParent)(child, res - step, &parent));
t_assertSuccess(H3_EXPORT(latLngToCell)(&sf, res - step,
&comparisonParent));

Expand All @@ -43,13 +44,14 @@ SUITE(cellToParent) {
H3Index child;
t_assertSuccess(H3_EXPORT(latLngToCell)(&sf, 5, &child));

t_assert(H3_EXPORT(cellToParent)(child, 6) == 0,
H3Index parent;
t_assert(H3_EXPORT(cellToParent)(child, 6, &parent) == E_RES_MISMATCH,
"Higher resolution fails");
t_assert(H3_EXPORT(cellToParent)(child, -1) == 0,
t_assert(H3_EXPORT(cellToParent)(child, -1, &parent) == E_RES_DOMAIN,
"Invalid resolution fails");
t_assert(H3_EXPORT(cellToParent)(child, 15) == 0,
t_assert(H3_EXPORT(cellToParent)(child, 15, &parent) == E_RES_MISMATCH,
"Invalid resolution fails");
t_assert(H3_EXPORT(cellToParent)(child, 16) == 0,
t_assert(H3_EXPORT(cellToParent)(child, 16, &parent) == E_RES_DOMAIN,
"Invalid resolution fails");
}
}
17 changes: 11 additions & 6 deletions src/apps/testapps/testCompactCells.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,12 @@ SUITE(compactCells) {
// Arbitrary index
setH3Index(&h3, res, 0, 2);

int64_t arrSize = H3_EXPORT(cellToChildrenSize)(h3, res + 1) + 1;
int64_t arrSize;
t_assertSuccess(H3_EXPORT(cellToChildrenSize)(h3, res + 1, &arrSize));
arrSize++;
H3Index *children = calloc(arrSize, sizeof(H3Index));

H3_EXPORT(cellToChildren)(h3, res + 1, children);
t_assertSuccess(H3_EXPORT(cellToChildren)(h3, res + 1, children));
// duplicate one index
children[arrSize - 1] = children[0];

Expand All @@ -188,10 +190,12 @@ SUITE(compactCells) {
// Arbitrary pentagon parent cell
setH3Index(&h3, res, 4, 0);

int64_t arrSize = H3_EXPORT(cellToChildrenSize)(h3, res + 1) + 1;
int64_t arrSize;
t_assertSuccess(H3_EXPORT(cellToChildrenSize)(h3, res + 1, &arrSize));
arrSize++;
H3Index *children = calloc(arrSize, sizeof(H3Index));

H3_EXPORT(cellToChildren)(h3, res + 1, children);
t_assertSuccess(H3_EXPORT(cellToChildren)(h3, res + 1, children));
// duplicate one index
children[arrSize - 1] = H3_EXPORT(cellToCenterChild)(h3, res + 1);

Expand All @@ -215,10 +219,11 @@ SUITE(compactCells) {
// Arbitrary index
setH3Index(&h3, res, 0, 2);

int64_t arrSize = H3_EXPORT(cellToChildrenSize)(h3, res + 1);
int64_t arrSize;
t_assertSuccess(H3_EXPORT(cellToChildrenSize)(h3, res + 1, &arrSize));
H3Index *children = calloc(arrSize, sizeof(H3Index));

H3_EXPORT(cellToChildren)(h3, res + 1, children);
t_assertSuccess(H3_EXPORT(cellToChildren)(h3, res + 1, children));
// duplicate one index
children[arrSize - 1] = children[0];

Expand Down
2 changes: 1 addition & 1 deletion src/apps/testapps/testDirectedEdge.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ SUITE(directedEdge) {
H3Index edge;

for (int res = 0; res < MAX_H3_RES; res++) {
H3_EXPORT(getPentagons)(res, pentagons);
t_assertSuccess(H3_EXPORT(getPentagons)(res, pentagons));
for (int p = 0; p < NUM_PENTAGONS; p++) {
pentagon = pentagons[p];
H3_EXPORT(gridDisk)(pentagon, 1, ring);
Expand Down
5 changes: 3 additions & 2 deletions src/apps/testapps/testGetIcosahedronFaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
#include "utility.h"

static int countFaces(H3Index h3, int expectedMax) {
int sz = H3_EXPORT(maxFaceCount)(h3);
int sz;
t_assertSuccess(H3_EXPORT(maxFaceCount)(h3, &sz));
t_assert(sz == expectedMax, "got expected max face count");
int *faces = calloc(sz, sizeof(int));

H3_EXPORT(getIcosahedronFaces)(h3, faces);
t_assertSuccess(H3_EXPORT(getIcosahedronFaces)(h3, faces));

int validCount = 0;
for (int i = 0; i < sz; i++) {
Expand Down
5 changes: 3 additions & 2 deletions src/apps/testapps/testH3Api.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ SUITE(h3Api) {
H3Index h3;
CellBoundary b;
for (int i = 0; i < numHexes; i++) {
h3 = H3_EXPORT(stringToH3)(hexes[i]);
t_assertSuccess(H3_EXPORT(stringToH3)(hexes[i], &h3));
H3_EXPORT(cellToBoundary)(h3, &b);
t_assert(b.numVerts == 7, "got expected vertex count");
}
}

TEST(cellToBoundary_classIIIEdgeVertex_exact) {
// Bug test for https://github.com/uber/h3/issues/45
H3Index h3 = H3_EXPORT(stringToH3)("894cc536537ffff");
H3Index h3;
t_assertSuccess(H3_EXPORT(stringToH3)("894cc536537ffff", &h3));
CellBoundary boundary;
boundary.numVerts = 7;
setGeoDegs(&boundary.verts[0], 18.043333154, -66.27836523500002);
Expand Down
Loading
0