MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / test_triangle

Method test_triangle

geometry/tests/test_jarvis_march.py:40–45  ·  view source on GitHub ↗

Test convex hull of a triangle.

(self)

Source from the content-addressed store, hash-verified

38 """Tests for the jarvis_march function."""
39
40 def test_triangle(self) -> None:
41 """Test convex hull of a triangle."""
42 p1, p2, p3 = Point(1, 1), Point(2, 1), Point(1.5, 2)
43 hull = jarvis_march([p1, p2, p3])
44 assert len(hull) == 3
45 assert all(p in hull for p in [p1, p2, p3])
46
47 def test_collinear_points(self) -> None:
48 """Test that collinear points return empty hull."""

Callers

nothing calls this directly

Calls 2

PointClass · 0.90
jarvis_marchFunction · 0.90

Tested by

no test coverage detected