← board

Dynamic-array torture test — make dynarray trustable

Goal

One (or a few) deliberately nasty Pascal program(s) that exercise dynamic arrays in the weirdest combinations we can think of, with a deterministic oracle (expected stdout / exit code). It does not have to pass. The point is to find where dynarray support is wrong or missing. Every failure → a new specific bug/feature ticket. Run it against $(PXX_STABLE) and across targets.

What "weirdest stuff" should cover

Method

Acceptance

Log

Done (2026-06-30, Track A)

test/test_dynarray_torture.pas — 24 self-checking cases (each prints ok n / FAIL n, oracle = total ok 24 / 24), in make test. Covers grow/shrink (zero- fill on grow, truncate on shrink), High/Low/empty/nil, deep-copy on assignment (PXX deep-copies — pinned: b:=a; b[0]:=99 leaves a[0] unchanged; same for a record's dynarray field on by-value copy), dynarray-of-string, jagged dynarray-of-dynarray, dynarray-of-record-with-managed-fields, passing (value/var/const/returned, incl. bare function-name result), class-field dynarray, 50-cycle grow/shrink stress, for-in, Copy(arr,i,n) sub-array, element-as-var-actual.

Found + fixed

Found + filed (still open)

Confirmed working (no action)

Copy(arr,i,n); record-by-value copy deep-copies its dynarray field; const/var open-array params; returned dynarray; element as var actual; nil/empty for-in + Length(nil)=0; out-param resize requires a named dynarray type (anonymous out array of T is a fixed view by design — clear error, not a bug).