Files
Aislo/resources/tester/test_b05_station_merge.mjs
T
eomsangdonandClaude Opus 5 0ef32b5279 chore(tester): 시험을 resources/tester/ 로 옮김 — 창끼리 건너가게
⚠ **뿌리** — `tmp/` 는 창 사이에 안 건너감(실측 확인: 상대 창이 놓은 `tmp/_sync_probe.txt`
가 시간을 두고 두 번 봐도 안 보임). 그래서 **정본(등록부 스키마)만 건너가고 그것을 읽는
시험은 안 건너가** 오늘 두 번, 같은 시험이 **연 창은 통과·받은 창은 실패**가 됐음.

- `tmp/tests/*` 를 `resources/tester/` 로 **복사**(127 파일). 내용은 **한 줄도 안 고침**
- `tmp/tests` 는 **남겨 둠** — 되돌릴 자리(사용자 지시)
- 실행: `./venv/Scripts/python.exe -m pytest resources/tester/ -q`
  옮기기 전과 **같은 수**: 617 통과 / 22 건너뜀 / 실패 0

⇒ 이제 시험·예외·까닭이 **정본과 함께** 움직임. 오늘 세운 「예외는 정본 스키마에」와 짝임.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 17:12:30 +09:00

38 lines
1.4 KiB
JavaScript

/* 구조물 측점과 겹치는 규칙 측점 제거 — 2026-09-06.
TS 를 프로젝트 tsc 로 옮겨 실제 코드를 그대로 돌린다. */
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { mkdtempSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { pathToFileURL } from "node:url";
const out = mkdtempSync(join(tmpdir(), "aislo-station-"));
execFileSync(
process.execPath,
[
"./config/node_modules/typescript/bin/tsc",
"B05_Profile/B05_Profile_Util_Station.ts",
"--outDir", out,
"--module", "esnext", "--target", "es2022", "--moduleResolution", "bundler", "--ignoreConfig",
],
{ stdio: "inherit" },
);
const { dropStationsNear, STATION_MERGE_TOLERANCE_M } = await import(
pathToFileURL(join(out, "B05_Profile_Util_Station.js")).href
);
const regular = [0, 20, 40, 60, 80].map((chainage_m) => ({ chainage_m, kind: "regular" }));
const structures = [{ chainage_m: 40.05 }, { chainage_m: 63.0 }];
const kept = dropStationsNear(regular, structures);
assert.deepEqual(
kept.map((s) => s.chainage_m),
[0, 20, 60, 80],
"0.1m 안에서 겹친 40m 규칙 측점만 빠져야 한다",
);
assert.equal(STATION_MERGE_TOLERANCE_M, 0.1);
// 구조물이 없으면 아무것도 지우지 않는다.
assert.equal(dropStationsNear(regular, []).length, regular.length);
console.log("OK — 구조물 측점과 겹친 규칙 측점만 제거");