Files
Pier_v1/tests/footing-rebar-settings.test.ts
T
ypshimandClaude Haiku 5.5 0588ffe3f4 feat(rebar): B11·B12 수평간격을 배수 k 입력으로 (기본 k = 8, 방향은 문서 기준)
- 간격 = k·s: B11은 L 방향 격자(교각축 직각 s), B12는 W 방향 격자(교각축 s). 기본 k = 8 (1000 mm, s = 125)
- 개수는 격자 k칸마다, 조립 단 엇갈림 2칸 유지. 3D 철근도 같은 간격
- 기본 k = 8이므로 P1 기본값의 B11·B12 개수가 60 / 47 → 30 / 24로 바뀜 (k = 4이면 문서값 60 / 47을 재현, 테스트로 확인)
- 패널에 k 두 칸, 규칙 표시에 B11·B12 간격 (k·s)
- FT02를 n·kB11·kB12 정수 검사로 확장

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-26 17:34:51 +09:00

75 lines
4.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from 'vitest';
import { buildPier } from '../src/core/geometry';
import { assemblyJs, footingRuleValues, gridPositions } from '../src/core/rebar/footing';
import { DEFAULT_FOOTING_REBAR, FOOTING_REBAR_RANGES, footingSettingsIssues } from '../src/core/rebar/footing-settings';
import { rebarSummary } from '../src/core/rebar/summary';
import { loadP1 } from './helpers';
describe('확대기초 배근 입력 (승인 2026-10-26, 시안 ③ 확대기초)', () => {
it('the defaults are inside every range and raise no issue', () => {
expect(footingSettingsIssues(DEFAULT_FOOTING_REBAR)).toEqual([]);
for (const [key, [lo, hi]] of Object.entries(FOOTING_REBAR_RANGES)) {
const v = DEFAULT_FOOTING_REBAR[key as keyof typeof DEFAULT_FOOTING_REBAR];
expect(v >= lo && v <= hi, key).toBe(true);
}
});
it('a value outside its range gives FT01; a non-integer n gives FT02', () => {
expect(footingSettingsIssues({ ...DEFAULT_FOOTING_REBAR, cTop: 151 })).toEqual([expect.objectContaining({ code: 'FT01', key: 'cTop' })]);
expect(footingSettingsIssues({ ...DEFAULT_FOOTING_REBAR, n: 2.5 })).toEqual([expect.objectContaining({ code: 'FT02', key: 'n' })]);
});
it('the grid spacing s reaches the grid positions and the rebar table', () => {
const m = buildPier({ ...loadP1(), footingRebar: { sAxis: 150 } });
expect(m.footingRebar.sAxis).toBe(150);
const xs = gridPositions(8000, m.footingRebar);
expect(xs[1] - xs[0]).toBeCloseTo(150, 6);
const b4 = rebarSummary(m).rows.find((r) => r.name === 'B4')!;
const b4Default = rebarSummary(buildPier(loadP1())).rows.find((r) => r.name === 'B4')!;
expect(b4.count).not.toBe(b4Default.count);
});
it('철근표 간격: P1 기본값 B2 250 / 125 · B10-1 200 (기본값); s 150 → B2 300 / 150 · B1 300 (입력)', () => {
const base = rebarSummary(buildPier(loadP1())).rows;
const b2 = base.find((r) => r.name === 'B2')!;
expect([b2.spacing, b2.actual, b2.basis]).toEqual(['250', '125', 'default']);
const b10 = base.find((r) => r.name === 'B10-1')!;
expect([b10.spacing, b10.basis]).toEqual(['200', 'default']);
const rows = rebarSummary(buildPier({ ...loadP1(), footingRebar: { sAxis: 150 } })).rows;
const b2s = rows.find((r) => r.name === 'B2')!;
expect([b2s.spacing, b2s.actual, b2s.basis]).toEqual(['300', '150', 'input']);
const b1s = rows.find((r) => r.name === 'B1')!;
expect([b1s.spacing, b1s.actual]).toEqual(['300', '300']);
expect(rows.find((r) => r.name === 'B10-1')!.basis).toBe('default');
});
it('방향 (문서 기준, 승인 2026-10-26): B1–B4·B9·B12는 교각축(sAxis), B5–B8·B11은 교각축 직각(sPerp)', () => {
const rows = rebarSummary(buildPier({ ...loadP1(), footingRebar: { sPerp: 150 } })).rows;
expect(rows.find((r) => r.name === 'B5')!.spacing).toBe('300');
expect(rows.find((r) => r.name === 'B5')!.basis).toBe('input');
expect(rows.find((r) => r.name === 'B11')!.spacing).toBe('1200 (8s)');
expect(rows.find((r) => r.name === 'B12')!.basis).toBe('default');
expect(rows.find((r) => r.name === 'B1')!.basis).toBe('default');
const rowsAxis = rebarSummary(buildPier({ ...loadP1(), footingRebar: { sAxis: 150 } })).rows;
expect(rowsAxis.find((r) => r.name === 'B9')!.spacing).toBe('600 (4s)');
expect(rowsAxis.find((r) => r.name === 'B12')!.spacing).toBe('1200 (8s)');
expect(rowsAxis.find((r) => r.name === 'B5')!.basis).toBe('default');
});
it('k 배수: k 4 → 간격 500, 개수 60 / 47 (문서 4s 값)', () => {
const rows = rebarSummary(buildPier({ ...loadP1(), footingRebar: { kB11: 4, kB12: 4 } })).rows;
expect(rows.find((r) => r.name === 'B11')!.count).toBe(60);
expect(rows.find((r) => r.name === 'B12')!.count).toBe(47);
});
it('the 조립 단 배수 n reaches the assembly levels', () => {
const H = 2000;
const base = assemblyJs(H, DEFAULT_FOOTING_REBAR);
const wider = assemblyJs(H, { ...DEFAULT_FOOTING_REBAR, n: 3 });
expect(wider.length).toBeLessThan(base.length);
expect(wider.every((j) => j % 3 === 0)).toBe(true);
});
});