Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F3mdb91125mPoC6tpsQx4P
59 lines
2.6 KiB
Python
59 lines
2.6 KiB
Python
"""관 벽 최소 높이 거울 — 파이썬(`B06_Section_Engine_Culvert`) ↔ TS(`_Cross_Culvert_Const.ts`).
|
|
|
|
⚠ 횡단도(TS)가 그리는 높이와 구조물 표·구조물도 그림(파이썬)이 같은 벽을 다르게 그리면 결함
|
|
(2026-09-14 브레인 판정). 상수 셋이 같고 식이 같으면 같은 값.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
if str(ROOT) not in sys.path:
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from B06_Section import B06_Section_Engine_Culvert as culvert # noqa: E402
|
|
|
|
TS = (ROOT / "B06_Section" / "B06_Section_UI_Cross_Culvert_Const.ts").read_text(encoding="utf-8")
|
|
#: 세트 스펙 TS 짝(`common_util_culvert_sets.ts`)도 같은 상수를 들고 있음 — 셋을 함께 대조.
|
|
SETS = (ROOT / "common_util" / "common_util_culvert_sets.ts").read_text(encoding="utf-8")
|
|
|
|
|
|
def _ts_const(source: str, name: str) -> float:
|
|
return float(re.search(rf"export const {name} = ([\d.]+);", source).group(1))
|
|
|
|
|
|
def test_상수_셋이_TS_와_같다() -> None:
|
|
for name in ("REVET_HEIGHT_STEP_M", "REVET_EMBED_DEPTH_M"):
|
|
assert getattr(culvert, name) == _ts_const(TS, name) == _ts_const(SETS, name), name
|
|
assert culvert.OLD_PIPE_WALL_DEFAULT_M == _ts_const(SETS, "OLD_PIPE_WALL_DEFAULT_M")
|
|
|
|
|
|
def test_TS_식_모양이_그대로다() -> None:
|
|
"""식을 바꾸면 여기서 잡힘 — 파이썬 식도 함께 고칠 것."""
|
|
assert "const raw = diameterM;" in TS and "const raw = diameterM;" in SETS
|
|
assert "Math.ceil(raw / REVET_HEIGHT_STEP_M - 1e-9) * REVET_HEIGHT_STEP_M" in TS
|
|
assert "return revetTargetHeight(diameterM) + REVET_EMBED_DEPTH_M;" in TS
|
|
# 그림이 칸 값을 읽음(139-1) — 배관 기본 = 칸 → 관경 기준
|
|
assert "(spec.revet_height_m ?? pipeWallMinPureHeight(diameterM))" in TS
|
|
# 옛 1.5 옮김 — TS 세트 짝 식
|
|
assert "Math.abs(stored - OLD_PIPE_WALL_DEFAULT_M) < 1e-9 &&" in SETS
|
|
assert "diameterM > 1.0 + 1e-9" in SETS
|
|
|
|
|
|
def test_관경별_기본_높이() -> None:
|
|
"""관경 + 0.5 = 땅속 근입 0.5 포함 벽 전체 높이 · 벽 윗면 = 관 윗면(139-1 · 10-6 표 Ø1000 = 1.5)."""
|
|
assert culvert.pipe_wall_min_height_m(1.0) == 1.5
|
|
assert culvert.pipe_wall_min_height_m(0.8) == 1.3
|
|
assert culvert.pipe_wall_min_height_m(1.2) == 1.7
|
|
assert culvert.pipe_wall_min_height_m(1.5) == 2.0
|
|
|
|
|
|
def test_옛_기본_옮김() -> None:
|
|
assert culvert.pipe_wall_height_m(1.5, 1.2) == 1.7
|
|
assert culvert.pipe_wall_height_m(1.5, 1.0) == 1.5
|
|
assert culvert.pipe_wall_height_m(1.6, 1.5) == 1.6
|
|
assert culvert.pipe_wall_height_m(None, 1.2) is None
|