test(quic): expand coverage for frame.cpp#1047
Merged
Merged
Conversation
Add tests/unit/quic_frame_extra_coverage_test.cpp with 63 additional test cases targeting branches not exercised by the existing quic_frame_coverage_test.cpp (#1011) or quic_frame_types_test.cpp (#974): - peek_type with 4-byte and 8-byte varint type prefixes - parse_all with heterogeneous frame mix (PING + HANDSHAKE_DONE + MAX_DATA + PATH_CHALLENGE) and mid-sequence error surfacing - Every concrete STREAM type byte (0x08-0x0f) routed through parse() - ACK_ECN dispatch with truncation at each ECN field, ACK ranges accumulation, per-range truncation, large delay/largest_acked - CRYPTO non-zero offset and 200-byte payload round-trips - NEW_TOKEN empty-token and 150-byte token round-trips - NEW_CONNECTION_ID minimal 1-byte CID, 16384-sequence variant, cid_len=20 with insufficient bytes - RETIRE_CONNECTION_ID 4-byte varint sequence - PATH_CHALLENGE all-zero / PATH_RESPONSE all-0xFF round-trips - CONNECTION_CLOSE transport-with-frame-type, application long-reason, multi-byte (4-byte varint) error_code - HANDSHAKE_DONE dispatch with trailing buffer bytes - frame_builder::build_padding(0) zero-count guard - frame_type_to_string for 18 previously-unasserted branches - is_stream_frame / get_stream_flags / make_stream_type per-bit consistency at boundaries 0x07 / 0x08 / 0x0f / 0x10 Source file unchanged; tests are hermetic (no I/O). Registered network_quic_frame_extra_coverage_test in tests/CMakeLists.txt. Updated CHANGELOG.md and docs/CHANGELOG.md under Unreleased > Added. Closes #1033
Contributor
Coverage Report
Coverage DetailsFull HTML report is available as a build artifact. |
This was referenced Apr 26, 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 #1033
What
Adds
tests/unit/quic_frame_extra_coverage_test.cppwith 63 additional unit tests forsrc/protocols/quic/frame.cpp, complementing the existingquic_frame_coverage_test.cpp(Issue #1011) andquic_frame_types_test.cpp(Issue #974).Why
src/protocols/quic/frame.cppis one of the lowest-coverage source files insrc/protocols/per the #953 audit. The uncovered region concentrates in error and boundary paths -- exactly the surfaces that regress during the ongoingResult<T>migration. The existing coverage tests handle the common paths, but several branches and edge cases remained untouched: longer varint type prefixes, the non-zerorangesACK accumulation loop, the non-zero CRYPTO offset path,CONNECTION_CLOSEwith non-empty reason / non-zeroframe_type/ multi-byteerror_code, the per-bit consistency of stream-flag helpers, and mostframe_type_to_stringbranches.Where
tests/unit/quic_frame_extra_coverage_test.cpp(63 tests, gtest)tests/CMakeLists.txt: registerednetwork_quic_frame_extra_coverage_testnext to the otherextra_coveragetestsCHANGELOG.mdanddocs/CHANGELOG.md: one-line entry each under[Unreleased] > Addedsrc/protocols/quic/frame.cpp): NOT MODIFIEDHow
New test scope
peek_type: 4-byte and 8-byte varint type prefixesparse_all: heterogeneous frame mix (PING + HANDSHAKE_DONE + MAX_DATA + PATH_CHALLENGE) and mid-sequence parse-error surfacingparse_padding: empty buffer rejected atparse()entryparse_ack: ACK_ECN dispatch viaparse(), large delay / largest_acknowledged at varint boundaries, multi-range accumulation through the parse_ack loop, truncation at range gap, range length, ECT(1), and ECN-CEparse_stream: every concrete type byte 0x08..0x0f routed throughparse()covering the FIN/LEN/OFF flag matrix, large stream_id varint, zero-length data with LEN flagparse_crypto: non-zero offset and 200-byte payload round-tripsparse_new_token: empty-token and 150-byte token round-tripsparse_new_connection_id: 1-byte CID minimum, 16384-sequence variant, cid_len=20 with insufficient remaining bytesparse_retire_connection_id: 4-byte varint sequence round-tripparse_path_challenge/parse_path_response: all-zero and all-0xFF payload round-tripsparse_connection_close: transport-with-frame-type, application long-reason (120 chars forcing 2-byte length varint), multi-byte error_codeparse_handshake_done: dispatch consumes exactly 1 byte, trailing buffer untouchedframe_builder::build_padding(0): zero-count guard returns empty vectorframe_type_to_string: 18 previously-unasserted branchesis_stream_frame/get_stream_flags/make_stream_type: per-bit consistency at boundaries 0x07, 0x08, 0x0f, 0x10Test plan
cmake/ninja/make) is unavailable in the working environment, so local build verification was skipped per project convention -- relying on the multi-platform CI matrix (Ubuntu GCC/Clang, macOS, Windows MSVC, ASAN/TSAN/UBSAN).Breaking changes
None. Test additions only.
Notes
quic_frame_coverage_test.cppdocuments an asymmetry betweenbuild_ack(writesranges.size()as ACK Range Count) andparse_ack(treats it as "additional gap/length pairs after First ACK Range"), causing any non-empty-ranges round-trip to fail. This PR continues to avoid round-trips with non-emptyrangesin builder-produced inputs and instead validates the parse_ack range-loop branch by hand-crafted byte sequences. Fixing the divergence is out of scope for the test-expansion track.developHEAD: deferred to CI (no local lcov toolchain).