Skip to content

Commit

Permalink
Add xor test to cytriangle test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
m-clare committed May 13, 2024
1 parent 977d76d commit 9df7d2a
Showing 1 changed file with 117 additions and 46 deletions.
163 changes: 117 additions & 46 deletions tests/test_cytriangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,53 +132,124 @@ def test_output_edge_fields():
assert test.out.edges == [[0, 1], [1, 2], [2, 0], [3, 2], [1, 3]]


def test_refine_output_fields():
test = CyTriangle(input_dict=tricall_input)
test.triangulate("czAevn")
refine_output = test.get_output_as_dict()
test_refine = CyTriangle(refine_output)
test_refine.in_.set_triangle_areas([3.0, 1.0])
test_refine.triangulate("prazBP")
assert test_refine.out.triangles == [
[26, 10, 13],
[24, 4, 9],
[18, 8, 15],
[11, 14, 1],
[14, 5, 9],
[14, 9, 7],
[4, 7, 9],
[4, 0, 7],
[0, 1, 7],
[24, 9, 5],
[12, 16, 17],
[6, 16, 11],
[14, 11, 16],
[1, 14, 7],
[12, 5, 14],
[15, 24, 5],
[6, 17, 16],
[24, 26, 13],
[19, 12, 17],
[2, 10, 25],
[23, 22, 17],
[14, 16, 12],
[12, 19, 18],
[18, 19, 8],
[8, 20, 15],
[5, 12, 18],
[23, 17, 21],
[22, 19, 17],
[26, 25, 10],
[26, 15, 20],
[21, 3, 23],
[22, 8, 19],
[21, 17, 6],
[4, 24, 13],
[5, 18, 15],
[20, 2, 25],
[15, 26, 24],
[25, 26, 20],
def test_xor_section_properties():
test = CyTriangle(
input_dict={
"vertices": [
[1.0, 0.0],
[0.0, 0.0],
[0.0, 1.0],
[0.5, 1.0],
[0.5, 0.5],
[1.0, 0.5],
[1.0, 1.0],
[0.5, 1.5],
[1.5, 1.5],
[1.5, 0.5],
],
"segments": [
[0, 1],
[1, 2],
[2, 3],
[3, 4],
[4, 5],
[5, 0],
[6, 3],
[3, 7],
[7, 8],
[8, 9],
[9, 5],
[5, 6],
],
"holes": [[0.75, 0.75]],
"regions": [
{"vertex": [0.25, 0.75], "marker": 0, "max_area": 0},
{"vertex": [1.0, 1.25], "marker": 1, "max_area": 0},
],
}
)
test.triangulate("pq30.0Aao2")
out_vertices = [
[1.0, 0.0],
[0.0, 0.0],
[0.0, 1.0],
[0.5, 1.0],
[0.5, 0.5],
[1.0, 0.5],
[1.0, 1.0],
[0.5, 1.5],
[1.5, 1.5],
[1.5, 0.5],
[0.25, 0.25],
[0.25, 0.75],
[0.0, 0.5],
[0.5, 0.0],
[0.75, 0.25],
[0.25, 1.0],
[0.5, 0.75],
[0.5, 1.25],
[0.75, 1.0],
[0.75, 1.25],
[1.0, 0.25],
[0.75, 0.5],
[1.25, 0.75],
[1.5, 1.0],
[1.25, 1.25],
[1.0, 0.75],
[1.25, 0.5],
[1.0, 1.5],
]
test_output_vertices = test.out.vertices
assert out_vertices == test_output_vertices


# def test_refine_output_fields():
# test = CyTriangle(input_dict=tricall_input)
# test.triangulate("czAevn")
# refine_output = test.get_output_as_dict()
# test_refine = CyTriangle(refine_output)
# test_refine.in_.set_triangle_areas([3.0, 1.0])
# test_refine.triangulate("prazBP")
# assert test_refine.out.triangles == [
# [26, 10, 13],
# [24, 4, 9],
# [18, 8, 15],
# [11, 14, 1],
# [14, 5, 9],
# [14, 9, 7],
# [4, 7, 9],
# [4, 0, 7],
# [0, 1, 7],
# [24, 9, 5],
# [12, 16, 17],
# [6, 16, 11],
# [14, 11, 16],
# [1, 14, 7],
# [12, 5, 14],
# [15, 24, 5],
# [6, 17, 16],
# [24, 26, 13],
# [19, 12, 17],
# [2, 10, 25],
# [23, 22, 17],
# [14, 16, 12],
# [12, 19, 18],
# [18, 19, 8],
# [8, 20, 15],
# [5, 12, 18],
# [23, 17, 21],
# [22, 19, 17],
# [26, 25, 10],
# [26, 15, 20],
# [21, 3, 23],
# [22, 8, 19],
# [21, 17, 6],
# [4, 24, 13],
# [5, 18, 15],
# [20, 2, 25],
# [15, 26, 24],
# [25, 26, 20],
# ]


def test_memory_deallocation():
Expand Down

0 comments on commit 9df7d2a

Please sign in to comment.