Files
Aislo/resources/tester/spreadsheet/test_spreadsheet_bench.py
T
eomsangdonandClaude Opus 5.5 b58073730f test(spreadsheet): A 엔진 무게 시험 — 칸 1만 · 식 5천 재계산 · 6만 8천 칸 불러오기 · 나눗셈 사슬 분모 상한
- bench_spreadsheet_engine.cjs — 얕은 시트 · 깊은 사슬 5천 · 큰 시트(271 행 × 253 열) · 소수 역수 합 · 곱나눗셈 사슬 수치
- test_spreadsheet_bench.py — 딸린 칸 수 · 시간 한도(실측 몇 배) · 분모 41 자리 안 · double 과 상대 오차 1e-12 안
- helper_spreadsheet_engine.cjs — 적재 · 가짜 함수를 무게 시험이 같이 씀

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TULoa94ZFL26KU6ZqVpjkF
2026-09-27 20:25:30 +09:00

55 lines
1.6 KiB
Python

# -*- coding: utf-8 -*-
"""산출근거 스프레드시트 엔진 A 무게 시험 — 칸 1만 · 식 5천 시트에서 칸 하나 고칠 때 재계산 ·
6만 8천 칸 불러오기 · 분모가 커지는 나눗셈 사슬(상한 10^40 넘으면 30 자리 십진으로 굳힘).
Node 헬퍼(`bench_spreadsheet_engine.cjs`)가 수치를 냄. 한도는 이 PC 실측의 몇 배로 넉넉히 둠 —
실측이 한도 가까이 오르면 느려진 것.
"""
import json
import os
import subprocess
import pytest
HERE = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture(scope="module")
def bench():
proc = subprocess.run(
["node", os.path.join(HERE, "bench_spreadsheet_engine.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
timeout=300,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_얕은_시트_칸_하나는_딸린_칸만(bench):
s = bench["shallow"]
assert s["editMiddle"]["redone"] == 4 # 고친 칸 + 이웃 식 둘 + 합계
assert s["editMiddle"]["ms"] < 100
assert s["loadMs"] < 3000
def test_깊은_사슬_5천_칸(bench):
c = bench["chain"]
assert c["editFirst"]["redone"] == 5001
assert c["editFirst"]["ms"] < 1000
assert c["editLast"]["redone"] == 2
def test_큰_시트_불러오기(bench):
b = bench["bigSheet"]
assert b["cells"] > 60000
assert b["parseMs"] + b["loadMs"] < 15000
def test_나눗셈_사슬_분모_상한(bench):
d = bench["divChain"]
assert d["maxDenominatorDigits"] <= 41
assert d["relErrVsDouble"] < 1e-12