Files
linuxcncWebWASM/web/worker/test_wasm_function_closure_t6.mjs

34 lines
1.7 KiB
JavaScript

import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
const report = JSON.parse(await readFile(new URL("../../coverage/wasm-function-closure-t6.report.json", import.meta.url), "utf8"));
assert.equal(report.schema, "wasm-function-closure-t6.v1");
assert.equal(report.task_id, "T6-FUNCTION-CLOSURE-01");
assert.equal(report.status, "blocked");
assert.equal(report.matrix.length, 8);
assert.equal(report.counts.blocked, 8);
assert.equal(report.counts.test_blocked, 0);
assert.equal(report.failure_samples.length, 4);
assert.ok(report.failure_samples.some((sample) => sample.code === "official_kinematics_oracle_missing"));
for (const row of report.matrix) {
assert.ok(row.owner);
assert.ok(row.source_refs.length > 0);
assert.ok(row.verified_slice.length > 0);
assert.ok(row.stop_reason);
assert.ok(row.next_action);
assert.equal(row.status, "blocked");
}
assert.equal(report.checks.no_js_fallback.status, "verified");
assert.equal(report.checks.selected_case_boundary.status, "verified");
const canonical = (value) => {
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
if (value && typeof value === "object") return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonical(value[key])}`).join(",")}}`;
return JSON.stringify(value);
};
const copy = structuredClone(report);
const expected = copy.report_sha256;
delete copy.report_sha256;
assert.equal(expected, createHash("sha256").update(canonical(copy)).digest("hex"));
console.log(JSON.stringify({ schema: report.schema, status: "verified", rows: report.matrix.length, blocked: report.counts.blocked, failure_samples: report.failure_samples.length, release_action: report.release_action }));