feat(est): connect original quantity sheets

This commit is contained in:
2026-11-05 06:19:15 +09:00
parent 60ccedcd9a
commit 1856aa897d
13 changed files with 284 additions and 15 deletions
File diff suppressed because one or more lines are too long
+9
View File
@@ -9,6 +9,7 @@ for (const file of [
"native-machine.js",
"native-rows.js",
"native-text.js",
"native-quantity.cjs",
"native-wonga.js",
"native-engine.js",
"native-business.js",
@@ -63,6 +64,14 @@ else if (command === "extended") {
})`,
context,
);
} else if (command === "quantity") {
context.sheets = JSON.parse(
fs.readFileSync(path.join(__dirname, "fixtures/est_quantity_sheets.json"), "utf8"),
);
result = vm.runInContext(
"sheets.map(sheet=>({Code:sheet.Code,original:sheet.items,...EstQuantity.calculate(sheet)}))",
context,
);
} else if (command === "business")
result = vm.runInContext(
`
+27
View File
@@ -238,3 +238,30 @@ def test_installed_main_archive_all_stored_values_when_available():
assert result["differences"] == []
assert all(item["checked"] == item["matched"] for item in result["counts"].values())
assert sum(item["checked"] for item in result["counts"].values()) > 100000
def test_original_quantity_sheets_and_three_saved_formula_disagreements():
sheets = run("quantity")
assert len(sheets) == 75
# Original editor formulas disagree with MulList saved numbers in three
# places. Keep both visible instead of changing the formulas to replay them.
expected = {
("N0000000083", "r000004"): (286, 0.35 * 1.3 * 220),
("N0000000086", "r000004"): (0, 1 * 1),
("N0000000106", "r000000"): (138.72, 1.25 * 2 * 68 * 1.02),
}
differences = set()
checked = 0
for sheet in sheets:
assert sheet["errors"] == []
for before, after in zip(sheet["original"], sheet["items"]):
checked += 1
key = (sheet["Code"], before["Code"])
if key in expected:
assert before["GN"] == expected[key][0]
assert abs(after["GN"] - expected[key][1]) < 1e-6
differences.add(key)
else:
assert abs((before.get("GN") or 0) - (after.get("GN") or 0)) < 1e-6, key
assert checked == 449
assert differences == set(expected)