서버 Node 가 벽 몸 ∩ 성토 폐회로 넓이를 재 design.extra_walls[].fill_overlap_m2 로 남기고 B08 다단 줄 비고에 「벽 몸 N㎡ × 연장 ≈ ㎥ 두 번 셈」 · 258.12 1단 1.335㎡ × 10m ≈ 13.3㎥ · 금액 변화 0 · 미확정 단은 안 붙임 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016VBGFXB9AbJBwXP19z75Qq
74 lines
2.9 KiB
Python
74 lines
2.9 KiB
Python
"""벽 몸 중 **성토 폐회로 안에 든 넓이** — `wallBodyInFillM2` (2026-09-14 브레인 「사유로 드러낼 것」).
|
||
|
||
폐회로 면적은 구조물 면적을 안 뺌(2026-09-06 사용자 확정)이라 벽 몸이 성토에도 들어감.
|
||
그 겹침을 재서 B08 줄 사유로 올림 — 고치지 않음. 실제 코드를 컴파일해 Node 로 돌림.
|
||
"""
|
||
|
||
import json
|
||
import subprocess
|
||
from pathlib import Path
|
||
|
||
import pytest
|
||
|
||
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
||
TSC = PROJECT_ROOT / "config" / "node_modules" / "typescript" / "bin" / "tsc"
|
||
MODULE = PROJECT_ROOT / "common_util" / "common_util_cross_structure_areas.ts"
|
||
|
||
# 지반 0 · 트림 밖(offset 5~20)은 표고 1.0 수평 성토선 · 벽 몸 offset 10~11 · 표고 −0.5~1.5
|
||
# ⇒ 성토 안(지반 0 ~ 선 1.0)에 든 몸 = 1 × 1 = 1.0㎡ · 지반 아래·선 위는 안 셈.
|
||
_RUNNER = """
|
||
const { wallBodyInFillM2 } = require(process.argv[3]);
|
||
const { writeFileSync } = require("node:fs");
|
||
const line = [];
|
||
for (let o = -20; o <= 20; o += 1) line.push({ offset: o, elevation: 0 });
|
||
const input = {
|
||
designLine: line.map((p) => ({ offset_m: p.offset, elevation_m: 0 })),
|
||
ground: line,
|
||
trim: { minOffset: -5, maxOffset: 5, maxSlope: { points: [{ offset: 5, elevation: 1 }, { offset: 20, elevation: 1 }] } },
|
||
};
|
||
const body = [
|
||
{ offset: 10, elevation: -0.5 },
|
||
{ offset: 10, elevation: 1.5 },
|
||
{ offset: 11, elevation: 1.5 },
|
||
{ offset: 11, elevation: -0.5 },
|
||
];
|
||
const outside = body.map((p) => ({ offset: p.offset - 30, elevation: p.elevation }));
|
||
writeFileSync(process.argv[2], JSON.stringify({ inFill: wallBodyInFillM2(body, input), outside: wallBodyInFillM2(outside, input) }));
|
||
"""
|
||
|
||
|
||
@pytest.mark.skipif(not TSC.is_file(), reason="프론트엔드 의존성 미설치")
|
||
def test_벽_몸_중_성토_안_넓이만_잰다(tmp_path: Path) -> None:
|
||
out = tmp_path / "out"
|
||
subprocess.run( # noqa: S603 — 고정 실행 파일
|
||
[
|
||
"node",
|
||
str(TSC),
|
||
"--ignoreConfig",
|
||
"--target",
|
||
"es2022",
|
||
"--module",
|
||
"commonjs",
|
||
"--skipLibCheck",
|
||
"--outDir",
|
||
str(out),
|
||
str(MODULE),
|
||
],
|
||
cwd=str(PROJECT_ROOT),
|
||
check=False,
|
||
capture_output=True,
|
||
)
|
||
compiled = next(out.rglob("common_util_cross_structure_areas.js"), None)
|
||
assert compiled is not None, "tsc 실패"
|
||
(out / "runner.cjs").write_text(_RUNNER, encoding="utf-8")
|
||
result = tmp_path / "result.json"
|
||
subprocess.run( # noqa: S603 — 고정 실행 파일
|
||
["node", str(out / "runner.cjs"), str(result), str(compiled)],
|
||
cwd=str(PROJECT_ROOT),
|
||
check=True,
|
||
capture_output=True,
|
||
)
|
||
produced = json.loads(result.read_text(encoding="utf-8"))
|
||
assert produced["inFill"] == pytest.approx(1.0, abs=1e-3)
|
||
assert produced["outside"] == pytest.approx(0.0, abs=1e-9) # 설계선이 지반 그대로인 자리
|