import { describe, expect, it } from 'vitest'; import { buildPier } from '../src/core/geometry'; import { BEARING_ELEVATION_REF, SOLPLATE_REF, SOLPLATE_T_RULE, solplateTs } from '../src/core/bearing-ref'; import { loadP1 } from './helpers'; describe('교량받침 reference (도면값, 읽기 전용, 1단계)', () => { it('E = h1 + h2 + h3 + h4 on every row', () => { for (const r of BEARING_ELEVATION_REF) expect(r.h1 + r.h2 + r.h3 + r.h4, `No ${r.no}`).toBe(r.E); }); it('solplate L = A + 100 and W = B + 100 against the elevation row', () => { BEARING_ELEVATION_REF.forEach((e, i) => { expect(SOLPLATE_REF[i].L, `No ${e.no}`).toBe(e.A + 100); expect(SOLPLATE_REF[i].W, `No ${e.no}`).toBe(e.B + 100); }); }); it('T1 and T2 follow T ± L·|S|/2 on every row (the 검산 column)', () => { for (const r of SOLPLATE_REF) { const c = solplateTs(SOLPLATE_T_RULE, r.L, r.s); expect(c.T1, `No ${r.no}`).toBe(r.T1); expect(c.T2, `No ${r.no}`).toBe(r.T2); } }); it('the solplate tapers along the axis: T1 (−측) + T2 (+측) = 2·T, with T = 30 at the centre', () => { for (const r of SOLPLATE_REF) { expect(r.T, `No ${r.no}`).toBe(SOLPLATE_T_RULE); expect(r.T1 + r.T2, `No ${r.no}`).toBe(2 * r.T); expect(r.T1, `No ${r.no}`).toBeGreaterThan(r.T2); } }); it('Excel z is EL.X (option 1): the model keeps z; the drawing EL.X minus Excel z is +64 mm (전열) and −11 mm (후열)', () => { const m = buildPier(loadP1()); const back = m.blocks.filter((b) => b.row === '후열'); const front = m.blocks.filter((b) => b.row === '전열'); BEARING_ELEVATION_REF.forEach((r) => { const z = r.row === '전열' ? front[r.no - 1].padTop : back[r.no - 6].padTop; const diffMm = (r.elx - z) * 1000; // 도면 − 엑셀 // About +64 mm on the front row and −11 mm on the back row (varies by a millimetre or two per bearing). expect(Math.abs(diffMm - (r.row === '전열' ? 64 : -11)), `No ${r.no}`).toBeLessThan(2); }); }); }); import { applyBearingRules, BEARING_RULES_DEFAULT } from '../src/core/bearing-ref'; describe('교량받침 공통 규칙 (2단계)', () => { it('with the drawing values, the rules give back the drawing E, L, W, T1, T2 on every bearing', () => { BEARING_ELEVATION_REF.forEach((r, i) => { const v = applyBearingRules(r, BEARING_RULES_DEFAULT); expect(v.E, `No ${r.no}`).toBe(r.E); expect(v.L, `No ${r.no}`).toBe(SOLPLATE_REF[i].L); expect(v.W, `No ${r.no}`).toBe(SOLPLATE_REF[i].W); expect(v.T1, `No ${r.no}`).toBe(SOLPLATE_REF[i].T1); expect(v.T2, `No ${r.no}`).toBe(SOLPLATE_REF[i].T2); }); }); it('a 10 mm larger mortar h2 raises E by 10 and leaves L, W and T1, T2 unchanged', () => { const r = BEARING_ELEVATION_REF[0]; const v = applyBearingRules(r, { ...BEARING_RULES_DEFAULT, h2: BEARING_RULES_DEFAULT.h2 + 10 }); expect(v.E).toBe(r.E + 10); expect(v.L).toBe(r.A + 100); expect(v.T1).toBe(SOLPLATE_REF[0].T1); }); });