test(reader): cover DictEncodingDecoder decode paths#61
Merged
Conversation
The encoding-level vortex.dict decoder had almost no unit coverage (3 of 223 lines) — it only ran transitively when a parent decoder called decodeChild on a dict segment. Add a focused test exercising: - proto + legacy primitive layouts, every code type (U8/U16/U32) × value width (I8/I16/I32/I64), both the fast and broadcast (single-value) expand paths - F32/F64 round-trips (typedArray float branches) - UTF8 dict, both legacy (3-buffer) and proto (varbin child) layouts - error paths: missing metadata (primitive + both utf8 variants), malformed proto metadata, unexpected/unsupported ptypes Covers 195/223 lines; the rest are unreachable defensive branches (expand default elem-size > 8, dead readCode arms — no PType has those widths). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Follow-up to the initial coverage pass: - Drop the dead readCode helper and collapse decodeLegacyJava's default branch to a direct throw — it only ever ran for non-U8/U16/U32 codes, where readCode threw anyway. Removes ~13 lines of unreachable code. - Make expandU8/U16/U32 package-private and unit-test their generic copy fallback (element width != 1/2/4/8) plus the codes-broadcast branch directly. - Cover the empty-but-non-null metadata guard on all three decode entry points. DictEncodingDecoder now at 100% lines and 100% branches. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
The encoding-level vortex.dict decoder had almost no unit coverage (3 of 223
lines) — it only ran transitively when a parent decoder called decodeChild on a
dict segment. Add a focused test exercising:
(I8/I16/I32/I64), both the fast and broadcast (single-value) expand paths
proto metadata, unexpected/unsupported ptypes
Covers 195/223 lines; the rest are unreachable defensive branches (expand
default elem-size > 8, dead readCode arms — no PType has those widths).
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com