Add equivalence tests for capMissingBytes old vs new formula#23
Merged
bernardladenthin merged 2 commits intomasterfrom Apr 8, 2026
Merged
Conversation
Adds two private static helper methods to StreamBufferTest that extract the old (if-guarded) and new (unconditional Math.min) capping formulas verbatim, plus a @dataProvider with 10 input rows covering all three equivalence classes: A: maximumAvailableBytes < missingBytes (old if-branch fires) B: maximumAvailableBytes == missingBytes (boundary) C: maximumAvailableBytes > missingBytes (old if skipped, incl. > INT_MAX) The parameterised test capMissingBytes_oldAndNewFormula_returnSameResult asserts that both formulas produce identical int results for every row, proving the commit cb66b68 refactor is semantically correct. https://claude.ai/code/session_01HYTj7Mg73S1Le9QTn7XFxu
Old URLs used /repos/<owner>/ and /r/<owner>/ paths which are legacy. Updated to /repos/github/<owner>/ and /github/<owner>/ as required by the current Coveralls API. https://claude.ai/code/session_01HYTj7Mg73S1Le9QTn7XFxu
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.
Summary
This PR adds comprehensive test coverage to verify that the new
capMissingBytesformula (using unconditionalMath.min) produces identical results to the previous conditional formula across all edge cases.Key Changes
capMissingBytesformulas for direct comparison:capMissingBytesOld(): The original guarded if-block formula (pre-cb66b68)capMissingBytesNew(): The new unconditional Math.min formula (post-cb66b68)@DataProviderwith 11 test cases covering three scenarios:maxAvail < missingBytes(old if-branch executes, new Math.min picks maxAvail)maxAvail == missingBytes(boundary condition at equality)maxAvail > missingBytes(old skips if, new Math.min picks missingBytes)capMissingBytes_oldAndNewFormula_returnSameResult()that validates equivalence across all cases, including edge cases likeInteger.MAX_VALUEandLong.MAX_VALUENotable Implementation Details
@DataProviderfor parameterized testing with clear case categorizationhttps://claude.ai/code/session_01HYTj7Mg73S1Le9QTn7XFxu