import { describe, expect, it } from 'vitest'; import { c14Total, COPING_END_GAP, copingSideBars, sideRows, shearBars, STEP_BAR_COUNTS } from '../src/core/rebar/coping'; // P1 coping: L 12000, one column at the centre (T형). const L = 12000; describe('코핑 철근 (코핑철근.md, plan C3)', () => { it('end gap is cover + e_add = 300', () => { expect(COPING_END_GAP).toBe(300); }); it('C10: 9 bars @300 from 4800 to 7200 (k_max 4, beyond the Level edge at 4950 / 7050)', () => { const { c10 } = shearBars(L); expect(c10).toHaveLength(9); expect(c10[0]).toBe(4800); expect(c10[c10.length - 1]).toBe(7200); expect(c10[1] - c10[0]).toBe(300); }); it('C9 and C11: 18 bars each @250 outward, first at 4550 / 7450, last at 300 / 11700', () => { const b = shearBars(L); expect(b.c9).toHaveLength(18); expect(b.c11).toHaveLength(18); expect(b.c9[b.c9.length - 1]).toBe(4550); expect(b.c9[0]).toBe(300); expect(b.c11[0]).toBe(7450); expect(b.c11[b.c11.length - 1]).toBe(11700); expect(b.endGap).toBe(300); }); it('total shear bars per face: 9 + 18 + 18 = 45 positions', () => { const b = shearBars(L); expect(b.c10.length + b.c9.length + b.c11.length).toBe(45); }); it('a coping too short for C9 is refused (RB-K01)', () => { expect(() => shearBars(2200)).toThrow('RB-K01'); }); it('C12 has 5 rows below the break at 42.538, C13 has 2 rows at and above it', () => { const r = sideRows(41.288, 42.538); expect(r.c12).toEqual([41.288, 41.538, 41.788, 42.038, 42.288]); expect(r.c13).toEqual([42.538, 42.788]); }); it('C12 일자 lengths 3717 / 5333 / 6950 / 8567 / 10183 and C13 11746 for L 12000 (코핑철근.md §6.2 table)', () => { const s = copingSideBars(12000, 41.288, 42.538); const expected = [3717, 5333, 6950, 8567, 10183]; s.c12.forEach((r, i) => expect(r.straight).toBeCloseTo(expected[i], 0)); expect(s.c12[0].xw).toBeCloseTo(4141.7, 1); s.c13.forEach((r) => { expect(r.xw).toBe(127); expect(r.straight).toBe(11746); }); }); it('C14: 38 bars = 2 × 11 upper + 5 + 6 + 3 + 2 lower', () => { expect(c14Total()).toBe(38); }); it('C15 11 bars, C16 22 bars', () => { expect(STEP_BAR_COUNTS).toEqual({ C15: 11, C16: 22 }); }); });