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

Method test_square

geometry/tests/test_jarvis_march.py:89–95  ·  view source on GitHub ↗

Test convex hull of a square.

(self)

Source from the content-addressed store, hash-verified

87 assert jarvis_march([Point(0, 0), Point(1, 1)]) == []
88
89 def test_square(self) -> None:
90 """Test convex hull of a square."""
91 p1, p2 = Point(0, 0), Point(1, 0)
92 p3, p4 = Point(1, 1), Point(0, 1)
93 hull = jarvis_march([p1, p2, p3, p4])
94 assert len(hull) == 4
95 assert all(p in hull for p in [p1, p2, p3, p4])
96
97 def test_duplicate_points(self) -> None:
98 """Test handling of duplicate points."""

Callers

nothing calls this directly

Calls 2

PointClass · 0.90
jarvis_marchFunction · 0.90

Tested by

no test coverage detected