"""B07 로 옮겨 적은 사면 기하 — 옮기며 값이 바뀌지 않았는지 (PLAN 7-3). 옛 자리 `B08_Quantity_Engine_SlopeLength`·`_SlopeArea` 에서 **B07 이 쓰는 몫만** 옮겨 적었다 (`B07_DesignDetail_Engine_SlopeGeometry`). 여기 둔 것은 옮긴 로직이 깨지면 바로 걸리는 판정 둘 — 소단에서 사면이 끊기지 않을 것 · 층따기 밑수가 성토 비탈면이 아닐 것. """ from __future__ import annotations import pytest from B06_Section.B06_Section_Engine_Design import compute_cross_design from B07_DesignDetail.B07_DesignDetail_Engine_SlopeGeometry import ( PROTECTION_SOURCE, StationSlope, length_of, series_key, station_slope, ) from common_util.common_util_cross_berm import BermSpec # 노면보다 8m 낮은 평지 — 양쪽 성토 사면이 길게 섬. SAMPLES = [{"offset_m": x / 2, "elevation_m": -8.0} for x in range(-160, 161)] def _design(berm: BermSpec | None) -> dict: return compute_cross_design( SAMPLES, 0.0, ground_type="soil", section_mode="both_fill", berm=berm ) @pytest.mark.parametrize("slope_deg", [0.0, 2.0]) def test_소단이_있어도_사면길이가_끝까지_이어진다(slope_deg: float) -> None: """설계선이 격자로 찍혀 소단 평탄부가 여러 조각으로 쪼개져도 거기서 끊기지 않을 것.""" plain = station_slope(0.0, _design(None)) stepped = station_slope(0.0, _design(BermSpec(0.5, 3.0, slope_deg))) assert plain.fill_length_m > 15 # 양쪽 합 — 시험이 뜻을 가지는 크기 # 소단 평탄부는 사면길이에 안 들고, 비탈 조각은 끝까지 셈 — 같은 낙차라 거의 같음. assert stepped.fill_length_m == pytest.approx(plain.fill_length_m, rel=0.05) assert stepped.fill_height_m == pytest.approx(plain.fill_height_m, abs=0.2) def test_층따기_밑수는_성토_비탈면이_아니다() -> None: """층따기는 성토부 **아래 원지반**을 깎는 일 — 성토 사면길이로 대신 채우면 다른 면을 센다.""" slope = StationSlope( chainage_m=0.0, cut_length_m=7.0, fill_length_m=9.0, bench_cut_length_m=4.0 ) assert length_of(slope, "bench_cut", "fill") == 4.0 assert length_of(slope, "bench_cut", "cut") == 0.0 # 법면보호공은 면고르기를 참조 — 같은 사면길이를 쓴다. assert length_of(slope, PROTECTION_SOURCE, "fill") == 9.0 assert length_of(slope, "face_dressing", "cut") == 7.0 assert series_key("face_dressing", "cut") == "face_dressing_cut"