# -*- coding: utf-8 -*- """PLAN 135-3 — B05 3D 도수로 · 돌붙임 띠 솔리드 검사. 도우미(helper_135_3_chute_solid.cjs)가 73-4 픽스처로 관 · BOX · 세월교 · 물넘이 포장 띠를 세워 결과(JSON)를 낸다. 단면 = B06 횡단 띠와 같은 계산 · 길이 = 유출 구조물 폭 · 해시 키 · ③ 구멍(structureTopLoops)이 띠를 안 뚫음. """ import json import os import subprocess import pytest HERE = os.path.dirname(os.path.abspath(__file__)) @pytest.fixture(scope="module") def out(): proc = subprocess.run( ["node", os.path.join(HERE, "helper_135_3_chute_solid.cjs")], capture_output=True, text=True, encoding="utf-8", timeout=120, ) assert proc.returncode == 0, proc.stderr return json.loads(proc.stdout) @pytest.mark.parametrize("name", ["pipe", "box", "ford", "pave"]) def test_band_solid_matches_b06_and_spans_outlet_width(out, name): r = out[name] assert r["count"] == r["expected"] >= 1, r # 유출 성토 조각마다 한 장 assert r["sameShape"] is True # 단면 = B06 chuteBandOutline 그대로 assert r["keys"] == ["chute"] assert all(abs(length - r["expectedLength"]) < 1e-3 for length in r["lengths"]), r assert r["otherSolidsSame"] is True # 다른 구조물 솔리드는 그대로 assert r["holesSame"] is True # ③ 구멍 수 그대로 def test_no_chute_no_band_and_hash(out): assert out["box"]["noChuteNoSolid"] is True assert out["hash"] == { "changed": True, "plainNoChute": True, } # 고르면 만료 · 안 고르면 해시 그대로 assert out["pave"]["ownerOnly"] is True # 걸친 옆 측점은 안 냄 def test_hole_loops_skip_chute(out): assert out["flatTop"]["asWall"] > 0 and out["flatTop"]["asChute"] == 0 def test_mesh_caps_follow_band(out): r = out["mesh"] assert r["found"] and r["colored"] assert r["triangles"] == r["expected"] # 앞 · 뒤 마구리 넓이 합 / (띠 넓이 × 2) = 1 — 꺾인 띠도 안 삐져나옴(부채꼴이면 약 4) assert abs(r["capAreaRatio"] - 1) < 0.01