"""PLAN 186-1 — 흙막이류 횡단 형상(랩탑 메인 프로젝트 No.14+12) 사본 재현. 자료: 검증_랩탑메인(226fc805) No.14+12.22 = 관(파형강관 D800) · 유입 L형 집수정 · 유출 흙막이 (돌쌓기(찰) H1.3) · 유출 쪽 원지반이 노견보다 높아 벽이 묻힘(벽 윗면 849.99 · 원지반 852.24). 흠: 묻힌 유출 벽에 절토선이 둘 — 벽 바깥 윗모서리 절토(91-4 `withBackCut`)와 관 끝 3도 절토선 (139-4). 둘 다 설계선(트림 사면)에 이어 붙어 선이 원지반까지 올랐다가 벽 앞으로 되내려 접힘 (오프셋 13.45 → 14.59 → 13.69) → 카드 · B07 · 3D 모양이 꺾이고 서버 면적도 접힌 폐회로로 셈. 고침: 유출 끝 연결선(139-4)이 있으면 벽 모서리 절토를 잇지 않음(`_Culvert_Geom.ts`). """ from __future__ import annotations import json import os import subprocess import pytest HERE = os.path.dirname(__file__) ROOT = os.path.join(HERE, "..", "..") pytestmark = pytest.mark.skipif( not os.path.isdir(os.path.join(ROOT, "config", "node_modules")), reason="프론트엔드 의존성 미설치", ) @pytest.fixture(scope="module") def out() -> dict: proc = subprocess.run( # noqa: S603 — 고정 실행 파일 ["node", os.path.join(HERE, "helper_186_1_outlet_fold.cjs")], capture_output=True, text=True, encoding="utf-8", timeout=60, ) assert proc.returncode == 0, proc.stderr return json.loads(proc.stdout) def _one_way(offsets: list[float], outward: int) -> bool: """설계선이 바깥으로만 나아감 — 되돌아가면 접힌 것.""" return all((b - a) * outward >= -1e-9 for a, b in zip(offsets, offsets[1:])) def _no_peak(elevations: list[float]) -> bool: """원지반까지 올랐다 되내리는 뾰족 봉우리 없음.""" return not any(b > a and b > c for a, b, c in zip(elevations, elevations[1:], elevations[2:])) @pytest.mark.parametrize("case", ["stored", "auto"]) def test_묻힌_유출_벽_설계선이_안_접힘(out: dict, case: str) -> None: """저장값(d 9.0)도 자동 자리도 — 벽은 묻혀 있고 설계선은 한 방향.""" study = out[case] assert study["wallTop"] < study["groundAtWall"] # 사본이 묻힌 벽을 재현 assert _one_way(study["offsets"], study["outward"]), study["offsets"] assert _no_peak(study["elevations"]), study["elevations"] def test_저장값_사본_면적(out: dict) -> None: """접힌 폐회로(절토 27.94 · 성토 0.34 ㎡) → 노견~벽~3도 선 절토만.""" assert out["stored"]["cut"] == pytest.approx(34.0391, abs=1e-3) assert out["stored"]["fill"] == 0 # 225-1 — 유출 벽이 관 길이 맞춤으로 밀리지 않고 기본 자리(16.8211 → 16.0929) assert out["auto"]["cut"] == pytest.approx(16.0929, abs=1e-3) def test_절토_쪽_배관_유출도_안_접힘(out: dict) -> None: """91-4 자료(관 340 · 유출 = 절토 쪽) — 3도 선이 못 만나 복합경사 하나로 원지반까지.""" study = out["cut340"] assert _one_way(study["offsets"], study["outward"]), study["offsets"] assert _no_peak(study["elevations"]), study["elevations"]