Add LinuxCNC G10 L20 coordinate regression

This commit is contained in:
CNC Local
2026-05-22 04:53:48 +08:00
parent bf7192cc07
commit 8afbadc6d0
4 changed files with 55 additions and 4 deletions

View File

@@ -69,6 +69,8 @@ int main() {
bool saw_xy_rotation = false;
bool saw_g92_clear = false;
bool saw_coordinate_end_line = false;
bool saw_l20_g55_offset = false;
bool saw_l20_end_line = false;
for (const auto &event : events) {
saw_tool = saw_tool || event.type == CNC_SIM_EVENT_TOOL_CHANGE;
saw_rapid = saw_rapid || event.type == CNC_SIM_EVENT_RAPID;
@@ -117,6 +119,30 @@ int main() {
ok &= expect(saw_g49, "expected LinuxCNC G49 RTCP off state");
ok &= expect(saw_g434, "expected LinuxCNC G43.4 RTCP on state with H code");
const char l20_program[] =
"G21 G90 G17\n"
"G0 X5 Y6 Z7\n"
"G10 L20 P2 X1 Y2 Z3\n"
"G55\n"
"M30\n";
events.clear();
ok &= expect(cnc_sim_parse_program(sim, l20_program, sizeof(l20_program) - 1) == 0,
cnc_sim_last_error(sim));
for (const auto &event : events) {
saw_l20_g55_offset = saw_l20_g55_offset ||
(event.type == CNC_SIM_EVENT_SET_G5X_OFFSET &&
event.line == 4 &&
event.tool == 2 &&
event.start.x == 4.0 &&
event.start.y == 4.0 &&
event.start.z == 4.0);
saw_l20_end_line = saw_l20_end_line ||
(event.type == CNC_SIM_EVENT_PROGRAM_END &&
event.line == 5);
}
ok &= expect(saw_l20_g55_offset, "expected LinuxCNC G10 L20 P2 offset after G55 selection");
ok &= expect(saw_l20_end_line, "expected LinuxCNC G10 L20 program end line number");
const char coordinate_program[] =
"G21 G90 G17\n"
"G10 L2 P1 X12.5 Y-3 Z4 R30\n"