+32
-3
@@ -106,8 +106,11 @@ async function runScript(ctx, variant, opts = {}) {
|
||||
}
|
||||
|
||||
// Common world: a far north wall, a door used for the close-push, and far walls the GM edits.
|
||||
// `opts.geometry` (stories 29/30, #52) stores non-default thickness/placement/height on the push
|
||||
// door and on the segment under test; this round those fields are inert by contract.
|
||||
const geometry = opts.geometry ?? {}
|
||||
await add({ a: [0, 0], b: [4096, 0], flags: { note: 'north' } })
|
||||
const pushDoor = await add({ a: [300, 300], b: [300, 400], door: true })
|
||||
const pushDoor = await add({ a: [300, 300], b: [300, 400], door: true, ...geometry })
|
||||
const farWall = await add({ a: [2000, 1000], b: [2500, 1000] })
|
||||
const farDoor = await add({ a: [2600, 1000], b: [2600, 1200], door: true })
|
||||
|
||||
@@ -147,7 +150,7 @@ async function runScript(ctx, variant, opts = {}) {
|
||||
let b = await connect(bob.key)
|
||||
|
||||
// The GM adds the segment under test over T3 (stuck). This is the only world difference.
|
||||
const segId = await add({ ...SEG, ...variant })
|
||||
const segId = await add({ ...SEG, ...variant, ...geometry })
|
||||
await sleep(60)
|
||||
|
||||
// An unrelated token move and unrelated wall/door edits: they must not perturb the player view.
|
||||
@@ -166,6 +169,7 @@ async function runScript(ctx, variant, opts = {}) {
|
||||
const pushed = gm.ws.messages.filter(m => m.t === 'token' && m.id === t4).pop()
|
||||
assert.ok(Math.abs(pushed.pos[0] - 320) < 1e-3 && pushed.pos[1] === 350,
|
||||
`closing a door over a token pushes it aside as today: ${JSON.stringify(pushed.pos)}`)
|
||||
const gmWall = id => gm.ws.messages.filter(m => m.t === 'wall' && m.id === id).pop()
|
||||
|
||||
// The GM's door intent on the differing segment: refused `invalid` for a wall, a secret or a
|
||||
// locked door; an ordinary closed door opens. GM-side only, so no player frame changes with it.
|
||||
@@ -220,7 +224,8 @@ async function runScript(ctx, variant, opts = {}) {
|
||||
a.ws.close(); b.ws.close(); gm.ws.close()
|
||||
await Promise.all([a.ws.closed, b.ws.closed])
|
||||
assert.equal(art, 1, 'the v1 art version is pinned (DESIGN 3.3)')
|
||||
return { frames, cookies, scene, art }
|
||||
return { frames, cookies, scene, art, pushed: pushed.pos,
|
||||
stored: { pushDoor: gmWall(pushDoor), seg: gmWall(segId) } }
|
||||
}
|
||||
|
||||
// Every tile of the checked rectangle, as status + bytes. The fixture bytes are per-(x,y), so a
|
||||
@@ -263,6 +268,7 @@ async function runPair(aVariant, bVariant, opts = {}) {
|
||||
for (const [i, variant] of [aVariant, bVariant].entries()) {
|
||||
const run = await runScript(stacks[i], variant, {
|
||||
...opts,
|
||||
geometry: opts.geometry?.[i] ?? null,
|
||||
segmentOpen: opts.segmentOpen?.[i] ?? null,
|
||||
crosses: opts.crosses?.[i] ?? false,
|
||||
})
|
||||
@@ -301,6 +307,29 @@ for (const pair of PAIRS) {
|
||||
})
|
||||
}
|
||||
|
||||
test('inert geometry: stored thickness, placement and height change neither the door push nor a player byte (#52)',
|
||||
async () => {
|
||||
// Stories 29/30: thickness, placement and height are accepted, stored and echoed by the GM's
|
||||
// frames, but in this round every stored value behaves exactly like zero thickness / centre /
|
||||
// full height. The defaults run and the geometry run play the same script; the push position
|
||||
// and every player frame and tile must be identical.
|
||||
const GEOMETRY = { thickness: 256, position: 'left', height: 1 }
|
||||
const { a, b } = await runPair({}, {}, { geometry: [null, GEOMETRY] })
|
||||
for (const [label, wall] of [['closed door', b.stored.pushDoor],
|
||||
['wall segment', b.stored.seg]]) {
|
||||
assert.deepEqual(
|
||||
{ thickness: wall.thickness, position: wall.position, height: wall.height }, GEOMETRY,
|
||||
`${label}: the non-default geometry is stored and echoed by the GM frame`)
|
||||
}
|
||||
assert.ok(Math.abs(a.pushed[0] - 320) < 1e-3 && a.pushed[1] === 350,
|
||||
`the baseline close-push is the zero-thickness result: ${JSON.stringify(a.pushed)}`)
|
||||
assert.deepEqual(b.pushed, a.pushed,
|
||||
'stored thickness, placement and height change the door push by nothing')
|
||||
assert.ok(b.tiles.alice.some(s => s.includes(':200:')), 'the sweep allowed some tiles')
|
||||
assert.deepEqual(equivalenceClasses(a, b), [],
|
||||
'the geometry run and the defaults run must give identical player frames and tile statuses')
|
||||
})
|
||||
|
||||
test('door equivalence positive control: an open door produces a different transcript', async () => {
|
||||
const { a, b } = await runPair({}, { door: true, open: true },
|
||||
{ segmentOpen: ['invalid', 'ok'], crosses: [false, true] })
|
||||
|
||||
Reference in New Issue
Block a user