Skip to content

feat(geometry): define supported boundaries and add regression tests … - #42

Open
Sapna2007-sst wants to merge 1 commit into
S-AI-Projects:masterfrom
Sapna2007-sst:R45-T002
Open

Sapna2007-sst wants to merge 1 commit into
S-AI-Projects:masterfrom
Sapna2007-sst:R45-T002

Conversation

@Sapna2007-sst

Copy link
Copy Markdown

Description

This pull request defines and documents the supported boundary contract of LineIntersection and introduces focused regression boundary tests covering degenerate zero-length segments, interior crossings, T-junctions, touching endpoints, extreme coordinates, and null precondition handling.

Related Issue

Fixes: #2

Type of Change

  • Tests
  • Documentation
  • Bug Fix
  • New Feature
  • UI/UX Improvement
  • Performance Improvement
  • Refactoring / Maintenance
  • CI/CD

Changes Made

  • Documented the supported boundary contract in src/main/java/com/thealgorithms/geometry/LineIntersection.java detailing 32-bit integer coordinate bounds, degenerate point handling, interior and boundary intersections, collinear overlaps, and non-null preconditions.
  • Expanded src/test/java/com/thealgorithms/geometry/LineIntersectionTest.java with tests on both sides of each boundary:
    • Smallest valid input ((0, 0) degenerate points intersecting, alongside disjoint degenerate points).
    • Ordinary input (standard interior crossing at (3.0, 3.0)).
    • T-junction boundary (endpoint lying on segment interior vs. separated by 1 unit).
    • Touching endpoint boundary (non-collinear vertex touching vs. shifted gap).
    • Extreme coordinate domain boundary testing coordinates up to ±1,000,000.
    • Null input precondition check asserting NullPointerException.
    • Private constructor reflection contract.
  • Added automated boundary check runner work/R45-T002/check.py and saved verification evidence in work/R45-T002/results.json and work/R45-T002/evidence.md.

Screenshots / Recordings

N/A (backend geometry utility and test changes only; non-UI)

Testing

All changes have been validated locally using JDK 21 and Maven:

  • mvn test -Dtest=LineIntersectionTest (Tests run: 14, Failures: 0, Errors: 0, Skipped: 0)
  • mvn checkstyle:check (0 Checkstyle violations)
  • python3 work/R45-T002/check.py (All checks and boundary assertions passed successfully)

Checklist

  • I have tested my changes locally.
  • I have added or updated tests, if needed.
  • I have updated documentation, if needed.
  • I have followed the project's coding guidelines.
  • I have run the relevant tests and checks.
  • I have addressed previous review feedback, if applicable.
  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms include a corresponding test class that validates their functionality.
  • All new code adheres to repository style conventions and passes mvn checkstyle:check.

Additional Notes

  • Precondition lines establishing input requirements are explicitly cited in both the test methods and work/R45-T002/evidence.md.
  • Automated check runner can be verified anytime with python3 work/R45-T002/check.py.

…for LineIntersection (R45-T002)

- Document supported domain and boundary behavior in LineIntersection Javadoc
- Add focused boundary test suite in LineIntersectionTest covering degenerate zero-length points, standard crossing, T-junction, touching endpoints, extreme coordinates, and null preconditions
- Add automated verification check runner work/R45-T002/check.py and verification evidence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant