Skip to content

Commit edfb70f

Browse files
author
Nicholas Rabinowitz
committed
Test all pentagons at all resolutions
1 parent c78deef commit edfb70f

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

src/apps/testapps/testH3UniEdge.c

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,21 +124,30 @@ SUITE(h3UniEdge) {
124124
}
125125

126126
TEST(getH3UnidirectionalEdgeFromPentagon) {
127-
H3Index pentagon = 0x801dfffffffffff;
127+
H3Index pentagons[NUM_PENTAGONS] = {0};
128128
H3Index ring[7] = {0};
129+
H3Index pentagon;
129130
H3Index edge;
130131

131-
H3_EXPORT(kRing)(pentagon, 1, ring);
132-
133-
for (int i = 0; i < 7; i++) {
134-
H3Index neighbor = ring[i];
135-
if (neighbor == pentagon || neighbor == 0) continue;
136-
edge = H3_EXPORT(getH3UnidirectionalEdge)(pentagon, neighbor);
137-
t_assert(H3_EXPORT(h3UnidirectionalEdgeIsValid)(edge),
138-
"pentagon-to-neighbor is a valid edge");
139-
edge = H3_EXPORT(getH3UnidirectionalEdge)(neighbor, pentagon);
140-
t_assert(H3_EXPORT(h3UnidirectionalEdgeIsValid)(edge),
141-
"neighbor-to-pentagon is a valid edge");
132+
for (int res = 0; res < 16; res++) {
133+
H3_EXPORT(getPentagonIndexes)(res, pentagons);
134+
for (int p = 0; p < NUM_PENTAGONS; p++) {
135+
pentagon = pentagons[p];
136+
H3_EXPORT(kRing)(pentagon, 1, ring);
137+
138+
for (int i = 0; i < 7; i++) {
139+
H3Index neighbor = ring[i];
140+
if (neighbor == pentagon || neighbor == 0) continue;
141+
edge =
142+
H3_EXPORT(getH3UnidirectionalEdge)(pentagon, neighbor);
143+
t_assert(H3_EXPORT(h3UnidirectionalEdgeIsValid)(edge),
144+
"pentagon-to-neighbor is a valid edge");
145+
edge =
146+
H3_EXPORT(getH3UnidirectionalEdge)(neighbor, pentagon);
147+
t_assert(H3_EXPORT(h3UnidirectionalEdgeIsValid)(edge),
148+
"neighbor-to-pentagon is a valid edge");
149+
}
150+
}
142151
}
143152
}
144153

0 commit comments

Comments
 (0)