扩展解释器WASM夹具覆盖
结论:解释器核心WASM验证已从minimal_linear扩展到弧、单位、增量、平面和坐标偏置等第一批基础夹具,仍直接调用LinuxCNC解释器源码。
This commit is contained in:
@@ -40,23 +40,37 @@ const interp = await createLinuxCncInterpModule({
|
||||
},
|
||||
});
|
||||
|
||||
const fixtureName = "minimal_linear";
|
||||
const programText = readFileSync(
|
||||
resolve(rootDir, `tests/fixtures/gcode/${fixtureName}.ngc`),
|
||||
"utf8",
|
||||
);
|
||||
const expectedEvents = readFileSync(
|
||||
resolve(rootDir, `tests/fixtures/canon/${fixtureName}.events`),
|
||||
"utf8",
|
||||
).trimEnd();
|
||||
const fixtureNames = [
|
||||
"minimal_linear",
|
||||
"arc_semantics",
|
||||
"length_units",
|
||||
"modal_incremental",
|
||||
"plane_selection",
|
||||
"coordinate_offsets",
|
||||
];
|
||||
|
||||
const output = runProgram(interp, programText);
|
||||
const actualEventSet = new Set(
|
||||
output.split("\n").filter((line) => line.startsWith("canon_event=")),
|
||||
);
|
||||
const expectedEventLines = expectedEvents.split("\n").filter(Boolean);
|
||||
for (const fixtureName of fixtureNames) {
|
||||
const programText = readFileSync(
|
||||
resolve(rootDir, `tests/fixtures/gcode/${fixtureName}.ngc`),
|
||||
"utf8",
|
||||
);
|
||||
const expectedEvents = readFileSync(
|
||||
resolve(rootDir, `tests/fixtures/canon/${fixtureName}.events`),
|
||||
"utf8",
|
||||
).trimEnd();
|
||||
|
||||
for (const expectedEvent of expectedEventLines) {
|
||||
assert.equal(actualEventSet.has(expectedEvent), true, expectedEvent);
|
||||
const output = runProgram(interp, programText);
|
||||
const actualEventSet = new Set(
|
||||
output.split("\n").filter((line) => line.startsWith("canon_event=")),
|
||||
);
|
||||
const expectedEventLines = expectedEvents.split("\n").filter(Boolean);
|
||||
|
||||
for (const expectedEvent of expectedEventLines) {
|
||||
assert.equal(
|
||||
actualEventSet.has(expectedEvent),
|
||||
true,
|
||||
`${fixtureName}: ${expectedEvent}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
console.log("interp_wasm_node_smoke=ok");
|
||||
|
||||
Reference in New Issue
Block a user