ofRectangleTests: extended == / != coverage (follow-up to #8567) - #8570
Merged
Merged
Conversation
Add checks across float magnitudes and signs (1 ULP at 1, 100, 1920, -3.5, FLT_MAX), integer coordinates (incl. INT_MAX/INT_MIN and 2^24 where neighbouring ints share a float), signed zero and denormals, non-finite values, scale/translate round trips, and 200,000 seeded random pairs compared in both directions.
danoli3
force-pushed
the
ofRectangle-equality-tests
branch
from
October 3, 2026 05:49
5e349c1 to
ed9d6df
Compare
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.
Follow-up to #8567 (now merged:
operator!=returns!(*this == rect)). Rebased on master, so this PR is just one commit extendingtests/types/ofRectangleTests.Added test coverage
Every case checks that
operator!=is the negation ofoperator==, and where the answer is well defined, thatoperator==gives it:FLT_MAX;0.1f + 0.2fvs0.3f; 4 ULP and0.1vs0.1000001stay unequalINT_MAX,INT_MIN, and 2^24 where neighbouring ints map to the same float / 1 ULP apart+0vs-0,0vsdenorm_min,FLT_MINofIsFloatEqualis not meaningful there (inf - infis NaN)scale/translate/scaleFromCenterround tripsVerification
Compiled this test
main.cpp(with a thinofxUnitTestsshim) against the realofRectangle.cppfrom before #8567 and with the fix:A larger standalone sweep (4M comparisons) showed 166,430
==/!=contradictions before the fix and 0 with the fix. The full test project builds/runs in CI viascripts/ci/linux64/run_tests.sh.Behaviour notes (inherited from
ofIsFloatEqual, not introduced here)==to itself, sor != ris nowtruefor it (wasfalse);+inf == -infistrue.eps * |a|(~1 ULP), so drift of a few ULP (e.g. 10 ×translate(0.1)then-1) still compares unequal.