Add test for resolutions beyond max to h3ToChildren tests
/*
- * Copyright 2017-2018 Uber Technologies, Inc.
+ * Copyright 2017-2019 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -109,7 +109,7 @@ SUITE(h3ToChildren) {
free(children);
}
- TEST(childResTooHigh) {
+ TEST(childResTooCoarse) {
const int expectedCount = 0;
const int paddedCount = 7;
@@ -120,6 +120,18 @@ SUITE(h3ToChildren) {
free(children);
}
+ TEST(childResTooFine) {
+ const int expectedCount = 0;
+ const int paddedCount = 7;
+ H3Index sfHexMax = H3_EXPORT(geoToH3)(&sf, MAX_H3_RES);
+
+ H3Index* children = calloc(paddedCount, sizeof(H3Index));
+ H3_EXPORT(h3ToChildren)(sfHexMax, MAX_H3_RES + 1, children);
+
+ verifyCountAndUniqueness(children, paddedCount, expectedCount);
+ free(children);
+ }
+
TEST(pentagonChildren) {
H3Index pentagon;
setH3Index(&pentagon, 1, 4, 0);
