diff --git a/src/apps/testapps/testH3ToLocalIj.c b/src/apps/testapps/testH3ToLocalIj.c index 62b5e5f11..591de702b 100644 --- a/src/apps/testapps/testH3ToLocalIj.c +++ b/src/apps/testapps/testH3ToLocalIj.c @@ -72,7 +72,17 @@ SUITE(h3ToLocalIj) { ij.i = 2; t_assert( H3_EXPORT(experimentalLocalIjToH3)(origin, &ij, &retrieved) != 0, - "out of range base cell"); + "out of range base cell (1)"); + ij.i = 0; + ij.j = 2; + t_assert( + H3_EXPORT(experimentalLocalIjToH3)(origin, &ij, &retrieved) != 0, + "out of range base cell (2)"); + ij.i = -2; + ij.j = -2; + t_assert( + H3_EXPORT(experimentalLocalIjToH3)(origin, &ij, &retrieved) != 0, + "out of range base cell (3)"); } TEST(ijOutOfRange) { diff --git a/src/h3lib/lib/localij.c b/src/h3lib/lib/localij.c index 504153680..9816e2484 100644 --- a/src/h3lib/lib/localij.c +++ b/src/h3lib/lib/localij.c @@ -290,7 +290,7 @@ int localIjkToH3(H3Index origin, const CoordIJK* ijk, H3Index* out) { // check for res 0/base cell if (res == 0) { - if (ijk->i > 1 || ijk->i > 1 || ijk->i > 1) { + if (ijk->i > 1 || ijk->j > 1 || ijk->k > 1) { // out of range input return 1; }