Repository navigation
Generate the leap, saddle-points and kindergarten-garden suites - #903
Merged
Merged
Conversation
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>
rabestro
force-pushed
the
test-generator
branch
from
September 26, 2026 14:18
0544dff to
04ab645
Compare
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>
rabestro
force-pushed
the
generator-templates
branch
from
September 26, 2026 14:19
ccfe78c to
18c15c8
Compare
ErikSchierboom
approved these changes
Oct 30, 2026
Member
|
There is a merge conflict |
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.
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.
dartswas 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:
assert_besubject should be(expected)— one line while it fits, wrapped otherwisetest_opentest("...")line with a long descriptionThe first attempt also surfaced a real bug in the wrapped branch: Jinja's
lstrip_blocksate the four-space indent, soMatrix(...)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
darts(in #902)leapsaddle-pointskindergarten-gardenThe grouped names changed because #902 dropped the reversed group order, per review. They now read outermost group first:
Every generated line is well inside the 160 columns
.scalafmt.confallows; 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-pointstranslates the canonical one-based{"row": 2, "column": 1}objects into this track's zero-based(row, column)tuples;kindergarten-gardenmaps the canonical plant names onto thePlantenumeration;leapneeded 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-multiplesonce #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