31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
import { createLinuxCncInterpSdk } from "../../../runtime/sdk/src/linuxcnc-interp.js";
|
|
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..");
|
|
const sdk = await createLinuxCncInterpSdk({
|
|
wasmBinary: fs.readFileSync(path.join(root, "build/wasm/core/linuxcnc_interp.wasm")),
|
|
print() {},
|
|
printErr() {},
|
|
});
|
|
const iniPath = "/tmp/multispindle.ini";
|
|
sdk.writeTextFile(iniPath, "[TRAJ]\nSPINDLES = 2\nCOORDINATES = XYZ\n");
|
|
const output = sdk.runProgramWithIni([
|
|
"S1200 $1",
|
|
"M3 $1",
|
|
"G95 $1 F0.25",
|
|
"M5 $1",
|
|
"M2",
|
|
"",
|
|
].join("\n"), iniPath);
|
|
assert.ok(output.includes("execute_line_1=0"));
|
|
assert.ok(!output.includes("error_text="));
|
|
assert.ok(output.includes("SET_SPINDLE_SPEED spindle=1 speed=1200"));
|
|
assert.ok(output.includes("START_SPINDLE_CLOCKWISE spindle=1"));
|
|
assert.ok(output.includes("STOP_SPINDLE_TURNING spindle=1"));
|
|
console.log("multispindle_dollar_selection=ok");
|
|
console.log("multispindle_g95_selection=ok");
|