Files
Aislo/resources/tester/test_plan_curve_limits.py
T
eomsangdonandClaude Opus 5 b076e006a7 feat(B05): 계획노선 곡선 R·L 하한을 화면에서 막음
- 임도 종류별 하한 표를 config 에 둠, 작업임도는 규정이 없어 0(제한 없음)
- 기본 반지름과 하한을 갈라 둠 — 한 값이면 하한 0 이 반지름 0 이 되어 곡선이 안 그려짐
- `/route/plan` 이 `limit_radius_m`·`limit_curve_length_m` 를 함께 내림
- 반지름 칸·곡선 길이 칸·손잡이 끌기가 하한에서 멈추고, 노드 이동은 그 걸음을 되돌림
- 이미 하한을 밑돌던 자리는 그대로 두고 지키던 자리가 넘어가는 것만 막음
- 시험 `resources/tester/test_plan_curve_limits.py` 추가

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012jsXWphgRUHAG2mFupSKPX
2026-09-12 14:09:46 +09:00

46 lines
2.0 KiB
Python

"""계획노선 곡선 **하한**(반지름·곡선 길이) 해석 시험.
기본값(`legal_plan_radius_min_m`)과 **못 넘는 하한**(`plan_radius_limit_m`)은 다른 값이다
(2026-09-12 사용자 확정). 둘을 한 값으로 묶으면 작업임도의 하한 0 이 곧 반지름 0 이 되어
곡선이 아예 안 그려지므로, 갈라져 있다는 것 자체를 시험으로 못박는다.
"""
from B05_Profile.B05_Profile_Engine_Grade import (
legal_plan_radius_min_m,
plan_curve_length_limit_m,
plan_radius_limit_m,
resolve_design_speed,
)
def _default(grade_class: str, terrain: str) -> float:
return legal_plan_radius_min_m(resolve_design_speed(grade_class, None), terrain)
def test_작업임도는_하한이_없다():
"""별표2에 작업임도 곡선반지름 규정이 없어 하한을 0(제한 없음)으로 열어 둔다."""
assert plan_radius_limit_m("work", None, "normal") == 0.0
assert plan_radius_limit_m("work", None, "special") == 0.0
def test_작업임도도_기본_반지름은_그대로다():
"""하한이 0이어도 **곡선을 만들 때 쓰는 기본값**은 살아 있어야 한다."""
assert _default("work", "normal") > 0
def test_간선_산불진화는_법정표가_곧_하한이다():
for grade_class in ("main", "trunk", "fire"):
for terrain in ("normal", "special"):
assert plan_radius_limit_m(grade_class, None, terrain) == _default(grade_class, terrain)
def test_모르는_임도종류는_법정표로_떨어진다():
"""칸이 없는 값이 와도 막지 않고 법정표를 하한으로 쓴다(가장 보수적인 쪽)."""
assert plan_radius_limit_m("알 수 없는 종류", None, "normal") == _default("work", "normal")
def test_곡선길이_하한은_아직_전부_0이다():
"""법령·교본에 평면 곡선 길이 하한 값이 없다 — 자리만 열어 둔 칸이다."""
for grade_class in ("main", "trunk", "fire", "work", "branch", "없는종류"):
assert plan_curve_length_limit_m(grade_class) == 0.0