test(http2/hpack): expand coverage for hpack.cpp#1044
Merged
Conversation
Adds tests/unit/hpack_extra_coverage_test.cpp closing remaining gaps after hpack_test.cpp and hpack_coverage_test.cpp: - Static table boundary entries (index 61, name-only lookup ordering, mismatched-value fall-through) - Dynamic table get() past entry_count, growing max_size without eviction, full-match preference over name-only match - Encoder static-name-mismatched-value path forcing literal-with-indexing via static name reference - Decoder happy paths for literal-without-indexing (0x00) new-name and indexed-name forms, never-indexed (0x10) prefix, and multi-header blocks - Multi-byte integer decoding under the 64-bit overflow threshold - Huffman stub encoded_size and byte-for-byte round-trip contract lock - Encoder/decoder pair convergence for static-only emissions and mixed static/dynamic flows Each decoder-path test builds wire bytes by hand against RFC 7541 §6 so the decoder is the unit under test, not the encoder upstream of it.
Contributor
Coverage Report
Coverage DetailsFull HTML report is available as a build artifact. |
This was referenced Apr 25, 2026
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.
Closes #1031
What
Adds
tests/unit/hpack_extra_coverage_test.cppand registers it asnetwork_hpack_extra_coverage_testto push line coverage ofsrc/protocols/http2/hpack.cpppast the 70% / branch coverage past the60% bar required by Issue #1031 acceptance criteria.
The new suite complements the prior two:
hpack_test.cpp(Issue Add unit tests for HTTP/2, secure transport, and WebSocket server modules #976) — basic functional coveragehpack_coverage_test.cpp(Issue test(http2): expand hpack.cpp coverage (encoder/decoder/dynamic_table edge cases) #1009) — wire-format and error pathsWhy
src/protocols/http2/hpack.cppwas identified by the #953 audit as oneof the lowest-coverage files in the network_system source tree. Closing
the remaining gaps directly contributes to the #953 ecosystem-wide
80% line / 70% branch goal.
Where
tests/unit/hpack_extra_coverage_test.cpp— new test filetests/CMakeLists.txt— registernetwork_hpack_extra_coverage_testCHANGELOG.md,docs/CHANGELOG.md— Tests / Added entriesHow
The new tests close the following residual gaps:
www-authenticate), large-index nullopt, name-only ordering for duplicate-name rows, mismatched-value fall-throughhttp_headerinvariantsentry_countreturns nullopt, growingmax_sizedoes not evict, shrinkingmax_sizebelow one entry evicts all, full-match preferred over name-only:method PATCH,:authoritywith value), empty-value brand-new header takes new-name path0x00) new-name and indexed-name forms, never-indexed (0x10) new-name, multi-header blocksencoded_sizematches input size,encode/decodebyte-for-byte round-tripEach decoder test builds wire bytes by hand against RFC 7541 §6 so the
unit under test is the decoder itself, not an encoder upstream of it.
Test Plan
network_hpack_extra_coverage_testtarget along withthe other unit tests.
develop(underBUILD_WITH_*flags +lcov --rc lcov_branch_coverage=1) willre-measure
src/protocols/http2/hpack.cppagainst the 70% line /60% branch targets.
Notes
this sandbox; the project policy is that CI does not run on develop-
target PRs (
workflow/branching-strategy.md), so the coveragemeasurement runs on
developafter merge.hpack.cppsource modifications — purely additive test work.