Summary
Add targeted unit tests for the HUF 4-stream burst gate boundaries in literals_section_decoder.rs::decode_literals (lines 148–292).
Motivation
The existing decode_corpus / encode_corpus / level_1_fast c_stream integration tests cover the burst gate states organically, so a regression would surface before merge. However, explicit unit tests would significantly speed up triage on any future gate tweak.
This work was identified as out of scope for #201 (requires ~200 LOC of synthetic HUF bitstream scaffolding) and is tracked here as a follow-up.
Edge cases to cover
bits_consumed == max_num_bits — exact lower boundary of the burst gate; the burst is entered for the first time (gate condition is met with zero slack).
bits_consumed + burst_bits == 64 — exact upper boundary; the burst consumes all remaining bits in the 64-bit window without overflow.
- SIMD-fallback → refill → burst re-entry transition — the outer loop falls back to the SIMD 4-symbol path, a
BitReaderReversed refill occurs, and the next iteration correctly re-enters the burst path once the gate holds again.
Acceptance criteria
References
Summary
Add targeted unit tests for the HUF 4-stream burst gate boundaries in
literals_section_decoder.rs::decode_literals(lines 148–292).Motivation
The existing
decode_corpus/encode_corpus/level_1_fastc_streamintegration tests cover the burst gate states organically, so a regression would surface before merge. However, explicit unit tests would significantly speed up triage on any future gate tweak.This work was identified as out of scope for #201 (requires ~200 LOC of synthetic HUF bitstream scaffolding) and is tracked here as a follow-up.
Edge cases to cover
bits_consumed == max_num_bits— exact lower boundary of the burst gate; the burst is entered for the first time (gate condition is met with zero slack).bits_consumed + burst_bits == 64— exact upper boundary; the burst consumes all remaining bits in the 64-bit window without overflow.BitReaderReversedrefill occurs, and the next iteration correctly re-enters the burst path once the gate holds again.Acceptance criteria
bits_consumed/bit_containerstate after each transition.#[cfg(test)]and run cleanly undercargo nextest.clippyclean.References
ctz)