Commit 05032d4
authored
Add isValidIndex function (#1056)
* Add isValidIndex function
Implement a general validation function that checks if an H3 index
is valid for any mode (cell, directed edge, or vertex).
Changes:
- Add isValidIndex() function declaration to h3api.h.in
- Implement isValidIndex() in h3Index.c
- Add includes for directedEdge.h and vertex.h in h3Index.c
- Add comprehensive test coverage in testH3Index.c
The function returns true if the index is valid as a cell, directed edge,
or vertex, providing a single validation function for any H3 index type.
Fixes #1043
* Fix neighbor retrieval in isValidIndex test
Replace incorrect neighbor++ with proper gridRingUnsafe call to get
an actual neighboring cell for directed edge testing. Simply incrementing
an H3Index will almost never produce a valid neighboring cell.
This addresses the review feedback from ajfriend on lines 224-227.
* Fix clang-format formatting in isValidIndex function
Apply clang-format style to match project formatting conventions:
- Put first two conditions on same line
- Wrap long comment to 80 characters
* Fix clang-format formatting in h3api.h.in header
Apply clang-format style to isValidIndex documentation comment:
- Wrap comment across 3 lines for proper formatting1 parent 5af8ee5 commit 05032d4
File tree
3 files changed
+59
-0
lines changed- src
- apps/testapps
- h3lib
- include
- lib
3 files changed
+59
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
215 | 250 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
555 | 566 | | |
556 | 567 | | |
557 | 568 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
325 | 327 | | |
326 | 328 | | |
327 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
328 | 341 | | |
329 | 342 | | |
330 | 343 | | |
| |||
0 commit comments