Skip to content

test(reader): cover DictEncodingDecoder decode paths#61

Merged
dfa1 merged 2 commits into
mainfrom
test/dict-decoder-coverage
Jun 19, 2026
Merged

test(reader): cover DictEncodingDecoder decode paths#61
dfa1 merged 2 commits into
mainfrom
test/dict-decoder-coverage

Conversation

@dfa1

@dfa1 dfa1 commented Jun 19, 2026

Copy link
Copy Markdown
Owner

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

dfa1 and others added 2 commits June 19, 2026 18:54
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>
@dfa1 dfa1 merged commit d2844ae into main Jun 19, 2026
6 checks passed
@dfa1 dfa1 deleted the test/dict-decoder-coverage branch June 19, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant