# -*- coding: utf-8 -*- """PLAN 172-1 — B05 3D 제안 ③ 성토 사면 종단 주름 줄임 검사. 도우미(helper_172_1_loft_wrinkle.cjs) — 직선 성토 · 비탈 끝 아래 지형 사인 물결(파장 5 m). 비탈 끝 높이 노선 따라 고르기(σ 3 m · 지형 ±0.5 m) · 측점 단면 = B06 · 측점 앞 덧행 없음 · 틈 0. """ import json import os import subprocess import pytest HERE = os.path.dirname(os.path.abspath(__file__)) @pytest.fixture(scope="module") def results(): proc = subprocess.run( ["node", os.path.join(HERE, "helper_172_1_loft_wrinkle.cjs")], capture_output=True, text=True, timeout=240, ) assert proc.returncode == 0, proc.stderr return json.loads(proc.stdout) def test_mid_slope_wrinkle_halved(results): # 사면 가운데 종단 2차 차분 p90 — 드레이프 그대로(지형 물결의 반)의 절반 밑 for name in ("gentle", "rough"): r = results[name] assert r["midSamples"] > 50, (name, r) assert r["midD2P90"] < 0.5 * r["refD2P90"], (name, r) def test_toe_within_cap(results): for name in ("gentle", "rough"): r = results[name] assert r["toes"] > 100, (name, r) assert r["toeOff"] <= 0.5 + 1e-6, (name, r) # 비탈 끝 = 지형 ±0.5 m assert r["stationToeOff"] < 1e-4, (name, r) # 측점 비탈 끝 = 지형(B06) assert results["rough"]["toeOff"] > 0.4 # 물결이 크면 한도까지 뜸 def test_station_section_kept(results): for name in ("gentle", "rough"): assert results[name]["sectionErr"] < 1e-4, name def test_no_row_before_station(results): for name in ("gentle", "rough"): assert results[name]["preRowPoints"] == 0, name def test_no_gap_no_failed_constraint(results): for name in ("gentle", "rough"): assert results[name]["gaps"] == 0, name assert results[name]["stats"]["failed"] == 0, name