A row can now carry pieces (length, count). C9, C10, C11 and C9·C11 사이 have U and 삿갓 pieces per position (3 loops each); C12 and C13 have 일자 and ㄷ pieces per bar; P1 and P2 have their splice pieces, each counting all the bars. The 재료표 totals from the pieces, so no bar is left out. 개수 stays the 철근표 count; the piece count is kept beside it. The 삿갓 length h − 100 is an assumption (Q-K5) and is noted on the ④ screen. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
48 lines
2.2 KiB
TypeScript
48 lines
2.2 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { buildPier } from '../src/core/geometry';
|
|
import { DEFAULT_MATERIAL } from '../src/core/rebar/common';
|
|
import { buildQuantity } from '../src/core/rebar/quantity';
|
|
import { rebarSummary, type RebarRow } from '../src/core/rebar/summary';
|
|
import { loadP1 } from './helpers';
|
|
|
|
const rows = rebarSummary(buildPier(loadP1())).rows;
|
|
const row = (name: string): RebarRow => rows.find((r) => r.name === name)!;
|
|
const total = (r: RebarRow) => r.pieces!.reduce((s, p) => s + p.count * p.length, 0);
|
|
const bars = (r: RebarRow) => r.pieces!.reduce((s, p) => s + p.count, 0);
|
|
const hasLength = (r: RebarRow, mm: number, tol = 3) => r.pieces!.some((p) => Math.abs(p.length - mm) < tol);
|
|
|
|
describe('조각 길이 (승인 2026-10-23): 여러 길이를 가진 행', () => {
|
|
it('C9 and C11 pieces: U (3522 first, 6098 last) and 삿갓, 3 loops each; 108 bars per row', () => {
|
|
for (const name of ['C9', 'C11']) {
|
|
expect(row(name).pieces, name).toBeDefined();
|
|
expect(bars(row(name)), name).toBe(108);
|
|
expect(hasLength(row(name), 3522), name).toBe(true);
|
|
expect(hasLength(row(name), 6098), name).toBe(true);
|
|
}
|
|
});
|
|
|
|
it('C10 pieces: outer U 6249 and Level U 6340; 54 bars', () => {
|
|
expect(bars(row('C10'))).toBe(54);
|
|
expect(hasLength(row('C10'), 6249)).toBe(true);
|
|
expect(hasLength(row('C10'), 6340)).toBe(true);
|
|
});
|
|
|
|
it('C12 and C13 pieces: the bars per row equal the row count (4 per position)', () => {
|
|
expect(bars(row('C12'))).toBe(row('C12').count);
|
|
expect(bars(row('C13'))).toBe(row('C13').count);
|
|
expect(total(row('C12'))).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('P1 and P2 pieces: each splice piece counts all the bars (230)', () => {
|
|
expect(row('P1').pieces!.every((p) => p.count === 230)).toBe(true);
|
|
expect(row('P2').pieces!.every((p) => p.count === 230)).toBe(true);
|
|
expect(row('P1').pieces!.length).toBeGreaterThan(1);
|
|
});
|
|
|
|
it('the 재료표 no longer leaves out any P1 bar: no missing bars', () => {
|
|
const q = buildQuantity(rows, DEFAULT_MATERIAL);
|
|
expect(q.missing).toEqual([]);
|
|
expect(q.groups.flatMap((g) => g.diameters.flatMap((d) => d.lines.map((l) => l.name)))).toEqual(expect.arrayContaining(['C9', 'C10', 'C11', 'C12', 'P1', 'P2']));
|
|
});
|
|
});
|