in src/apps/testapps/testH3NeighborRotations.c [142:185]
int main(int argc, char* argv[]) {
// check command line args
if (argc != 2 && argc != 3) {
fprintf(stderr, "usage: %s resolution [maxK]\n", argv[0]);
exit(1);
}
int res = 0;
if (!sscanf(argv[1], "%d", &res)) error("resolution must be an integer");
int maxK = 5;
if (argc > 2) {
if (!sscanf(argv[2], "%d", &maxK)) error("maxK must be an integer");
}
TestOutput testOutput = {0, 0, 0, 0, 0};
// generate the test cases
for (int bc = 0; bc < NUM_BASE_CELLS; bc++) {
H3Index rootCell = H3_INIT;
H3_SET_MODE(rootCell, H3_HEXAGON_MODE);
H3_SET_BASE_CELL(rootCell, bc);
if (res == 0) {
doCell(rootCell, maxK, &testOutput);
} else {
int rootRes = H3_GET_RESOLUTION(rootCell);
H3_SET_RESOLUTION(rootCell, res);
recursiveH3IndexToGeo(rootCell, rootRes + 1, maxK, &testOutput);
}
}
printf("ret0: %d\nret1: %d\nret2: %d\n", testOutput.ret0, testOutput.ret1,
testOutput.ret2);
// ret2 should never occur, as it can only happen if we run over a pentagon
if (testOutput.ret2 > 0 || testOutput.ret0ValidationFailures ||
testOutput.ret1ValidationFailures) {
printf("FAILED\nfailed0: %d\nfailed1: %d\n",
testOutput.ret0ValidationFailures,
testOutput.ret1ValidationFailures);
return 1;
}
return 0;
}