Skip to content

[Tests] Stabilize floating-point geometry assertions#76

Merged
NachoSoto merged 1 commit into
masterfrom
fix-floating-point-test-flake
Jul 11, 2026
Merged

[Tests] Stabilize floating-point geometry assertions#76
NachoSoto merged 1 commit into
masterfrom
fix-floating-point-test-flake

Conversation

@NachoSoto

Copy link
Copy Markdown
Owner

Summary

  • replace exact CGRect equality with component-wise closeness checks in the four randomized aspect-preserving scale tests
  • keep true identity-path assertions exact
  • centralize the approximate rectangle assertions in a small test helper that preserves call-site file and line reporting

Root cause

The randomized tests derive a canvas size with floating-point multiplication, then the production calculation may recompute the same geometry through division and multiplication. Mathematically equivalent results can therefore differ by a few quadrillionths—for example an origin of 7.1e-15 instead of zero—without indicating a rendering bug.

Validation

  • ImageInflaterRendererSpec repeated 50 times: 1,150 tests passed
  • full iOS suite: 60 tests passed
  • swiftlint --config .swiftlint.yml --strict: 0 violations

@NachoSoto
NachoSoto marked this pull request as ready for review July 11, 2026 17:02
@NachoSoto
NachoSoto merged commit b2b0c32 into master Jul 11, 2026
1 check passed
@NachoSoto
NachoSoto deleted the fix-floating-point-test-flake branch July 11, 2026 17:02
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