Skip to content

test(reader): shared TestArrays builders; dedup array tests#56

Merged
dfa1 merged 7 commits into
mainfrom
worktree-test-dedup
Jun 19, 2026
Merged

test(reader): shared TestArrays builders; dedup array tests#56
dfa1 merged 7 commits into
mainfrom
worktree-test-dedup

Conversation

@dfa1

@dfa1 dfa1 commented Jun 19, 2026

Copy link
Copy Markdown
Owner

What

Introduce TestArrays — a single home for the in-memory Materialized*Array
builders that were copy-pasted across ~17 reader test files — and migrate the
straightforward duplicators onto it.

  • TestArrays: longs/ints/doubles/floats/shorts/bytes/bools/float16 builders.
    Dtypes come from the shared DTypes constants; segments allocate from
    Arena.ofAuto() internally, so callers need no confined-Arena
    try-with-resources ceremony.
  • Migrated: ArrayLimitedTest, Long/Int/DoubleArrayTest, LazySparseArrayTest,
    ChunkedRecordSmokeTest, LazyDateTimePartsLongArrayTest,
    decode/LazyRunEndArrayTest.
  • ArrayLimitedTest also gains Chunked*.limited() coverage (the
    limitedChildren + 7 typed overrides that were at 0%).

Why

Tests should be as simple as possible. The per-file builders duplicated the same
segment-allocation boilerplate; threading a confined Arena through
try-with-resources added noise with no benefit for short-lived test data.

Left as-is (intentionally)

Specialized builders with no clean TestArrays fit: DictRecordSmokeTest
(unsigned-code dtype overloads), VarBinChunkedModeTest (VarBin),
LazyAlpRdArrayTest (U16 codes — I16 would change getInt widening),
LazyDecimalBytePartsArrayTest (decimal).

Verification

Test-only change. Full reader suite green (540 tests).

🤖 Generated with Claude Code

dfa1 and others added 7 commits June 19, 2026 08:22
TestArrays centralises the Materialized*Array construction copy-pasted across
~17 reader tests; dtypes come from the shared DTypes constants. ArrayLimitedTest
now uses it and adds Chunked* limited() coverage (limitedChildren + all 7
typed overrides).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Builders allocate from Arena.ofAuto() internally (test data is short-lived),
so callers no longer thread a confined Arena through try-with-resources.
ArrayLimitedTest sheds ~20 try blocks.
allocate(0, n) is legal and tested (empty bytes/bools cases), so the
Math.max(1, ...) floors were dead code that made bytes()/bools() diverge
from the other builders. Remove for consistency.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dfa1 dfa1 merged commit 1047e9e into main Jun 19, 2026
3 of 6 checks passed
@dfa1 dfa1 deleted the worktree-test-dedup branch June 19, 2026 06:44
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