Niente strade a senso unico: il tennis della chiesa va e torna da Carza e ponticino; un test lo controlla
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017egeN2amL84ErjfgQFtEDn
This commit is contained in:
@@ -220,3 +220,14 @@ test('ogni oggetto ha la sua icona a pixel', () => {
|
||||
assert.match(svg, /viewBox="0 0 16 16"/, `${id}: l'icona deve essere 16x16`);
|
||||
}
|
||||
});
|
||||
|
||||
test('le strade vanno e tornano: niente sensi unici, e ogni posto si raggiunge dalla partenza', () => {
|
||||
const exits = {};
|
||||
for (const [id, sc] of Object.entries(story.scenes))
|
||||
for (const h of sc.hotspots ?? []) if (h.exit) (exits[id] ??= new Set()).add(h.exit.scene);
|
||||
for (const [a, to] of Object.entries(exits))
|
||||
for (const b of to) assert.ok(exits[b]?.has(a), `da ${a} si va a ${b}, ma da ${b} non si torna a ${a}`);
|
||||
const seen = new Set([story.start.scene]), queue = [story.start.scene];
|
||||
while (queue.length) for (const b of exits[queue.shift()] ?? []) if (!seen.has(b)) { seen.add(b); queue.push(b); }
|
||||
for (const id of Object.keys(story.scenes)) assert.ok(seen.has(id), `${id} non si raggiunge`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user