Repository navigation
feat(physics): test invariant and add property-based tests for ThinLe… - #44
Open
Sapna2007-sst wants to merge 1 commit into
Open
Sapna2007-sst wants to merge 1 commit into
Sapna2007-sst wants to merge 1 commit into
Conversation
…ns (R45-T004) - Document thin lens reciprocal and conjugate foci invariants in ThinLens Javadoc - Add property-based regression tests generating 100 deterministic bounded cases (seed 42L) asserting reciprocal, involution, and magnification invariants - Add smallest valid fixture (f=1.0, u=2.0), ordinary fixture (f=10.0, u=15.0), zero focal/object distance exception checks, virtual image checks, and reflection contract - Add automated verification check runner work/R45-T004/check.py with mutation rejection and verification evidence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces property-based and invariant regression tests for
ThinLens, documents the fundamental reciprocal and conjugate foci lens invariants in Javadoc, and verifies invariant consistency across 100 bounded valid random cases alongside edge-case and boundary conditions.Related Issue
Fixes: #4
Type of Change
Changes Made
(1.0 / v) + (1.0 / u) == 1.0 / fand conjugate foci reciprocity next to the implementation insrc/main/java/com/thealgorithms/physics/ThinLens.java.src/test/java/com/thealgorithms/physics/ThinLensTest.javawith:f = 1.0, u = 2.0yieldingv = 2.0, m = 1.0).f = 10.0, u = 15.0yieldingv = 30.0, m = 2.0).42L) checking reciprocal relations, conjugate foci involution, and magnification consistency.IllegalArgumentException.f = -10.0, u = 20.0withisRealImage == false).work/R45-T004/check.pywith invariant mutation sensitivity testing, and saved execution evidence inwork/R45-T004/results.jsonandwork/R45-T004/evidence.md.Screenshots / Recordings
N/A (physics ray optics utility and unit tests; non-UI)
Testing
All changes have been validated locally using JDK 21 and Maven:
mvn test -Dtest=ThinLensTest(Tests run: 9, Failures: 0, Errors: 0, Skipped: 0)mvn checkstyle:check(0 Checkstyle violations)python3 work/R45-T004/check.py(All checks, 100 property iterations, and mutation checks passed successfully)Checklist
mvn checkstyle:check.Additional Notes
work/R45-T004/evidence.md.python3 work/R45-T004/check.py.