⚠ **뿌리** — `tmp/` 는 창 사이에 안 건너감(실측 확인: 상대 창이 놓은 `tmp/_sync_probe.txt` 가 시간을 두고 두 번 봐도 안 보임). 그래서 **정본(등록부 스키마)만 건너가고 그것을 읽는 시험은 안 건너가** 오늘 두 번, 같은 시험이 **연 창은 통과·받은 창은 실패**가 됐음. - `tmp/tests/*` 를 `resources/tester/` 로 **복사**(127 파일). 내용은 **한 줄도 안 고침** - `tmp/tests` 는 **남겨 둠** — 되돌릴 자리(사용자 지시) - 실행: `./venv/Scripts/python.exe -m pytest resources/tester/ -q` 옮기기 전과 **같은 수**: 617 통과 / 22 건너뜀 / 실패 0 ⇒ 이제 시험·예외·까닭이 **정본과 함께** 움직임. 오늘 세운 「예외는 정본 스키마에」와 짝임. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
53 lines
2.0 KiB
JavaScript
53 lines
2.0 KiB
JavaScript
/* Node 진입점(구조물 면적) 연결 확인 — 2026-09-06.
|
|
*
|
|
* 면적 산식 자체는 `test_b06_structure_areas.mjs` 가 본다. 여기서 지키는 것은 하나:
|
|
* **구조물이 없는 측점은 결과에 나오면 안 된다.** 나오면 서버가 표준 계산값을
|
|
* 폐회로 보정값으로 덮어써 수량이 조용히 달라진다.
|
|
*
|
|
* 실행: node tmp/tests/test_b06_structure_areas_node.mjs
|
|
*/
|
|
import { execFileSync } from "node:child_process";
|
|
import { mkdtempSync, readFileSync, writeFileSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { join, resolve } from "node:path";
|
|
import assert from "node:assert/strict";
|
|
|
|
const ROOT = resolve(import.meta.dirname, "../..");
|
|
const BUNDLE = join(ROOT, "config/server_calc_node/B06_Section_Server_Calc_Node.js");
|
|
|
|
/** 평지 위 표준 횡단 한 측점 — 구조물 없음. */
|
|
function plainSection(chainage) {
|
|
const samples = [];
|
|
for (let offset = -15; offset <= 15; offset += 1) {
|
|
samples.push({ offset_m: offset, elevation_m: 100, valid: true });
|
|
}
|
|
return {
|
|
chainage_m: chainage,
|
|
samples,
|
|
design: {
|
|
design_elevation_m: 100,
|
|
design_line: [
|
|
{ offset_m: -3, elevation_m: 100 },
|
|
{ offset_m: 3, elevation_m: 100 },
|
|
],
|
|
road_edges: { left: { offset_m: -3, elevation_m: 100 }, right: { offset_m: 3, elevation_m: 100 } },
|
|
cut_area_m2: 1.23,
|
|
fill_area_m2: 4.56,
|
|
},
|
|
};
|
|
}
|
|
|
|
const work = mkdtempSync(join(tmpdir(), "areas-node-"));
|
|
const input = join(work, "input.json");
|
|
const output = join(work, "output.json");
|
|
writeFileSync(
|
|
input,
|
|
JSON.stringify({ detail: { cross_sections: [plainSection(0), plainSection(20)] } }),
|
|
);
|
|
execFileSync("node", [BUNDLE, input, output], { cwd: ROOT });
|
|
const { areas: rows } = JSON.parse(readFileSync(output, "utf8"));
|
|
|
|
assert.ok(Array.isArray(rows), "결과는 배열이어야 한다");
|
|
assert.equal(rows.length, 0, `구조물 없는 측점은 결과에 없어야 한다 (받은 수: ${rows.length})`);
|
|
console.log("OK — 구조물 없는 측점은 면적을 덮지 않는다");
|