"""벽 터파기 — 공용 단면 함수 한 벌을 쓴다 (2026-09-08). ⚠ 겨누는 것 여섯 ① 식을 여기서 다시 짜지 않는다 — `common_util_excavation.wall_trench_area_m2` 값 그대로 ② 「기초유」면 기초분 0.45㎥/m 가 붙는다 ③ 「기초버림」이면 0.07㎥/m 로 준다 — 기초를 **안 두는 것이 아니라 얕게 두는 것** ④ ⚠ 안 고른 프로젝트는 **비탈분만** 서고 사유가 뜬다 — 한쪽으로 찍으면 0.45 가 임의로 굳는다 ⑤ 되메우기 = (기초깊이 + H) × 0.2 ⑥ 큰돌쌓기도 같은 함수를 탄다 """ from __future__ import annotations import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[2] sys.path.insert(0, str(ROOT)) from common_util.common_util_excavation import wall_trench_area_m2 # noqa: E402 from B08_Quantity.B08_Quantity_Engine_UnitQuantity import ( # noqa: E402 boulder_masonry, stone_masonry, ) H = 2.5 L = 10.0 BACK_CM = 45 두께 = ((BACK_CM / 100 + 0.30) + (BACK_CM / 100 + 0.30 + 0.30 * (H - 1.0))) / 2 # 0.975 def 성분(**options: object) -> tuple[dict, list[str]]: components, notes = stone_masonry( H, L, {"height_m": H, "length_m": L, "back_len_cm": BACK_CM, **options}, wet=True ) return {c.name: c for c in components}, notes def test_공용_함수_값을_그대로_쓴다() -> None: """⚠ 화면(B06 횡단도)이 그 함수로 그린다 — 여기서 다시 짜면 그림과 물량이 갈린다.""" got, _ = 성분(foundation="기초유") expected = wall_trench_area_m2(H, 두께, has_foundation=True) * L assert abs(got["터파기"].amount - expected) < 1e-9 def test_기초유는_기초분_0_45가_붙는다() -> None: 유, _ = 성분(foundation="기초유") 미지정, _ = 성분() assert abs((유["터파기"].amount - 미지정["터파기"].amount) - 0.45 * L) < 1e-9 def test_기초버림은_0_07로_준다() -> None: """⚠ 「기초무」가 아니라 「기초버림」이다 — 얕게 두는 것이라 몫이 남는다.""" 버림, _ = 성분(foundation="기초버림") 미지정, _ = 성분() assert abs((버림["터파기"].amount - 미지정["터파기"].amount) - 0.07 * L) < 1e-9 def test_안_고르면_비탈분만_서고_사유가_뜬다() -> None: got, notes = 성분() assert abs(got["터파기"].amount - H * (두께 + 0.2) * L) < 1e-9 assert any("기초 유/무" in n for n in notes) def test_되메우기는_기초깊이를_함께_센다() -> None: 유, _ = 성분(foundation="기초유") assert abs(유["되메우기"].amount - (0.5 + H) * 0.2 * L) < 1e-9 미지정, _ = 성분() assert abs(미지정["되메우기"].amount - H * 0.2 * L) < 1e-9 def test_잔토는_터파기_빼기_되메우기() -> None: got, _ = 성분(foundation="기초유") assert abs(got["잔토처리"].amount - (got["터파기"].amount - got["되메우기"].amount)) < 1e-9 def test_큰돌쌓기도_같은_함수를_탄다() -> None: components, _ = boulder_masonry( H, L, {"height_m": H, "length_m": L, "stone_cm": "60~80", "foundation": "기초유"} ) got = {c.name: c for c in components} expected = wall_trench_area_m2(H, 0.80, has_foundation=True) * L assert abs(got["터파기"].amount - expected) < 1e-9