Files
Aislo/resources/tester/helper_432_1_curve_law.cjs
T
eomsangdonandClaude Sonnet 5.5 8a3a145072 test(508-1b 옛 헬퍼 공용 불러오기 5/7): 헬퍼 28 곳 loadTs 베낌 걷고 makeLoader 로
- 헬퍼 동작 그대로(풀이 함수 본문은 옮겨 담음) · 제품 코드 안 고침
- 확인: 이 묶음 헬퍼를 쓰는 시험 233 개 전 233 통과 → 후 233 통과 (시험별 junit 대조 · 어긋남 0)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 17:12:59 +09:00

44 lines
1.5 KiB
JavaScript

/* 432-1 종단곡선 초기값 직선 · 법정 미달 거울 헬퍼 — `logic/B05_Profile_Grade_Ground.ts`
* `groundFollowingBasePvi` · `_UI_Profile_Alignment.ts` `buildAlignment` · `_Profile_CurveLaw.ts` 를
* 그 자리에서 트랜스파일해 돌림. 입력 argv[2] JSON 파일 · 표준출력 JSON 한 벌.
*/
const fs = require("fs");
const path = require("path");
const { makeLoader } = require("./helper_ts_stub_loader.cjs");
const ROOT = path.join(__dirname, "..", "..");
const { loadTs } = makeLoader({
root: ROOT,
});
const LOGIC = path.join(ROOT, "B05_Profile", "logic");
const align = loadTs(path.join(LOGIC, "B05_Profile_UI_Profile_Alignment.ts"));
const ground = loadTs(path.join(LOGIC, "B05_Profile_Grade_Ground.ts"));
const law = loadTs(path.join(LOGIC, "B05_Profile_Profile_CurveLaw.ts"));
const input = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
const pvi = ground.groundFollowingBasePvi(input.ground);
const base = {
policy: input.policy,
onlyExplicitCurves: false,
basePvi: input.basePvi,
chainage: input.chainage,
ground: input.groundZ,
stations: input.stations.map((s) => ({ station_id: null, chainage_m: s })),
};
const cases = input.edits.map((edits) => {
const al = align.buildAlignment(base, edits);
return {
curves: al.curves.map((c) => [c.chainage_m, c.r_m, c.l_m]),
shortfalls: law.verticalCurveShortfalls(al.curves, input.policy),
warnings: al.warnings,
};
});
console.log(
JSON.stringify({
pvi,
cases,
consts: [law.DEFAULT_CURVE_LENGTH_M, law.INITIAL_STRAIGHT_RADIUS_M],
}),
);