- 공용 chuteRun(Wall_Hatch) — 길이 비움 = 원지반 닿으면 끝 · 넣음 = 사면 따라 그 길이 · 사면보다 길면 원지반 따라 이어 그 길이 · 끝단이 이미 원지반이면 안 그림
- 물넘이 — 띠 시작 = 늘인 노면 끝(294-3) · 아니면 유출 쪽 노견 끝 · 원지반 닿으면 끝(양측 절토 = 띠 없음)
- 배관 · 박스 · 세월교 — 띠 계산이 원지반(layout.ground)을 받아 같은 규칙 · 3D 띠도 같음 · 코리도 해시에 길이
- 명세 CHUTE_ITEMS 맨 아래 「길이 (m)」(chute_add_{n}_length_m · 그림 전용) · 물넘이는 공용 칸 그대로
- 면적 자동 = 물넘이 · 세월교만 월류 폭 × 길이(배관 · 박스 = 폭 정의 없어 손 입력 그대로 · 브레인 정함)
- 길이는 집계 열 · B08 수량(면적만)에 안 실림 · 마스터 정의 이름 표는 안 건드림(이름 표 대조 시험에서 이 칸만 밖)
- 시험 test_294_3 · 286_1 · 52 · 65 · 152_3 기대값
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TteK8mfYZetk5P3bEZkyVZ
65 lines
2.6 KiB
Python
65 lines
2.6 KiB
Python
"""152-3 도수로 · 돌붙임 띠 — 묻힌 유출 끝 3도 절토선(내림 · 수평)에도 띠 · 오르막 복합경사 절토엔 없음.
|
|
|
|
화면 TS 를 그 자리에서 돌린 값(`helper_152_3_chute_cut.cjs`) · B06 관 · 흙막이 띠와 3D 띠가 같은 거름.
|
|
"""
|
|
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
HELPER = Path(__file__).parent / "helper_152_3_chute_cut.cjs"
|
|
NODE_MODULES = ROOT / "config" / "node_modules"
|
|
|
|
pytestmark = pytest.mark.skipif(not NODE_MODULES.is_dir(), reason="프론트엔드 의존성 미설치")
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out() -> dict:
|
|
done = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", str(HELPER)], cwd=str(ROOT), capture_output=True, text=True, encoding="utf-8"
|
|
)
|
|
assert done.returncode == 0, done.stderr
|
|
return json.loads(done.stdout)
|
|
|
|
|
|
def _src(relative: str) -> str:
|
|
return (ROOT / relative).read_text(encoding="utf-8")
|
|
|
|
|
|
def test_묻힌_흙막이_유출_3도_선에_띠(out: dict) -> None:
|
|
(cut,) = out["box"]["segments"]
|
|
assert cut["kind"] == "cut" and not cut["rises"]
|
|
assert cut["band"] and cut["topIsLine"] # 윗면 = 3도 선
|
|
assert cut["below"] == pytest.approx(0.3, abs=0.01) # 선 아래 두께
|
|
assert out["box"]["bands3d"] == 1 and out["box"]["bands3dFillOnly"] == 0
|
|
|
|
|
|
def test_배관_묻힌_끝_내림이면_띠_오르막이면_없음(out: dict) -> None:
|
|
down = out["pipeDown"]["segments"]
|
|
assert [s["kind"] for s in down] == ["fill", "cut"]
|
|
assert all(s["band"] for s in down)
|
|
up = out["pipeUp"]["segments"]
|
|
assert up[-1]["kind"] == "cut" and up[-1]["rises"] and not up[-1]["band"]
|
|
assert out["pipeDown"]["bands3d"] == 2 and out["pipeUp"]["bands3d"] == 1
|
|
|
|
|
|
def test_성토만인_측점은_그대로(out: dict) -> None:
|
|
base = out["pipeBase"]
|
|
assert base["bands3d"] == base["bands3dFillOnly"] == 2
|
|
|
|
|
|
def test_거름_한_벌_배선() -> None:
|
|
culvert = _src("B06_Section/B06_Section_UI_Cross_Culvert.ts")
|
|
assert "layout.outletFill.segments.filter(isChuteSegment)," in culvert
|
|
corridor = _src("B05_Profile/B05_Profile_UI_Corridor_Structures.ts")
|
|
flat = " ".join(corridor.split())
|
|
assert "chuteBands( layout.outletFill.segments, section.culvert?.chute, isChuteSegment," in flat
|
|
hatch = _src("B06_Section/B06_Section_UI_Cross_Wall_Hatch.ts")
|
|
assert '"3도 절토선"' in hatch
|
|
# 박스 · 세월교 본체 끝은 성토만(3도 규칙 안 넓힘)
|
|
for name in ("B06_Section_UI_Cross_Box.ts", "B06_Section_UI_Cross_Ford.ts"):
|
|
assert 'side.fillSegments.filter((s) => s.kind !== "cut")' in _src(f"B06_Section/{name}")
|