test(writer): property-based lossless round-trip for ALP (f32/f64)#88
Merged
Conversation
Seeded @MethodSource generators feed ~100 random arrays per width — ALP-friendly decimals (clean exponent path), fully-random bit patterns (patch path), and a curated edge array (±0, subnormals, MIN/MAX, NaN, ±Inf) — through encode → decode and assert the result is bit-identical to the input. Far stronger than the existing isCloseTo example tests. Surfaced one documented edge: ALP collapses -0.0 → +0.0 (its round-trip check treats -0.0 == 0.0, so signed zero isn't patched; matches the Rust reference). Value-lossless, not bit-lossless for signed zero — the assertion canonicalizes ±0 and the class doc explains why; everything else must be bit-exact. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Seeded @MethodSource generators feed ~100 random arrays per width — ALP-friendly
decimals (clean exponent path), fully-random bit patterns (patch path), and a
curated edge array (±0, subnormals, MIN/MAX, NaN, ±Inf) — through
encode → decode and assert the result is bit-identical to the input. Far stronger
than the existing isCloseTo example tests.
Surfaced one documented edge: ALP collapses -0.0 → +0.0 (its round-trip check
treats -0.0 == 0.0, so signed zero isn't patched; matches the Rust reference).
Value-lossless, not bit-lossless for signed zero — the assertion canonicalizes ±0
and the class doc explains why; everything else must be bit-exact.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com