Skip to content

Commit

Permalink
exhaustive test for a few resolution pairs
Browse files Browse the repository at this point in the history
  • Loading branch information
ajfriend committed Sep 27, 2024
1 parent 7cb8f12 commit 07955b5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_h3.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,3 +488,21 @@ def test_cell_to_children_size2():
h3.cell_to_children_size(h, r)
for h in cells
)

def test_child_pos3():
def cells_at_res(res):
cells = h3.get_res0_cells()
for parent in cells:
yield from h3.cell_to_children(parent, res)

def roundtrip(children, res_parent):
for c in children:
parent = h3.cell_to_parent(c, res_parent)
pos = h3.cell_to_child_pos(res_parent, c)
yield h3.child_pos_to_cell(parent, res_child, pos)

for res_parent in [0,1]:
for res_child in [0,1,2,3]:
if res_parent <= res_child:
children = set(cells_at_res(res_child))
assert set(roundtrip(children, res_parent)) == children

0 comments on commit 07955b5

Please sign in to comment.