Wnaf Unit Testing#1879
Open
42Pupusas wants to merge 9 commits into
Open
Conversation
Checks the four defining w-NAF properties (exactness, odd non-zero digits, magnitude bound, non-adjacency) over every byte 0..=255 and every window size 2..=8.
Replace Vec<Digit> in run() with a fixed-size stack buffer (Digits wrapper struct) and rewrite the non-adjacency check in exhaustive_wnaf_invariants as a single-pass scan instead of collecting into a Vec<usize>. The test module is now gated only on #[cfg(test)] and runs in full no_alloc environments (--no-default-features).
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.
Adds unit tests for
wnaf_formin thewnafcrate, covering known textbook vectors (zero scalar, single bits, borrow chains, alternating patterns) and adversarial edge cases (cross-byte carry, u64 limb boundaries, all-bits-set values up to 72 bits, maximum borrow depth per window size).These tests exercise
wnaf_format the byte level independently of any group or field implementation, which is a natural isolation boundary identified in the discussion around a broader testing strategy for the crate discussed on #1839