From e2bb1e5390700ee70f9c4015567ce3f36ffdc75a Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 10 Sep 2026 11:26:29 +0300 Subject: [PATCH] test: the clean-floor total is timed on a real floor, not just counted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The injected-counter test proves "one geometry pass per space" but not that its result reaches innerContourForRoom — without the shared arguments that function rebuilds the masonry per room, and the only observable difference is time (176 ms per room, S2). One large-house floor: ~0.6 s with the shared pass, ~3.7 s without, so a 2.5 s threshold is coarse enough not to flake. Issue: #509 User-Visible: no --- test/summary-panel.test.mjs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/summary-panel.test.mjs b/test/summary-panel.test.mjs index 7d732655..a9bbe931 100644 --- a/test/summary-panel.test.mjs +++ b/test/summary-panel.test.mjs @@ -1,5 +1,7 @@ import assert from 'node:assert/strict'; import test from 'node:test'; +import { makeLargeHouseFixture } from '../demo/fixtures/large-house.mjs'; +import { spaceModels } from '../test-build/space-geometry.js'; import { readFileSync } from 'node:fs'; import { @@ -386,3 +388,20 @@ test('#509 AC3: площадь считает геометрию стен оди assert.equal(withSpy, totalCleanFloorAreaM2(config, model), 'общая геометрия не меняет результат'); assert.equal(withSpy, 4.32); }); + +test('#509 AC3: один этаж большого дома считается без пересборки кладки на каждой комнате', () => { + // Синтетический счётчик выше доказывает «один вызов на пространство», но не + // то, что результат этого вызова ДОШЁЛ до innerContourForRoom: без + // shared-аргументов та объединяет кладку заново для каждой комнаты, и + // единственный наблюдаемый признак — время (S2: 176 мс на комнату). + // Разрыв семикратный, поэтому порог грубый и не флейкует. + const fixture = makeLargeHouseFixture(); + const config = { ...fixture.config, spaces: fixture.config.spaces.slice(0, 1) }; + const model = spaceModels(config); + assert.equal(model[0].rooms.length, 20, 'фикстура даёт этаж из 20 комнат'); + const started = Date.now(); + const area = totalCleanFloorAreaM2(config, model); + const elapsed = Date.now() - started; + assert.ok(area > 0, String(area)); + assert.ok(elapsed < 2500, `этаж из 20 комнат посчитан за ${elapsed} мс — кладка собирается заново на каждой комнате (#509)`); +});