- 원가 수식에서 못 찾은 영문 식별자·두 자리 이하 정수 참조는 오류 없이 0(원본 c9af48·c9a310) — 자료 오류 검색은 계속 알림 - 표준 원가 양식 산업안전보건관리비 「A」 오류 해소 - 원가 연결 54(직접공사비) 행에 내역 직접공사비 채움 - 웹 데모 양식 요율 숫자는 소수로, 미결 정리 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
85 lines
3.1 KiB
Python
85 lines
3.1 KiB
Python
"""작업모드: 일반↔표준 원가계산서 묶음 보관·꺼내기, 설치 양식목록 읽기."""
|
||
|
||
import json
|
||
import subprocess
|
||
from pathlib import Path
|
||
|
||
import pytest
|
||
|
||
from test_est_rea_parity import run
|
||
|
||
ROOT = Path(__file__).resolve().parents[2]
|
||
INSTALL = Path("C:/Dasansoft/Est Plus 2/System/MainSys/SWongaFileList.dat")
|
||
|
||
|
||
def test_swap_keeps_each_group_wonga():
|
||
result = run(
|
||
"math",
|
||
"""(()=>{
|
||
const p=EstNative.empty();p.tables.Wonga=[{Name:'일반'}];
|
||
const a=EstWorkMode.swap(p,3);const std=p.tables.Wonga.length;
|
||
p.tables.Wonga=[{Name:'표준'}];
|
||
const b=EstWorkMode.swap(p,4);
|
||
const c=EstWorkMode.swap(p,1);const back=p.tables.Wonga.map(r=>r.Name);
|
||
const d=EstWorkMode.swap(p,3);
|
||
return {a,std,b,c,back,d,now:p.tables.Wonga.map(r=>r.Name),mode:p.options.WorkMode,
|
||
kept:Object.keys(p.wongaByGroup)};
|
||
})()""",
|
||
)
|
||
assert result["a"] == {"changed": True, "found": False}
|
||
assert result["std"] == 1
|
||
assert result["b"] == {"changed": False}
|
||
assert result["c"] == {"changed": True, "found": True}
|
||
assert result["back"] == ["일반"]
|
||
assert result["d"] == {"changed": True, "found": True}
|
||
assert result["now"] == ["표준"]
|
||
assert result["mode"] == 3
|
||
assert result["kept"] == ["general"]
|
||
|
||
|
||
@pytest.mark.skipif(not INSTALL.exists(), reason="원본 설치 폴더 없음")
|
||
def test_install_wonga_formats_read():
|
||
out = subprocess.check_output(
|
||
[
|
||
"node",
|
||
"-e",
|
||
"const w=require(process.argv[1]);const g=w.get(false),s=w.get(true);"
|
||
"const f=w.get(true,s[0].index);"
|
||
"console.log(JSON.stringify({g:g.length,s:s.length,rows:f.rows.length,"
|
||
"cost:f.rows.some(r=>'Cost' in r),first:f.rows[0].LinkIndex}))",
|
||
str(ROOT / "tools/est-test/wonga-formats.cjs"),
|
||
],
|
||
text=True,
|
||
encoding="utf-8",
|
||
)
|
||
result = json.loads(out)
|
||
assert result["g"] == 30 and result["s"] == 30
|
||
assert result["rows"] > 10 and result["cost"] is False and result["first"] == 54
|
||
|
||
|
||
@pytest.mark.skipif(not INSTALL.exists(), reason="원본 설치 폴더 없음")
|
||
def test_standard_template_unknown_symbol_is_zero_like_original():
|
||
rows = subprocess.check_output(
|
||
[
|
||
"node",
|
||
"-e",
|
||
"const w=require(process.argv[1]);console.log(JSON.stringify(w.get(true,4).rows))",
|
||
str(ROOT / "tools/est-test/wonga-formats.cjs"),
|
||
],
|
||
text=True,
|
||
encoding="utf-8",
|
||
)
|
||
result = run(
|
||
"math",
|
||
f"""(()=>{{
|
||
const rows={rows};rows[0].Cost=1000000;rows[1].Cost=300000; // 직접공사비·직접노무비(엔진이 내역에서 채우는 값)
|
||
const c=EstWonga.calculate(rows,{{VerFormat:false}});
|
||
const r=(n)=>c.rows.find(x=>x.NumStr===String(n));
|
||
return {{errors:c.errors,safety:r(9).Cost,two:r(2).Cost,v19:r(19).Cost,total:c.total}};
|
||
}})()""",
|
||
)
|
||
assert result["errors"] == []
|
||
# (A × 0.496 + 2 + 19/1.1) × 0.0248 — A 는 원본처럼 0
|
||
assert result["safety"] == int((result["two"] + result["v19"] / 1.1) * 0.0248)
|
||
assert result["total"] > 0
|