Files
Aislo/resources/tester/test_91_ground_free.py
T

86 lines
3.4 KiB
Python

"""91 원지반 · 암 제약 삭제 · 유출측 복합경사.
화면 TS 를 그 자리에서 돌린 값(`helper_91_ground_free.cjs`) · 픽스처 = 73-4 세월교 173.09 · 박스 352.14 · 관 180.
"""
import json
import subprocess
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
HELPER = Path(__file__).parent / "helper_91_ground_free.cjs"
NODE_MODULES = ROOT / "config" / "node_modules"
pytestmark = pytest.mark.skipif(not NODE_MODULES.is_dir(), reason="프론트엔드 의존성 미설치")
@pytest.fixture(scope="module")
def fit() -> dict:
done = subprocess.run( # noqa: S603 — 고정 실행 파일
["node", str(HELPER)], cwd=str(ROOT), capture_output=True, text=True, encoding="utf-8"
)
assert done.returncode == 0, done.stderr
return json.loads(done.stdout)
def test_세월교_바닥_자동은_하상을_따라감(fit: dict) -> None:
for before, after in zip(fit["fordAuto"], fit["fordAutoBedDown"]):
assert after["slabTop"] < before["slabTop"] - 1.0
def test_세월교_바닥_손_값은_원지반을_바꿔도_그대로(fit: dict) -> None:
assert fit["fordHand"] == fit["fordHandBedDown"]
# 손 값 = 측벽 높이 · 흙막이 바닥 = 바닥판 밑(두께 0.3)
for side in fit["fordHand"]:
assert side["wallBottom"] == pytest.approx(side["slabTop"] - 0.3, abs=1e-3)
def test_세월교_박스_칸은_측벽_높이_줄을_받음() -> None:
dock = (ROOT / "B06_Section/B06_Section_UI_Adjust_Dock.ts").read_text(encoding="utf-8")
assert "sideSlots?.wingOutlet) return WALL_HEIGHT_ROW" in dock
def test_다단_자동_자리는_원지반과_무관_사면_1m(fit: dict) -> None:
base, up, down = fit["tiers"]
assert base["walls"] == up["walls"] == down["walls"]
assert base["slopes"] == [1.0, 1.0]
def test_전면_기울기는_단면유형과_무관_칸만(fit: dict) -> None:
# 단면유형 넷 모두 같은 값 · 비면 성토 표값(1.5 m 찰 = 0.25) · 절토 칸 = 0.2
assert all(pair == [0.25, 0.2] for pair in fit["lean"])
def test_B08_성토절토_판정도_칸_아니면_성토() -> None:
from common_util.common_util_structure_face_role import structure_face_role_of
for mode in ("left_cut", "right_cut", "both_cut", "both_fill"):
for side in ("좌", "우", "자동(성토 쪽)"):
assert structure_face_role_of(mode, {"side": side})[0] == "성토"
assert structure_face_role_of("both_fill", {"face_role": "절토"})[0] == "절토"
def test_설계선_끝은_화면_픽셀이_아니라_수치로() -> None:
line = (ROOT / "B06_Section/B06_Section_UI_Cross_Design_Line.ts").read_text(encoding="utf-8")
assert "OVERLAP_PX" not in line
assert line.count("Math.abs(point.elevation_m - g) <= OVERLAP_M") == 2
def test_지형에_막힘_잔재_없음() -> None:
for name in (
"B06_Section_UI_Cross_Culvert.ts",
"B06_Section_UI_Cross_Revetment.ts",
"B06_Section_UI_Cross_Culvert_Wire.ts",
"B06_Section_UI_Cross_Culvert_Types.ts",
"B06_Section_UI_Cross_Culvert_Extra.ts",
):
source = (ROOT / "B06_Section" / name).read_text(encoding="utf-8")
assert "shiftBlockedM" not in source and "지형에 막힘" not in source, name
assert "noticeExtraLimit" not in source and "noticeShortfall" not in source, name