Skip to content

Commit ce63b89

Browse files
author
Andrea Ghensi
committed
tests: add more tests for closest_point_segment_xy
1 parent aef7746 commit ce63b89

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
import pytest
2+
13
from compas.geometry import Point
24
from compas.geometry import Line
35
from compas.geometry import closest_point_on_segment_xy
46

57

6-
def test_closest_point_segment_xy():
7-
point = Point(0, 0, -10)
8+
@pytest.mark.parametrize(
9+
"point,point_on_line", [[[0, 0, -10], [1, 1, 0]], [[5, 4, 80], [4.5, 4.5, 0]]]
10+
)
11+
def test_closest_point_segment_xy(point, point_on_line):
812
line = Line([1, 1, -15], [10, 10, 20])
9-
ponl = closest_point_on_segment_xy(point, line)
10-
assert ponl == Point(1, 1, 0)
13+
ponl = closest_point_on_segment_xy(Point(*point), line)
14+
assert ponl == Point(*point_on_line)

0 commit comments

Comments
 (0)