- 헬퍼 동작 그대로(풀이 함수 본문은 옮겨 담음) · 제품 코드 안 고침 - 확인: 이 묶음 헬퍼를 쓰는 시험 236 개 전 230 통과 → 후 230 통과 (시험별 junit 대조 · 어긋남 0) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
38 lines
1.5 KiB
JavaScript
38 lines
1.5 KiB
JavaScript
/* 368-4 아무 누가거리 측점 하나 거울 — 진짜 `design_pipeline_probe_station.ts`(probeStation) 와
|
|
* `B05_Profile_Sections_Stations.ts`(buildStations + 추가 측점)를 Node 로 돌려 같은 측점인지 냄.
|
|
* 입력 argv[2] JSON {line, curves, pipes, structures, types, at: [m...]} · 짝 = test_368_4_probe_station.py. */
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const { makeLoader } = require("./helper_ts_stub_loader.cjs");
|
|
const CATALOG = require("./helper_322_catalog_module.cjs");
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
const { loadTs } = makeLoader({
|
|
root: ROOT,
|
|
});
|
|
|
|
const logic = loadTs(path.join(ROOT, "B05_Profile", "logic", "B05_Profile_Sections_Stations.ts"));
|
|
const station = loadTs(path.join(ROOT, "common_util", "common_util_structure_station.ts"));
|
|
const probe = loadTs(
|
|
path.join(ROOT, "A00_Common", "design", "logic", "design_pipeline_probe_station.ts"),
|
|
);
|
|
const job = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
|
const build = (curves) =>
|
|
logic.buildStations(job.line, curves, job.pipes, job.structures, {
|
|
types: job.types,
|
|
stationSnap: false,
|
|
});
|
|
|
|
const out = [];
|
|
for (const curves of [job.curves, []]) {
|
|
for (const at of job.at) {
|
|
station.setPlusStations(null);
|
|
const before = build(curves);
|
|
const mine = probe.probeStation(job.line, curves, before, at);
|
|
station.setPlusStations(() => [at]);
|
|
const after = build(curves).find((s) => s.key === mine.key) ?? null;
|
|
out.push({ curves: curves.length, at, mine, after });
|
|
}
|
|
}
|
|
process.stdout.write(JSON.stringify(out));
|