Skip to content

Generate the leap, saddle-points and kindergarten-garden suites - #903

Merged
rabestro merged 4 commits into
mainfrom
generator-templates
Oct 30, 2026
Merged

rabestro merged 4 commits into
mainfrom
generator-templates

Conversation

@rabestro

@rabestro rabestro commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Builds on #902 — please merge that first; this targets its branch, so the diff here is only the three templates and the suites they render.

Converts the exercises whose suites were synced by hand in #894, #896 and #900. darts was converted in #902, so these complete the set.

Rebased onto the reworked #902, which now ports @IsaacG's generator rather than reimplementing it.

This was the real test of the generator

Writing a template for a suite that already exists is the honest check on whether the abstraction can express what the track actually writes. It could, with two shared macros:

macro what it does
assert_be subject should be(expected) — one line while it fits, wrapped otherwise
test_open the same for a test("...") line with a long description

The first attempt also surfaced a real bug in the wrapped branch: Jinja's lstrip_blocks ate the four-space indent, so Matrix(...) came out at column 0. Both macros now build a single string rather than relying on whitespace control.

How closely the templates reproduce the committed suites

exercise result
darts (in #902) byte for byte identical
leap header only
saddle-points header, plus two lines the hand-written file wrapped although they fit
kindergarten-garden header, plus two grouped test names

The grouped names changed because #902 dropped the reversed group order, per review. They now read outermost group first:

- "multiple students for the same garden with three students, partial garden - second student's garden"
+ "partial garden - multiple students for the same garden with three students - second student's garden"

Every generated line is well inside the 160 columns .scalafmt.conf allows; the longest across all four files is 108.

What the templates carry

The per-exercise mapping, which is the part no generator can infer:

  • saddle-points translates the canonical one-based {"row": 2, "column": 1} objects into this track's zero-based (row, column) tuples;
  • kindergarten-garden maps the canonical plant names onto the Plant enumeration;
  • leap needed nothing beyond the shared macros — 11 lines.

Verification

  • bin/test leap darts saddle-points kindergarten-garden — 48 tests, 0 failures.
  • bin/generate-tests --check — 4 suites up to date, exit 0.
  • bin/configlet lint — exit 0.

Still to convert

sum-of-multiples once #901 merges.

Note for merging

This rewrites three test files, so it would re-run those exercises' solutions. The changes are the header comment, two re-joined lines and two test names; no assertion changes. [no important files changed] is appropriate.

🤖 Generated with Claude Code

@rabestro rabestro self-assigned this Sep 26, 2026
Ports the generator @IsaacG wrote for the awk, jq and tcl tracks
(exercism/jq bin/test-generator), which he pointed at in #896, rather than
writing another one. His case handling is kept as-is: `reimplements`
chains, `include = false`, the problem-specifications lookup and the
`git pull`.

Two things are added on top.

A `--check` mode, and CI gating on it, which his tracks do not have. That
is the point of the exercise: `configlet sync --tests` compares tests.toml
against problem-specifications and never compares the suite against
either, so an exercise whose tests.toml is complete reads as in sync
however thin its suite is. That is how the five exercises in #894, #896,
#898, #900 and #901 drifted, and it covers 17 exercises and 67 cases.
A generated suite cannot drift again.

And a refusal to generate when tests.toml is missing canonical cases. The
`reimplements` links live in tests.toml, so a stale one silently emits
superseded cases: anagram would have emitted 3, phone-number 4,
grade-school 1. Thirteen exercises are in that state today. Erroring out
and pointing at `configlet sync --tests` is better than generating from a
partial picture.

darts is converted as the first exercise; nothing changes for the rest.
Its 13 test bodies are byte for byte what was already committed, and only
the header differs, now saying the file is generated.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Jegors Cemisovs and others added 2 commits September 26, 2026 17:19
Converts the three exercises whose suites were synced by hand in #894,
#896 and #900, now that the generator exists. darts was converted with it,
so these complete the set.

Writing a template for a suite that already exists is the honest check on
whether the abstraction can express what the track writes. It could, with
two shared macros: `assert_be` for `subject should be(expected)`, on one
line while it fits and wrapped otherwise, and `test_open` for a `test(...)`
line with a long description.

The templates reproduce the committed suites apart from the header, which
now says the file is generated, and three details:

  - saddle-points had two lines wrapped although they fit within the width;
    the generator leaves them on one line
  - kindergarten-garden's grouped test names now read outermost group
    first, "partial garden - multiple students ... - second student's
    garden", rather than the reversed order the hand-written file used

Every generated line is well inside the 160 columns .scalafmt.conf allows;
the longest is 108.

Each template carries the mapping no generator can infer: saddle-points
translates the canonical one-based {row, column} objects into this track's
zero-based tuples, and kindergarten-garden maps the plant names onto the
Plant enumeration. leap needed nothing beyond the shared macros.

Verified with `bin/test leap darts saddle-points kindergarten-garden`
(48 tests) and `bin/generate-tests --check`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Base automatically changed from test-generator to main September 28, 2026 18:36
@ErikSchierboom

Copy link
Copy Markdown
Member

There is a merge conflict

@rabestro
rabestro merged commit 8948920 into main Oct 30, 2026
8 checks passed
@rabestro
rabestro deleted the generator-templates branch October 30, 2026 21:04
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.

2 participants