Skip to content

Commit

Permalink
test: do some cursory checks for 2d
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Feb 19, 2024
1 parent 4a3ac2e commit ae68838
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions automated_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,3 +365,23 @@ def test_cross_section_inputs():
area = xs3d.cross_section(labels, [0,0,0], [0,0,1], [1,1,1])


def test_2d():
labels = np.ones([3,3], dtype=bool)
area = xs3d.cross_sectional_area(labels, [1,1], [0,1])
assert area == 3

area = xs3d.cross_sectional_area(labels, [1,1], [0,1], [3,3])
assert area == 9

area = xs3d.cross_sectional_area(labels, [1,1], [1,0], [1,1])
assert area == 3

area = xs3d.cross_sectional_area(labels, [1,1], [1,0], [5,5])
assert area == 15

area = xs3d.cross_sectional_area(labels, [0,0], [-1,1], [1,1])
assert np.isclose(area, 3 * np.sqrt(2))




0 comments on commit ae68838

Please sign in to comment.