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

Test for compacting all res 1 cells #914

Closed
wants to merge 14 commits into from
28 changes: 28 additions & 0 deletions src/apps/testapps/testCompactCells.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,34 @@ SUITE(compactCells) {
free(children);
}

TEST(allRes1) {
const int64_t numRes0 = 122;
const int64_t numRes1 = 842;
H3Index *cells0 = calloc(numRes0, sizeof(H3Index));
H3Index *cells1 = calloc(numRes1, sizeof(H3Index));
H3Index *out = calloc(numRes1, sizeof(H3Index));

H3_EXPORT(getRes0Cells)(cells0);
t_assert(cells0[0] == 0x8001fffffffffff,
"got expected first res0 cell");

t_assertSuccess(
H3_EXPORT(uncompactCells)(cells0, numRes0, cells1, numRes1, 1));

// Fails at compactCells.
// However:
// Passes if numUncompacted <= 40
// Fails if numUncompacted >= 41.
int64_t numUncompacted = numRes1;
t_assertSuccess(H3_EXPORT(compactCells)(cells1, out, numUncompacted));

// TODO: check that output matches cells0

free(cells0);
free(cells1);
free(out);
}

TEST(res0) {
int hexCount = NUM_BASE_CELLS;

Expand Down
Loading