Skip to content

Expand poly test coverage: closing segment, repeated vertex, tolerance#30

Open
gistrec wants to merge 1 commit into
masterfrom
test/poly-coverage
Open

Expand poly test coverage: closing segment, repeated vertex, tolerance#30
gistrec wants to merge 1 commit into
masterfrom
test/poly-coverage

Conversation

@gistrec

@gistrec gistrec commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

Test-only PR closing coverage gaps found during a library review. No library changes.

  • Re-enable LatLng(90, 180) cases in contains tests (pole queried at longitude 180, previously commented out) — verified passing in both geodesic and rhumb modes.
  • Closing segment: the only behavioral difference between on_edge and on_path — the implicit closing segment — was untested for polygons of ≥3 vertices. New mirrored tests use a triangle whose closing edge runs along the equator (where great-circle and Rhumb paths coincide): on_edge finds a point on it, on_path does not.
  • Repeated vertex: zero-length segments must neither crash nor match far-away points (exercises the denom <= 0 branch of sin_delta_bearing); degenerate two-identical-point polyline behaves like a single point.
  • Tolerance semantics: first test with a non-default tolerance — a point ~900.7 m off an equator segment is rejected at 500 m and accepted at 1000 m, in both modes.

All expectations were verified against the current implementation before being committed (no characterization of buggy behavior — the new cases are mode-independent by construction).

Test plan

- Re-enable the commented-out contains() cases for the pole queried at
  longitude 180 — both pass in geodesic and rhumb modes.
- Cover the only behavioral difference between on_edge and on_path: a
  point lying solely on the implicit closing segment of a polygon.
- Cover zero-length segments (repeated vertex) including the
  sin_delta_bearing denom <= 0 branch, and meters semantics of the
  tolerance parameter with a non-default value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant