Files
Aislo/resources/tester/test_b08_wall_trench.py
T
eomsangdonandClaude Opus 5 d7cb14f416 test(B08): tmp/tests 중 tester 에 없던 47 개를 resources/tester 로 옮김
tmp/ 가 창끼리 안 건너가는 것이 확정돼(랩탑이 시간 두고 두 번 확인) 시험·예외가
저절로 건너가도록 git 안으로 옮김. 사용자 확정.

- 내용은 하나도 안 고침 — 자리만 옮김. tmp/tests 는 남겨 둠.
- 같은 이름이 이미 있던 64 개는 랩탑 것을 그대로 두고 건너뜀.
- helper_b05_*.js 둘은 랩탑이 .cjs 로 이미 올린 것과 **줄바꿈만 다른 같은 내용**이라
  복사본을 도로 뺌(시험이 .cjs 를 부름).
- resources/tester/ 에서 전체 1176 통과 · 29 건너뜀 · 실패 0.

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

84 lines
3.3 KiB
Python

"""벽 터파기 — 공용 단면 함수 한 벌을 쓴다 (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