Skip to content

Improve Adler32 NMax test#124838

Open
saucecontrol wants to merge 2 commits intodotnet:mainfrom
saucecontrol:adler-test
Open

Improve Adler32 NMax test#124838
saucecontrol wants to merge 2 commits intodotnet:mainfrom
saucecontrol:adler-test

Conversation

@saucecontrol
Copy link
Member

@saucecontrol saucecontrol commented Feb 25, 2026

The existing test doesn't check the actual boundary condition. For example, if NMax is changed to 8192 in the Adler32 implementation, the tests still pass.

This change correctly breaks if NMax is set as small as 5553.

Copilot AI review requested due to automatic review settings February 25, 2026 01:05
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Feb 25, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Adler32Tests to validate the actual overflow boundary condition tied to Adler32’s delayed-modulo optimization (NMax), ensuring the test fails if NMax is reduced below the safe threshold.

Changes:

  • Reworks LargeInput_ExceedsNMax to prime the hasher into a maximal checksum state, then append max-value bytes to stress 32-bit intermediate overflow behavior.
  • Updates expected checksum values to match the new (stronger) test construction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.IO community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants