Skip to content

test: add comprehensive SHA-1/256/512 coverage - #3381

Merged
oferchen merged 1 commit into
masterfrom
test/sha-modules-coverage
Apr 25, 2026
Merged

oferchen merged 1 commit into
masterfrom
test/sha-modules-coverage

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Adds 12 inline tests to each of Sha1, Sha256, Sha512 wrappers in crates/checksums/src/strong/ (1 -> 13 each).
  • Mirrors the CRC32C test pattern landed in test: add comprehensive CRC32C checksum coverage #3378.
  • Tests use only the existing public API; no production code touched.

Coverage added per module

  • FIPS-180-4 known vectors for empty input and "abc"
  • Streaming vs one-shot parity
  • Byte-at-a-time update() parity
  • 1 MiB+ cyclic-data determinism
  • Varied chunk-size incremental hashing
  • Default trait equivalence
  • Clone state preservation mid-stream
  • Length-extension sanity (hash("") != hash(&[0u8]))
  • Lowercase hex output format
  • StrongDigest trait dispatch parity (including DIGEST_LEN 20/32/64)

Test plan

  • cargo nextest run -p checksums --all-features (CI)
  • llvm-cov reports increased coverage for crates/checksums/src/strong/sha*.rs

Mirrors the CRC32C test pattern from PR #3378: empty/known-vector
hashes, streaming-vs-one-shot parity, byte-at-a-time updates, large
1 MiB+ inputs, varied chunk sizes, determinism, default/clone state,
length-extension protection, hex format checks, and StrongDigest trait
parity. Each module now has 13 tests (1 original + 12 added) covering
the full public API without touching production code.
@github-actions github-actions Bot added the test label Apr 25, 2026
@oferchen
oferchen merged commit 06a4b00 into master Apr 25, 2026
41 of 42 checks passed
@oferchen
oferchen deleted the test/sha-modules-coverage branch April 25, 2026 19:03
oferchen added a commit that referenced this pull request May 1, 2026
Mirrors the CRC32C test pattern from PR #3378: empty/known-vector
hashes, streaming-vs-one-shot parity, byte-at-a-time updates, large
1 MiB+ inputs, varied chunk sizes, determinism, default/clone state,
length-extension protection, hex format checks, and StrongDigest trait
parity. Each module now has 13 tests (1 original + 12 added) covering
the full public API without touching production code.
oferchen added a commit that referenced this pull request May 5, 2026
Mirrors the CRC32C test pattern from PR #3378: empty/known-vector
hashes, streaming-vs-one-shot parity, byte-at-a-time updates, large
1 MiB+ inputs, varied chunk sizes, determinism, default/clone state,
length-extension protection, hex format checks, and StrongDigest trait
parity. Each module now has 13 tests (1 original + 12 added) covering
the full public API without touching production code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant