test: walls r1 review — tests and tools

Ref #52
This commit is contained in:
2026-11-20 08:59:24 +01:00
parent e1a5b297e4
commit 38941da003
14 changed files with 329 additions and 69 deletions
+18 -3
View File
@@ -17,12 +17,17 @@ import { V7_DDL } from './schema7fixture.mjs'
const ALICE = 'ALIC-ALIC-ALIC-ALIC-ALIC'
// The four walls the schema-7 fixture holds, as the proto-2 raw-switch create spells them.
// The four walls the schema-7 fixture holds, as the proto-2 raw-switch create spells them. Two of
// them (the north wall and the closed door) carry non-default but inert geometry: thickness 256,
// placement left, height 1. The migrated fixture has the defaults (0/center/null), so the
// byte-identical comparison below is also the proof that a stored thickness, placement or height
// changes no sight, movement, status or tile (stories 29/30, #52).
const INERT_GEOMETRY = { thickness: 256, position: 'left', height: 1 }
const AUTHORED_WALLS = [
{ a: [0, 0], b: [4096, 0], flags: { note: 'north' } },
{ a: [0, 0], b: [4096, 0], flags: { note: 'north' }, ...INERT_GEOMETRY },
{ a: [10, 10], b: [100, 10] },
{ a: [100, 100], b: [400, 100], door: true, open: true, flags: { a: 1 } },
{ a: [500, 500], b: [900, 500], door: true },
{ a: [500, 500], b: [900, 500], door: true, ...INERT_GEOMETRY },
]
const canonical = value => {
@@ -93,6 +98,16 @@ async function runScript(ctx) {
const door = wallBySegment(gm, [500, 500], [900, 500])
assert.equal(door.kind, 'door')
if (ctx.author) {
// The authored stack really stored the non-default geometry (the migrated one keeps defaults),
// so the byte-identical player view below cannot pass by both runs having ignored the fields.
const north = wallBySegment(gm, [0, 0], [4096, 0])
for (const [label, wall] of [['closed door', door], ['north wall', north]]) {
assert.deepEqual(
{ thickness: wall.thickness, position: wall.position, height: wall.height },
INERT_GEOMETRY, `${label}: the non-default geometry is stored and echoed on the GM frame`)
}
}
// The player connects only after the wall set exists in both runs, so the compared sequence starts
// from the same resync.