chore: keep the fixture generator scripts and the replay-sample bot
scripts/fixtures/ holds the scripts that produced the 2026-11-11 fixtures, with a README on running them safely into a copy. Run in order they reproduce the content of every fixture they touch. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e3cea5eac
commit
5062838604
17 files changed
+432
-3
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import fs from 'node:fs'
|
||||
// Fixture regeneration aid (see scripts/fixtures/README.md). Written during the 2026-11-11 build, kept for reference.
|
||||
// Writes into fixtures/ unless FIXTURES_OUT names another directory (with a trailing slash).
|
||||
const FIX = process.env.FIXTURES_OUT ?? new URL('../../fixtures/', import.meta.url).pathname
|
||||
const SOL = new URL('../../js/solutions/', import.meta.url).href
|
||||
const HERE = new URL('./', import.meta.url).pathname
|
||||
const { violations } = await import(SOL + 'check.js')
|
||||
const f = FIX + 'm12-violations.json'
|
||||
const fx = JSON.parse(fs.readFileSync(f, 'utf8'))
|
||||
const sane = fx.cases.find((c) => c.name === 'a-pending-perpendicular-turn-is-fine').args[0]
|
||||
console.log(JSON.stringify(sane))
|
||||
const mk = (name, patch) => { const s = { ...sane, ...patch }; return { name, args: [s], expected: violations(s) } }
|
||||
const cases = [
|
||||
mk('a-queued-turn-is-fine', { dir: 'Right', nextDir: 'Up', queued: 'Left' }),
|
||||
mk('queued-turn-straight-back-from-the-pending-turn', { dir: 'Right', nextDir: 'Up', queued: 'Down' }),
|
||||
mk('reversed-pending-turn-and-reversed-queue-are-both-listed', { dir: 'Right', nextDir: 'Left', queued: 'Right' }),
|
||||
]
|
||||
cases.forEach((c) => console.log(c.name, JSON.stringify(c.expected)))
|
||||
const names = new Set(cases.map((c) => c.name))
|
||||
fs.writeFileSync(f, JSON.stringify({ ...fx, cases: [...fx.cases.filter((c) => !names.has(c.name)), ...cases] }, null, 2) + '\n')
|
||||
Reference in new issue
Block a user