Skip to content

Commit a366378

Browse files
Expand test_halfedge function and add new test
1 parent 2f17f7b commit a366378

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

test/topologies.jl

+17-2
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,17 @@ end
372372
for e in 1:nelements(topology)
373373
he = half4elem(topology, e)
374374
inds = indices(elems[e])
375-
@test he.elem == e
376-
@test he.head inds
375+
i = 1
376+
while i length(inds)
377+
@test he.elem == e
378+
@test he.head inds
379+
@test he.next.elem == e
380+
@test he.prev.elem == e
381+
@test he.next.prev == he
382+
@test he.prev.next == he
383+
he = he.next
384+
i += 1
385+
end
377386
end
378387
end
379388

@@ -483,6 +492,7 @@ end
483492
# correct construction from inconsistent orientation
484493
e = connect.([(1, 2, 3), (3, 4, 2), (4, 3, 5), (6, 3, 1)])
485494
t = HalfEdgeTopology(e)
495+
test_halfedge(e, t)
486496
n = collect(elements(t))
487497
@test n[1] == e[1]
488498
@test n[2] != e[2]
@@ -492,9 +502,14 @@ end
492502
# more challenging case with inconsistent orientation
493503
e = connect.([(4, 1, 5), (2, 6, 4), (3, 5, 6), (4, 5, 6)])
494504
t = HalfEdgeTopology(e)
505+
test_halfedge(e, t)
495506
n = collect(elements(t))
496507
@test n == connect.([(5, 4, 1), (6, 2, 4), (6, 5, 3), (4, 5, 6)])
497508

509+
e = connect.([(1,2,3), (1,3,4), (2,5,3), (5,4,6), (3,5,4)], Triangle)
510+
t = HalfEdgeTopology(e)
511+
test_halfedge(e, t)
512+
498513
# indexable api
499514
g = GridTopology(10, 10)
500515
t = convert(HalfEdgeTopology, g)

0 commit comments

Comments
 (0)