걷은 것 - B06_Section/B06_Section_Server_Calc_Node.ts 통째(135 줄 · 입구 · haul_plan_for 갈래 · 면적 · 유토곡선 · 다단 벽) - package.json:8 build 안 「&& npm run build:server-calc」 · package.json:10 「build:server-calc」 줄 - B06_Section/B06_Section_Server_Calc_Prebuild.py:61 ROOT · :62-63 옛 묶음 주석 · BUNDLE · :66 _NPM_SCRIPT - 지어진 묶음 config/server_calc_node/B06_Section_Server_Calc_Node.js = git 밖(.gitignore:63-64 그대로) · 폴더마다 찌꺼기 남음 시험 옮김(새 입구 = Prebuild._run_node · 등록부 Node design_calc_node) - 110 · 120 · 131 · 73_4 · 178_1 · helper_472_1_paths = _run_node - b06_ground_unlock · height_unlock = design_calc_node.js 판 검사(build:design-calc) - 472_3 registry · runner = 옛 묶음 대조 → Node 입구 정본 값 · 늘 떠 있는 Node = 새 프로세스 - 511_c = 옛 대 새 대조 → 새 Node = 브라우저 TS(computeHaulPlan · structureAreaRows · extraWallRows) - haul_plan_quantity_unpruned = 새 입구 · /haul-plan 그림 갈래 글 검사 · server_calc_node.mjs = design_calc_node structure.layouts - 글만: Schema · HaulPlan · design_calc_node 주석 · B06 CLAUDE.md · 시험 셋 머리 검증: 고친 시험 15 파일 87 통과 · typecheck 0 — 요구 320-4 · 322 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
2.2 KiB
JavaScript
60 lines
2.2 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, "../..");
|
|
// 옛 server-calc 묶음 걷음(511-B B-6) — 서버 정본 = 등록부 Node 입구 `structure.layouts`
|
|
const BUNDLE = join(ROOT, "config/design_calc_node/design_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({
|
|
run: ["structure.layouts"],
|
|
inputs: { detail: { cross_sections: [plainSection(0), plainSection(20)] } },
|
|
}),
|
|
);
|
|
execFileSync("node", [BUNDLE, input, output], { cwd: ROOT });
|
|
const { areas: rows } = JSON.parse(readFileSync(output, "utf8")).results["structure.layouts"];
|
|
|
|
assert.ok(Array.isArray(rows), "결과는 배열이어야 한다");
|
|
assert.equal(rows.length, 0, `구조물 없는 측점은 결과에 없어야 한다 (받은 수: ${rows.length})`);
|
|
console.log("OK — 구조물 없는 측점은 면적을 덮지 않는다");
|