diff --git a/src/apps/testapps/testCompactCells.c b/src/apps/testapps/testCompactCells.c index 94e1d01e8..b1ff58fea 100644 --- a/src/apps/testapps/testCompactCells.c +++ b/src/apps/testapps/testCompactCells.c @@ -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;