# -*- coding: utf-8 -*- """342-1 · 346-2 — 계획선 한 벌 · 낡음 머묾 · 국부 연산 · 흙 배분 열쇠 · [전체 측점 반영] · 카드. 못박는 것 - 머묾 재현: 서버 측점 85.054(0.001 m) · 관 지점 85.05(0.01 m) · 종단곡선 안 — 저장분 선으로 다시 세면 화면 선 기준 낡음이 남음(옛 길) · 화면 선을 받으면 낡음 0 · B05 · B06 판정 같음. - 국부 연산: 같은 입력 다시 셈 0 측점 · 계획고 ▲ 한 번 = 곡선 둘레 몇 측점 · 결과 = 통째 셈. - 다시 셈 뒤에도 남은 낡음 = 기다림 끝(false) · 콘솔 경고 한 줄 · 다시 그림(곡선은 그림). - 흙 배분: 실패한 열쇠 다시 보냄 · 받아 둔 열쇠는 다시 안 물음. - [전체 측점 반영] = 다시 셈 한 번 · 측점 선택을 세션에 안 박음. - 횡단 카드: 보이는 카드만 바로 · 나머지는 쉬는 틈에. Node 헬퍼 `helper_342_1_station_line.mjs` 가 vite ssr 로 묶은 진짜 모듈(`helper_342_1_entry.ts`)을 부름. """ import json import shutil import subprocess import sys from pathlib import Path import pytest HERE = Path(__file__).resolve().parent ROOT = HERE.parents[1] if str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT)) from config.config_system import STANDARD_CROSS_SECTION # noqa: E402 FIXTURE = HERE / "fixtures" / "b05_192_1_moved_pipe_longitudinal.json" @pytest.fixture(scope="module") def out(tmp_path_factory): work = tmp_path_factory.mktemp("b342") build = subprocess.run( [ "node", str(ROOT / "config" / "node_modules" / "vite" / "bin" / "vite.js"), "build", "--configLoader", "runner", "--ssr", "../resources/tester/helper_342_1_entry.ts", "--outDir", str(work), "--logLevel", "error", ], cwd=ROOT, capture_output=True, text=True, encoding="utf-8", timeout=300, ) assert build.returncode == 0, build.stderr bundle = work / "bundle.mjs" shutil.copy(work / "helper_342_1_entry.js", bundle) policy = json.loads(FIXTURE.read_text(encoding="utf-8"))["profile_alignment"]["policy"] source = work / "input.json" source.write_text( json.dumps({"standard": STANDARD_CROSS_SECTION, "policy": policy}, default=str), encoding="utf-8", ) proc = subprocess.run( ["node", str(HERE / "helper_342_1_station_line.mjs"), str(bundle), str(source)], cwd=ROOT, capture_output=True, text=True, encoding="utf-8", timeout=120, ) assert proc.returncode == 0, proc.stderr return json.loads(proc.stdout) def test_화면_선은_관_지점으로_갈음(out): assert 85.05 in out["screenStations"] and 85.054 not in out["screenStations"] def test_머묾_재현_옛_길은_낡음이_남음(out): assert out["staleBefore"] == [85.054] assert out["staleOldPath"] == [85.054] assert out["staleAgainstScreenBefore"] is True def test_화면_선을_받으면_낡음_0_두_판정_같음(out): assert out["staleNewPath"] == [] assert out["staleAgainstScreenAfter"] is False assert out["staleB06View"] == [] def test_국부_연산_바뀐_측점만(out): assert out["recomputedSame"] == 0 assert 0 < out["recomputedEdit"] < out["total"] assert out["sameAsWhole"] is True def test_남은_낡음은_곡선을_그리고_경고(out): assert out["settleFirst"] is True # 다시 셈 기다림 assert out["settleSameKey"] is True # 다시 셈이 못 고침 assert out["settleAfter"] is False # 기다림 끝 — 곡선 그림 assert out["settleWarns"] == 1 assert out["settleRedraws"] >= 1 # 바뀐 것 없어도 다시 그림 assert out["settleClear"] is False def test_흙_배분_실패_열쇠_다시_보냄_받은_열쇠는_안_물음(out): assert out["haulAfterFail"] == 1 assert out["haulRetry"] == 2 assert out["haulB"] == 3 assert out["haulKept"] == 3 assert out["haulKeptPlan"] == 2 def test_전체_측점_반영은_한_번_선택_안_박음(out): assert out["applyAllCalls"] == [out["total"]] assert out["applyAllChoiceKeys"] == 0 def test_횡단_카드_보이는_것_먼저(out): assert out["cardsNow"] == [0, 20, 40] assert out["cardsRedraws"] == 1 assert sorted(out["cardsAll"]) == [0, 20, 40, 60, 80]