Expand LinuxCNC smoke coverage
This commit is contained in:
@@ -94,6 +94,8 @@ int main() {
|
||||
bool saw_g61_mode = false;
|
||||
bool saw_g611_mode = false;
|
||||
bool saw_g64_mode = false;
|
||||
bool saw_tool_length = false;
|
||||
bool saw_tool_length_clear = 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;
|
||||
@@ -316,6 +318,29 @@ int main() {
|
||||
ok &= expect(saw_g611_mode, "expected LinuxCNC G61.1 exact stop mode");
|
||||
ok &= expect(saw_g64_mode, "expected LinuxCNC G64 continuous mode");
|
||||
|
||||
const char tool_length_program[] =
|
||||
"G21 G90 G17\n"
|
||||
"G43 H1\n"
|
||||
"G49\n"
|
||||
"M30\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim, tool_length_program, sizeof(tool_length_program) - 1) == 0,
|
||||
cnc_sim_last_error(sim));
|
||||
for (const auto &event : events) {
|
||||
saw_tool_length = saw_tool_length ||
|
||||
(event.type == CNC_SIM_EVENT_COMMENT &&
|
||||
event.line == 2 &&
|
||||
event.reserved == 430 &&
|
||||
event.start.z == 0.0);
|
||||
saw_tool_length_clear = saw_tool_length_clear ||
|
||||
(event.type == CNC_SIM_EVENT_COMMENT &&
|
||||
event.line == 3 &&
|
||||
event.reserved == 430 &&
|
||||
event.start.z == 0.0);
|
||||
}
|
||||
ok &= expect(saw_tool_length, "expected LinuxCNC G43 H1 tool length event");
|
||||
ok &= expect(saw_tool_length_clear, "expected LinuxCNC G49 tool length clear event");
|
||||
|
||||
const char comment_program[] =
|
||||
"G21 G90 G17\n"
|
||||
"(operator note)\n"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -49,6 +49,10 @@ int main() {
|
||||
SET_G5X_OFFSET(1, 10.0, 20.0, 30.0, 1.0, 2.0, 3.0, 0.0, 0.0, 0.0);
|
||||
SET_G92_OFFSET(1.0, 2.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
SET_XY_ROTATION(15.0);
|
||||
EmcPose tool_offset{};
|
||||
tool_offset.tran.z = 12.5;
|
||||
cnc_sim_linuxcnc_set_current_line(19);
|
||||
USE_TOOL_LENGTH_OFFSET(tool_offset);
|
||||
cnc_sim_linuxcnc_set_current_line(20);
|
||||
COMMENT("bridge comment");
|
||||
cnc_sim_linuxcnc_set_current_line(24);
|
||||
@@ -83,6 +87,7 @@ int main() {
|
||||
bool saw_g5x = false;
|
||||
bool saw_g92 = false;
|
||||
bool saw_rotation = false;
|
||||
bool saw_tool_length = false;
|
||||
bool saw_comment = false;
|
||||
bool saw_mist_on = false;
|
||||
bool saw_flood_on = false;
|
||||
@@ -131,6 +136,10 @@ int main() {
|
||||
event.start.z == 3.0);
|
||||
saw_rotation = saw_rotation || (event.type == CNC_SIM_EVENT_SET_XY_ROTATION &&
|
||||
event.feed == 15.0);
|
||||
saw_tool_length = saw_tool_length || (event.type == CNC_SIM_EVENT_COMMENT &&
|
||||
event.line == 19 &&
|
||||
event.reserved == 430 &&
|
||||
event.start.z == 12.5);
|
||||
saw_comment = saw_comment || (event.type == CNC_SIM_EVENT_COMMENT &&
|
||||
event.line == 20);
|
||||
saw_mist_on = saw_mist_on || (event.type == CNC_SIM_EVENT_COMMENT &&
|
||||
@@ -169,6 +178,7 @@ int main() {
|
||||
ok &= expect(saw_g5x, "expected G5X offset event");
|
||||
ok &= expect(saw_g92, "expected G92 offset event");
|
||||
ok &= expect(saw_rotation, "expected XY rotation event");
|
||||
ok &= expect(saw_tool_length, "expected tool length offset event");
|
||||
ok &= expect(saw_comment, "expected comment event line");
|
||||
ok &= expect(saw_mist_on, "expected mist on state");
|
||||
ok &= expect(saw_flood_on, "expected flood on state");
|
||||
|
||||
Reference in New Issue
Block a user