You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8948920
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Generate the leap, saddle-points and kindergarten-garden suites (#903)
* Add a test generator that renders suites from the canonical data
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>
* Generate the leap, saddle-points and kindergarten-garden suites
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>
---------
Co-authored-by: Jegors Cemisovs <jcemisovs@evolution.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
0 commit comments