diff --git a/accretive-audit.md b/accretive-audit.md index 63f4d52e..225ea1cc 100644 --- a/accretive-audit.md +++ b/accretive-audit.md @@ -47,15 +47,15 @@ Run it with `FACTOR=/path/to/factor bin/check-accretive [slug...]`. ## Results -The initial audit found 11 of 47 not Accretive. The 5 Mode-B and 5 Mode-A -exercises have since been fixed; only the 1 structural case remains open. +The initial audit found 11 of 47 not Accretive. All 11 have since been fixed — +**every concept exercise is now accretive (47/47)**. The table records what the +audit flagged and how each was resolved. -| Verdict | Count | Exercises | +| Original verdict | Count | Exercises | |---|---|---| -| Accretive | 46 | all others | | Mode A (fixed) | 5 | bering-bearings, boatswains-bilge, dragons-descendants, factory-failsafe, pirates-path | | Mode B (fixed) | 5 | garden-gathering, lighthouse-logbook, poetry-club, quayside-crew, tellers-triage | -| Structural (open) | 1 | telegraphers-tape | +| Structural (fixed) | 1 | telegraphers-tape | ## Mode A — a definition was introduced after task 1 (fixed) @@ -106,14 +106,16 @@ that owns the word, or (for opaque structures) observing through a library word. - **quayside-crew** — a task-3 test `[ 5 over hoist-crate tonnage>> ... ]` used `hoist-crate` (task 4) to show cranes are independent; moved to task 4. -## Structural +## Structural — tests not grouped by task (fixed) -- **telegraphers-tape** — the tests use descriptive `print` labels, not `TASK:` - markers, and each test is end-to-end (construct + read + dispose together), so - no prefix of tasks passes on its own. - *Fix (larger):* regroup the tests under per-task `TASK:` markers, ordered so - each task's tests need only words from that task and earlier; or accept it as a - documented exemption. +- **telegraphers-tape** — the tests used descriptive `print` labels, not `TASK:` + markers, and each was end-to-end (construct + read + dispose together), so no + prefix of tasks passed on its own. *Fixed* by regrouping the tests under + per-task `TASK:` markers (task order unchanged) and adding checkpoints for the + early tasks: task 1 reads through `wire>>` to prove the constructor stored the + wire; task 2 checks `input-stream?`. Each group now calls only words from its + own task and earlier. (Like the Mode-A fixes, the task-1 test touches the + tuple, so the exercise is accretive-via-task1.) ## Suggested track-wide rules (to keep new exercises Accretive) diff --git a/bin/check-accretive b/bin/check-accretive index 69563538..b6b27ae0 100755 --- a/bin/check-accretive +++ b/bin/check-accretive @@ -76,6 +76,7 @@ MAPS = { "rpn-calculator": {"add-op":1,"multiply-op":2,"apply-op":3,"evaluate":4,"evaluate-named":5,"divide-op":6}, "secrets": {"shift-back":1,"set-bits":2,"flip-bits":3,"clear-bits":4}, "signalers-satchel": {"quote-value":1,"flag-body":2,"split-flag":3,"triangulate":4,"triangle-stats":5}, + "telegraphers-tape": {"":1,"stream-read1":3,"stream-element-type":4,"dispose*":5}, "tellers-triage": {"new-queue":1,"join-queue":2,"next-name":3,"serve-all":4}, "valentines-day": {"rate-restaurant":1,"rate-movie":2,"rate-walk":3,"rate-activity":4,"approval-counts":5}, "vltava-weather-watch": {"read-readings":1,"latest-reading":2,"log-text":3,"record-reading":4,"rewrite-log":5}, @@ -84,14 +85,14 @@ MAPS = { # Exercises whose Mode-B prefix run we cannot synthesize automatically (MACRO: # bodies cannot be re-stubbed with a throw, and exercises without TASK: markers # have no prefixes). Mode A is still checked for them. -MODEB_SKIP = {"signal-stencils", "telegraphers-tape", "bering-bearings", - "boatswains-bilge"} +MODEB_SKIP = {"signal-stencils", "bering-bearings", "boatswains-bilge"} # The shipped stub does not make the test file compile, but the missing # definition is created in task 1, so the exercise is still accretive by the # implement-first-K-tasks rule (a student who does task 1 sees task 1 pass). ACCRETIVE_VIA_TASK1 = {"lasagna", "role-playing-game", "factory-failsafe", - "dragons-descendants", "bering-bearings"} + "dragons-descendants", "bering-bearings", + "telegraphers-tape"} DEF_STARTERS = {":","::","M:","M::","TYPED:","TYPED::","MEMO:","MEMO::"} diff --git a/exercises/concept/telegraphers-tape/telegraphers-tape/telegraphers-tape-tests.factor b/exercises/concept/telegraphers-tape/telegraphers-tape/telegraphers-tape-tests.factor index 334a45aa..dac15350 100644 --- a/exercises/concept/telegraphers-tape/telegraphers-tape/telegraphers-tape-tests.factor +++ b/exercises/concept/telegraphers-tape/telegraphers-tape/telegraphers-tape-tests.factor @@ -2,50 +2,40 @@ USING: accessors destructors exercism-tools io io.streams.string kernel telegraphers-tape tools.test ; IN: telegraphers-tape.tests -"Telegraphers Tape:" print - -"Reading a Morse symbol from a clean wire" print -{ CHAR: . } -[ "." stream-read1 ] -unit-test +TASK: 1 +! the constructor stores the wire — read straight from it +{ CHAR: a } [ "abc" wire>> stream-read1 ] unit-test STOP-HERE -"Skipping noise before a dash" print -{ CHAR: - } -[ "xy-" stream-read1 ] -unit-test - -"Returning f at end of wire" print -{ f } -[ "" stream-read1 ] -unit-test - -"Returning f when only noise remains" print -{ f } -[ "xyz" stream-read1 ] -unit-test - -"Reading dot, dash, space in sequence" print -{ CHAR: . CHAR: - CHAR: \s } -[ "x.y-ab cz" - [ stream-read1 ] [ stream-read1 ] [ stream-read1 ] tri ] -unit-test - -"stream-element-type delegates to the wire" print -{ +character+ } -[ "" stream-element-type ] -unit-test - -"dispose marks the tape as disposed" print -{ t } -[ [ "ab" - dup dispose disposed>> ] with-destructors ] -unit-test - -"with-input-stream disposes automatically" print -{ t } -[ "" - dup [ ] with-input-stream - disposed>> ] -unit-test +TASK: 2 input-stream instance +{ t } [ "x" input-stream? ] unit-test + +TASK: 3 stream-read1 +! reading a Morse symbol from a clean wire +{ CHAR: . } [ "." stream-read1 ] unit-test +! skipping noise before a dash +{ CHAR: - } [ "xy-" stream-read1 ] unit-test +! end of wire returns f +{ f } [ "" stream-read1 ] unit-test +! only noise remains returns f +{ f } [ "xyz" stream-read1 ] unit-test +! dot, dash, space in sequence +{ CHAR: . CHAR: - CHAR: \s } [ + "x.y-ab cz" + [ stream-read1 ] [ stream-read1 ] [ stream-read1 ] tri +] unit-test + +TASK: 4 stream-element-type +! the element type delegates to the wire +{ +character+ } [ "" stream-element-type ] unit-test + +TASK: 5 dispose +! dispose marks the tape as disposed +{ t } [ + [ "ab" dup dispose disposed>> ] with-destructors +] unit-test +! with-input-stream disposes automatically +{ t } [ + "" dup [ ] with-input-stream disposed>> +] unit-test