add more test coverage to native sha_digest tests#512
Open
meilu-git wants to merge 8 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Expands the C++ native SHA digest test suite to increase coverage across one-shot and streaming digest APIs, including correctness (known-answer) checks and argument validation edge cases.
Changes:
- Added extensive negative/edge-case tests for one-shot and streaming digest APIs (null pointers, invalid handles, buffer sizing).
- Added known-answer vector tests for SHA1/SHA256/SHA384/SHA512 (including empty input) for both one-shot and streaming flows.
- Added consistency tests comparing streaming vs one-shot outputs across varied chunk boundaries.
d8583e3 to
5fc7a6f
Compare
981d5e5 to
bf7d08e
Compare
Comment on lines
+125
to
+137
| for (size_t i = 0; i < hex_len; i += 2) | ||
| { | ||
| unsigned int value = 0; | ||
| int parsed_count = std::sscanf(hex + i, "%2x", &value); | ||
|
|
||
| if (parsed_count != 1) | ||
| { | ||
| ADD_FAILURE() << "Failed to parse hex string at offset " << i; | ||
| return {}; | ||
| } | ||
|
|
||
| bytes.push_back(static_cast<uint8_t>(value)); | ||
| } |
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.
No description provided.