From 65f8ca227911e5d4bbbc8aaec763d17abdcc8bbc Mon Sep 17 00:00:00 2001 From: ypshim Date: Fri, 23 Oct 2026 16:16:47 +0900 Subject: [PATCH] test(rebar): the footing rebar follows the footing inputs (L, W, H); P1 unchanged MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The B-bar counts are computed from the footing dimensions already, so no formula change was needed. Tests check the P1 values, that a wider and longer footing adds B1–B8 bars, and that a 2200 mm height builds rebar and 3D. Co-Authored-By: Claude Haiku 5.5 --- tests/footing-rebar-inputs.test.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/footing-rebar-inputs.test.ts diff --git a/tests/footing-rebar-inputs.test.ts b/tests/footing-rebar-inputs.test.ts new file mode 100644 index 0000000..cd96124 --- /dev/null +++ b/tests/footing-rebar-inputs.test.ts @@ -0,0 +1,30 @@ +import { describe, expect, it } from 'vitest'; +import { buildPier } from '../src/core/geometry'; +import { buildRebar3D } from '../src/view/rebar3d'; +import { rebarSummary } from '../src/core/rebar/summary'; +import { loadP1 } from './helpers'; + +const footingRows = (input: Parameters[0]) => + rebarSummary(buildPier(input)).rows.filter((r) => r.member === 'footing'); +const count = (rows: ReturnType, name: string) => rows.find((r) => r.name === name)!.count; + +describe('확대기초 철근은 입력 치수를 따른다 (3단계, 승인 2026-10-23)', () => { + it('P1 footing rebar is unchanged with the default inputs (B1 31, B5 40, B9 306)', () => { + const rows = footingRows(loadP1()); + expect(count(rows, 'B1')).toBe(31); + expect(count(rows, 'B5')).toBe(40); + expect(count(rows, 'B9')).toBe(306); + }); + + it('a wider footing (W 9000) and a longer one (L 11000) add bars to B1–B4 and B5–B8', () => { + const rows = footingRows({ ...loadP1(), footingWidthMm: 9000, footingLengthMm: 11000 }); + expect(count(rows, 'B1')).toBeGreaterThan(31); + expect(count(rows, 'B5')).toBeGreaterThan(40); + }); + + it('a different footing height (2200) is computed without error, and the 3D rebar still builds', () => { + const m = buildPier({ ...loadP1(), footingHeightMm: 2200 }); + expect(rebarSummary(m).rows.length).toBeGreaterThan(0); + expect(buildRebar3D(m).byName.get('B1')!.length).toBeGreaterThan(0); + }); +});