Skip to content

Commit ab8e997

Browse files
authored
test(quic): expand coverage for packet (#1040)
Add tests/unit/quic_packet_coverage_test.cpp (57 deterministic GTest cases) targeting every error path, type-specific branch, and boundary condition in src/protocols/quic/packet.cpp: - packet_type_to_string: all named cases plus default branch - long_header::type / is_retry across all four type bit values - short_header spin / key-phase bit combinations - packet_number::encoded_length at every width boundary - packet_number::decode RFC Appendix A example plus both wrap-around branches and the no-adjust path - packet_number::encode big-endian byte ordering and roundtrip across all four widths - packet_parser::is_version_negotiation: too-short, short-header, version-zero long-header, and version-one branches - packet_parser::parse_header dispatch including error propagation - packet_parser::parse_long_header: every length / form / dcid / scid / varint failure plus full success for Initial / Handshake / 0-RTT / Retry - packet_parser::parse_short_header: insufficient data, wrong form, invalid fixed bit, zero-length DCID skip, and roundtrip - packet_builder::build dispatch over both header structures with shape verification (version big-endian, varint token length, retry token + integrity tag layout) Wire the new translation unit into tests/CMakeLists.txt as network_quic_packet_coverage_test. Closes #1028
1 parent 4e148d2 commit ab8e997

2 files changed

Lines changed: 785 additions & 0 deletions

File tree

tests/CMakeLists.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3576,6 +3576,39 @@ network_gtest_discover_tests(network_quic_packet_unit_test
35763576
)
35773577
message(STATUS "QUIC packet unit tests enabled")
35783578

3579+
##################################################
3580+
# QUIC Packet Coverage Unit Tests (Issue #1028)
3581+
##################################################
3582+
3583+
add_executable(network_quic_packet_coverage_test
3584+
unit/quic_packet_coverage_test.cpp
3585+
)
3586+
3587+
target_link_libraries(network_quic_packet_coverage_test PRIVATE
3588+
network_system
3589+
GTest::gtest
3590+
GTest::gtest_main
3591+
Threads::Threads
3592+
)
3593+
3594+
setup_asio_integration(network_quic_packet_coverage_test)
3595+
3596+
if(COMMON_SYSTEM_INCLUDE_DIR)
3597+
target_include_directories(network_quic_packet_coverage_test PRIVATE ${COMMON_SYSTEM_INCLUDE_DIR})
3598+
target_compile_definitions(network_quic_packet_coverage_test PRIVATE WITH_COMMON_SYSTEM)
3599+
endif()
3600+
3601+
set_target_properties(network_quic_packet_coverage_test PROPERTIES
3602+
CXX_STANDARD 20
3603+
CXX_STANDARD_REQUIRED ON
3604+
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
3605+
)
3606+
3607+
network_gtest_discover_tests(network_quic_packet_coverage_test
3608+
DISCOVERY_TIMEOUT 60
3609+
)
3610+
message(STATUS "QUIC packet coverage unit tests enabled (Issue #1028)")
3611+
35793612
##################################################
35803613
# QUIC RTT Estimator Unit Tests (Issue #954)
35813614
##################################################

0 commit comments

Comments
 (0)