Files
Aislo/resources/tester/test_ford_surface_drop.py
T
eomsangdonandClaude Opus 5 0ef32b5279 chore(tester): 시험을 resources/tester/ 로 옮김 — 창끼리 건너가게
⚠ **뿌리** — `tmp/` 는 창 사이에 안 건너감(실측 확인: 상대 창이 놓은 `tmp/_sync_probe.txt`
가 시간을 두고 두 번 봐도 안 보임). 그래서 **정본(등록부 스키마)만 건너가고 그것을 읽는
시험은 안 건너가** 오늘 두 번, 같은 시험이 **연 창은 통과·받은 창은 실패**가 됐음.

- `tmp/tests/*` 를 `resources/tester/` 로 **복사**(127 파일). 내용은 **한 줄도 안 고침**
- `tmp/tests` 는 **남겨 둠** — 되돌릴 자리(사용자 지시)
- 실행: `./venv/Scripts/python.exe -m pytest resources/tester/ -q`
  옮기기 전과 **같은 수**: 617 통과 / 22 건너뜀 / 실패 0

⇒ 이제 시험·예외·까닭이 **정본과 함께** 움직임. 오늘 세운 「예외는 정본 스키마에」와 짝임.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 17:12:30 +09:00

55 lines
2.1 KiB
Python

"""세월교 월류 높이 → 노면 하강(계획고·절성토 면적) 확인 (2026-08-30 사용자 지시).
`_ford_set`이 월류 높이를 스펙에 싣고, `compute_cross_design(surface_drop_m=)`이
계획고를 통째로 내려 절·성토 면적까지 따라가는지 본다.
"""
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.B06_Section_Engine_Culvert import _ford_set # noqa: E402
from B06_Section.B06_Section_Engine_Design import compute_cross_design # noqa: E402
DROP_M = 0.39
def _samples():
"""V자 계류 — 중심이 낮고 바깥으로 갈수록 높아지는 지반."""
return [
{"offset_m": index / 2, "elevation_m": 100.0 + abs(index / 2) * 0.3, "valid": True}
for index in range(-40, 41)
]
def test_ford_set_carries_overflow_depth():
spec = _ford_set({"ford_width_m": 10, "ford_height_m": DROP_M, "pipe_count": 1})
assert spec["overflow_depth_m"] == DROP_M
assert spec["span_m"] == 10
# 값이 없으면 내리지 않는다.
assert _ford_set({"ford_width_m": 10})["overflow_depth_m"] == 0.0
def test_surface_drop_lowers_plan_and_moves_areas():
samples = _samples()
common = dict(ground_type="soil", section_mode="left_cut")
base = compute_cross_design(samples, 100.0, **common)
drop = compute_cross_design(samples, 100.0, surface_drop_m=DROP_M, **common)
# 계획고·노견이 정확히 월류 높이만큼 내려간다(전폭 평행 하강).
assert round(base["design_elevation_m"] - drop["design_elevation_m"], 4) == DROP_M
for side in ("left", "right"):
gap = base["road_edges"][side]["elevation_m"] - drop["road_edges"][side]["elevation_m"]
assert round(gap, 4) == DROP_M
# 노면이 내려가면 절토가 늘고 성토가 준다.
assert drop["cut_area_m2"] > base["cut_area_m2"]
assert drop["fill_area_m2"] <= base["fill_area_m2"]
# 프론트가 점선을 되그릴 수 있게 하강량을 echo한다. 하강이 없으면 키 자체가 없다.
assert drop["surface_drop_m"] == DROP_M
assert "surface_drop_m" not in base