Reorganize lagoon test suite by operation category#35
Merged
Conversation
Regroup the suite from arity-based (single-args / double-args-elementwise + array-utils) to operation-category files: arithmetic, compare-reduce, builders, rounding, linalg, unary, indexing. lagoon-fails and lagoon-unsigned are unchanged. Pure mechanical move: arm bodies are byte-identical and every new file gets the same canonical preamble (the is-equal/is-close helpers and ^| |_ [atol rtol] that all three sources already shared). Done with a script that asserts arm-count conservation and errors on any unrouted arm; one category (indexing) was built and run on a live ship to confirm the new structure compiles. Arm count conserved exactly (983 before and after, including the test-any-all-1d added by #34). File-reorg pass only; de-duplicating the cartesian-product arms is a follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
e8458a4 to
c17dbaf
Compare
The arithmetic suite was 330 hand-written arms: each of add/sub/mul/div/ mod spelled out for 9 shapes x 8 (bloq,kind) combos, almost all asserting op(ones,ones) == constant. Replace with two iterators (each-real over precisions x representative shapes, each-uint over uint bloqs x shapes) plus a small per-precision value table, and one arm per op built on `fill`. 330 arms / 3338 lines -> 13 arms / ~160 lines. Inputs are now built with `fill` instead of inline per-bloq float literals, and a `test-sub-asym` row (fives - threes = twos) is included so the asymmetric case is always covered -- exactly the gap that let the sub return-buffer bug hide behind symmetric ones-minus-ones data. Validated on a live ship: the harness builds and runs; add/mul/div/mod (real and uint) pass, and test-sub-asym correctly fails against the old sub jet (which computes y-x), confirming the table detects what the symmetric tests could not. Continuation of the test reorg; same pattern can fold the other categories next. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The compare-reduce suite was 379 hand-written arms. Replace with the same iterator approach as arithmetic plus a reduction iterator (each-vec, one distinct-valued vector per precision): - Comparisons (gth/gte/lth/lte, real + uint) become one arm per op per branch -- both the true- and false-producing cases across precisions and shapes. The old suite tested only the symmetric ones-vs-ones case, so it exercised just one branch per op; this now covers both. - Reductions (min/max/cumsum/argmin/argmax) read the reduced scalar via its ravel head, independent of min/max's output shape, and argmin/ argmax assert the forward (ravel) index. - any/all kept as before. 379 arms / 3731 lines -> ~19 arms / ~190 lines. Validated on a live ship: builds and runs; comparisons, min/max/cumsum, and argmin pass, and test-argmax correctly fails against the old reversed-index argmax jet -- demonstrating the harness detects the index bug the symmetric-only tests could not. Multi-assertion inside an iterator gate would not compile here, so each assertion is its own arm (still ~20x fewer than the hand-written suite). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The builders suite was 190 hand-written arms (eye/zeros/ones/range/ linspace across precisions and shapes). Replace with the shared iterator approach: zeros/ones cross-checked against `fill` over precisions x shapes, and eye/range/linspace checked against small explicitly-built canons over precisions. 190 arms / 1748 lines -> 9 arms / ~115 lines. Validated on a live ship: all pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The 32 rounding arms (cumsum of an 11-point linspace built under each rounding mode, compared to a mode-specific reference) shared identical boilerplate differing only in [precision, direction, mode, canon]. Collapse to one 32-row table plus a single iterator arm. 32 arms / 283 lines -> 1 arm + table / ~70 lines. Validated on a live ship: passes. The reference values are unchanged from the originals. 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.
Summary
The suite was split by arity (
single-args/double-args-elementwise) plusarray-utils— an arbitrary scheme that had aged badly:double-args-elementwisewas 5,617 lines / 618 arms mixing arithmetic with comparisons, and its name no longer described its contents (it had picked up thesub/mod/modsregression tests too).Regroup the 959 moved arms by what they actually test:
lagoon-arithmeticlagoon-compare-reducelagoon-builderslagoon-roundinglagoon-linalglagoon-unarylagoon-indexinglagoon-fails(5) andlagoon-unsigned(18) are unchanged — validation and uint-kind smoke coverage stay coherent as-is. Total arm count conserved exactly: 982 before and after.How
Pure mechanical move: arm bodies are byte-identical, every new file gets the same canonical preamble (the
is-equal/is-closehelpers +^| |_ [atol rtol], which all three sources already shared). Done with a script that asserts arm-count conservation and errors on any unrouted arm. One category (indexing) was inserted and run on a live ship (~nec) to confirm the new file structure compiles and passes.Scope
This is the file-reorg pass only. The larger win — de-duplicating the hand-written cartesian-product arms (op × bloq × shape × kind) into a table-driven harness — is a separate follow-up, now much easier to do per-category.
Note
Touches the same test files as #34 (which adds a 1-D any/all test to the old
array-utils). Whichever lands first, I'll rebase the other — the 1-D test belongs inlagoon-compare-reduceunder this layout.🤖 Generated with Claude Code