提示词:

对标 LinuxCNC,分阶段完善 Web 版数控系统仿真的 WASM 程序,继续补齐 G/M 代码语法并严格测试。

总结:
按 LinuxCNC read_g/read_m 的模态组规则,补充同一行同模态组 G/M 码冲突检查;新增 G0 G1 与 M3 M4 拒绝用例。已通过 ./test-native.sh 和 ./test-linuxcnc-source-link.sh。
This commit is contained in:
wangdequan
2026-05-23 17:59:24 +08:00
parent 575bcf24d8
commit f3f3a1dfa5
2 changed files with 203 additions and 0 deletions

View File

@@ -3572,6 +3572,25 @@ int main() {
sizeof(duplicate_axis_word_program) - 1) != 0,
"expected LinuxCNC to reject multiple X words on one line");
const char same_modal_group_g_program[] =
"G21 G90\n"
"F100\n"
"G0 G1 X1\n";
events.clear();
ok &= expect(cnc_sim_parse_program(sim,
same_modal_group_g_program,
sizeof(same_modal_group_g_program) - 1) != 0,
"expected LinuxCNC to reject two G codes from the same modal group");
const char same_modal_group_m_program[] =
"G21 G90\n"
"M3 M4\n";
events.clear();
ok &= expect(cnc_sim_parse_program(sim,
same_modal_group_m_program,
sizeof(same_modal_group_m_program) - 1) != 0,
"expected LinuxCNC to reject two M codes from the same modal group");
const char scientific_notation_word_program[] =
"G21 G90\n"
"F100\n"