高效率推进 LinuxCNC 源码对齐流程
说明:集中 LinuxCNC 源码清单与 wasm/native probe 的路径解析,补强 manifest、shim、source-link 检查,并保持 LinuxCNC 源码后端对齐验证流程可复用。 验证:./test-native.sh;./test-linuxcnc-source-link.sh;./test-all-native.sh;wasm source/probe 相关脚本。
This commit is contained in:
@@ -243,6 +243,11 @@ if(NOT EMSCRIPTEN)
|
||||
target_link_libraries(rtcp_kinematics_smoke PRIVATE cnc_sim_core)
|
||||
target_include_directories(rtcp_kinematics_smoke PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
|
||||
add_executable(linuxcnc_gees_table_smoke
|
||||
tests/linuxcnc_gees_table_smoke.cpp
|
||||
)
|
||||
target_include_directories(linuxcnc_gees_table_smoke PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
|
||||
add_executable(simulator_gcode_controls_smoke
|
||||
tests/simulator_gcode_controls_smoke.cpp
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -443,6 +443,37 @@ int main() {
|
||||
ok &= expect(saw_g432_h_tool_length, "expected LinuxCNC G43.2 H tool-table additive event");
|
||||
ok &= expect(saw_g49_dynamic_tool_length_clear, "expected LinuxCNC G49 dynamic tool length clear event");
|
||||
|
||||
const char g49_tool_offset_parameter_program[] =
|
||||
"G21 G90 G17\n"
|
||||
"G43.2 H1\n"
|
||||
"O10 if [#<_tool_offset> EQ 1]\n"
|
||||
"G1 X1 F100\n"
|
||||
"O10 endif\n"
|
||||
"G49\n"
|
||||
"O10 if [#<_tool_offset> EQ 0]\n"
|
||||
"G1 X2 F100\n"
|
||||
"O10 endif\n"
|
||||
"M30\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
g49_tool_offset_parameter_program,
|
||||
sizeof(g49_tool_offset_parameter_program) - 1) == 0,
|
||||
cnc_sim_last_error(sim));
|
||||
bool saw_g49_tool_offset_parameter_before = false;
|
||||
bool saw_g49_tool_offset_parameter_after = false;
|
||||
for (const auto &event : events) {
|
||||
saw_g49_tool_offset_parameter_before = saw_g49_tool_offset_parameter_before ||
|
||||
(event.type == CNC_SIM_EVENT_LINEAR_FEED &&
|
||||
event.line == 4 &&
|
||||
near(event.end.x, 1.0));
|
||||
saw_g49_tool_offset_parameter_after = saw_g49_tool_offset_parameter_after ||
|
||||
(event.type == CNC_SIM_EVENT_LINEAR_FEED &&
|
||||
event.line == 8 &&
|
||||
near(event.end.x, 2.0));
|
||||
}
|
||||
ok &= expect(saw_g49_tool_offset_parameter_before && saw_g49_tool_offset_parameter_after,
|
||||
"expected LinuxCNC G49 to clear the applied tool offset parameter before the next motion");
|
||||
|
||||
const char spindle_program[] =
|
||||
"G21 G90 G17\n"
|
||||
"S1200 M3\n"
|
||||
|
||||
@@ -1384,6 +1384,33 @@ int main() {
|
||||
ok &= expect(saw_immediate_g49_named_restore,
|
||||
"expected G49 to restore readonly position named parameters before the next motion");
|
||||
|
||||
const char g49_tool_offset_parameter_program[] =
|
||||
"G21 G90 G17\n"
|
||||
"G43.2 H1\n"
|
||||
"O10 if [#<_tool_offset> EQ 1]\n"
|
||||
"G1 X1 F100\n"
|
||||
"O10 endif\n"
|
||||
"G49\n"
|
||||
"O10 if [#<_tool_offset> EQ 0]\n"
|
||||
"G1 X2 F100\n"
|
||||
"O10 endif\n"
|
||||
"M30\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
g49_tool_offset_parameter_program,
|
||||
sizeof(g49_tool_offset_parameter_program) - 1) == 0,
|
||||
cnc_sim_last_error(sim));
|
||||
bool saw_g49_tool_offset_parameter = false;
|
||||
for (const auto &event : events) {
|
||||
saw_g49_tool_offset_parameter = saw_g49_tool_offset_parameter ||
|
||||
(event.type == CNC_SIM_EVENT_LINEAR_FEED &&
|
||||
near(event.end.x, 1.0)) ||
|
||||
(event.type == CNC_SIM_EVENT_LINEAR_FEED &&
|
||||
near(event.end.x, 2.0));
|
||||
}
|
||||
ok &= expect(saw_g49_tool_offset_parameter,
|
||||
"expected G49 to clear the applied tool offset parameter before the next motion");
|
||||
|
||||
const char g43_tool_length_program[] =
|
||||
"G21 G90 G17\n"
|
||||
"G43 H1\n"
|
||||
@@ -1718,6 +1745,8 @@ int main() {
|
||||
missing_g43_h_tool_program,
|
||||
sizeof(missing_g43_h_tool_program) - 1) != 0,
|
||||
"expected LinuxCNC G43 H to reject tool numbers missing from the tool table");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Requested tool 3 not found in the tool table",
|
||||
"expected LinuxCNC missing-G43-H-tool error text");
|
||||
|
||||
const char invalid_h_word_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1826,6 +1855,8 @@ int main() {
|
||||
invalid_cutter_g53_program,
|
||||
sizeof(invalid_cutter_g53_program) - 1) != 0,
|
||||
"expected G53 to reject cutter compensation");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Cannot use g53 with cutter radius comp",
|
||||
"expected LinuxCNC G53 cutter-comp error text");
|
||||
|
||||
const char invalid_cutter_g28_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1836,6 +1867,8 @@ int main() {
|
||||
invalid_cutter_g28_program,
|
||||
sizeof(invalid_cutter_g28_program) - 1) != 0,
|
||||
"expected G28/G30 to reject cutter compensation");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Cannot use g28 or g30 with cutter radius comp",
|
||||
"expected LinuxCNC G28 cutter-comp error text");
|
||||
|
||||
const char invalid_cutter_g281_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1846,6 +1879,8 @@ int main() {
|
||||
invalid_cutter_g281_program,
|
||||
sizeof(invalid_cutter_g281_program) - 1) != 0,
|
||||
"expected G28.1/G30.1 to reject cutter compensation");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Cannot set reference point with cutter compensation in effect",
|
||||
"expected LinuxCNC G28.1 cutter-comp error text");
|
||||
|
||||
const char invalid_cutter_g92_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1856,6 +1891,8 @@ int main() {
|
||||
invalid_cutter_g92_program,
|
||||
sizeof(invalid_cutter_g92_program) - 1) != 0,
|
||||
"expected G92 to reject cutter compensation");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Cannot change axis offsets with cutter radius comp",
|
||||
"expected LinuxCNC G92 cutter-comp error text");
|
||||
|
||||
const char invalid_cutter_g64_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1866,6 +1903,8 @@ int main() {
|
||||
invalid_cutter_g64_program,
|
||||
sizeof(invalid_cutter_g64_program) - 1) != 0,
|
||||
"expected G64 to reject cutter compensation");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Cannot change control mode with cutter radius compensation on",
|
||||
"expected LinuxCNC G64 cutter-comp error text");
|
||||
|
||||
const char invalid_cutter_override_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1876,6 +1915,8 @@ int main() {
|
||||
invalid_cutter_override_program,
|
||||
sizeof(invalid_cutter_override_program) - 1) != 0,
|
||||
"expected override controls to reject cutter compensation");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Cannot disable overrides with cutter radius compensation on",
|
||||
"expected LinuxCNC M50 cutter-comp error text");
|
||||
|
||||
const char invalid_cutter_digital_output_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1886,6 +1927,8 @@ int main() {
|
||||
invalid_cutter_digital_output_program,
|
||||
sizeof(invalid_cutter_digital_output_program) - 1) != 0,
|
||||
"expected digital outputs to reject cutter compensation");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Cannot set motion output with cutter radius compensation on",
|
||||
"expected LinuxCNC M62 cutter-comp error text");
|
||||
|
||||
const char invalid_cutter_motion_digital_output_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1909,6 +1952,8 @@ int main() {
|
||||
invalid_cutter_analog_output_program,
|
||||
sizeof(invalid_cutter_analog_output_program) - 1) != 0,
|
||||
"expected analog outputs to reject cutter compensation");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Cannot set motion analog output with cutter radius compensation on",
|
||||
"expected LinuxCNC M67 cutter-comp error text");
|
||||
|
||||
const char invalid_cutter_g76_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1919,6 +1964,8 @@ int main() {
|
||||
invalid_cutter_g76_program,
|
||||
sizeof(invalid_cutter_g76_program) - 1) != 0,
|
||||
"expected G76 to reject cutter compensation");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Cannot use G76 threading cycle with cutter radius compensation on",
|
||||
"expected LinuxCNC G76 cutter-comp error text");
|
||||
|
||||
const char invalid_cutter_g98_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1929,6 +1976,9 @@ int main() {
|
||||
invalid_cutter_g98_program,
|
||||
sizeof(invalid_cutter_g98_program) - 1) != 0,
|
||||
"expected G98/G99 to reject cutter compensation");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) ==
|
||||
"Cannot change retract mode with cutter radius compensation on",
|
||||
"expected LinuxCNC G98 cutter-comp error text");
|
||||
|
||||
const char invalid_cutter_tool_change_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1940,6 +1990,8 @@ int main() {
|
||||
invalid_cutter_tool_change_program,
|
||||
sizeof(invalid_cutter_tool_change_program) - 1) != 0,
|
||||
"expected M6 to reject cutter compensation");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Cannot change tools with cutter radius compensation on",
|
||||
"expected LinuxCNC M6 cutter-comp error text");
|
||||
|
||||
const char missing_t_for_m6_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1961,6 +2013,8 @@ int main() {
|
||||
invalid_cutter_wait_input_program,
|
||||
sizeof(invalid_cutter_wait_input_program) - 1) != 0,
|
||||
"expected M66 to reject cutter compensation");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Cannot wait for digital input with cutter radius compensation on",
|
||||
"expected LinuxCNC M66 cutter-comp error text");
|
||||
|
||||
const char invalid_g431_motion_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1970,6 +2024,8 @@ int main() {
|
||||
invalid_g431_motion_program,
|
||||
sizeof(invalid_g431_motion_program) - 1) != 0,
|
||||
"expected G43.1 to reject motion on the same line");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Cannot command motion on the same line as G43.1",
|
||||
"expected LinuxCNC G43.1 same-line-motion error text");
|
||||
|
||||
const char mixed_g432_h_axis_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1979,6 +2035,8 @@ int main() {
|
||||
mixed_g432_h_axis_program,
|
||||
sizeof(mixed_g432_h_axis_program) - 1) != 0,
|
||||
"expected G43.2 to reject mixed H and axis words");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "G43.2: Can not have both H and axis words",
|
||||
"expected LinuxCNC G43.2 mixed-H-axis error text");
|
||||
|
||||
const char missing_g432_h_tool_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1988,6 +2046,8 @@ int main() {
|
||||
missing_g432_h_tool_program,
|
||||
sizeof(missing_g432_h_tool_program) - 1) != 0,
|
||||
"expected LinuxCNC G43.2 H to reject tool numbers missing from the tool table");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Requested tool 3 not found in the tool table",
|
||||
"expected LinuxCNC missing-G43.2-H-tool error text");
|
||||
|
||||
const char invalid_g432_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -1997,6 +2057,8 @@ int main() {
|
||||
invalid_g432_program,
|
||||
sizeof(invalid_g432_program) - 1) != 0,
|
||||
"expected G43.2 to require H or axis words");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "G43.2: No axes specified and H word missing",
|
||||
"expected LinuxCNC G43.2 missing-H-axis error text");
|
||||
|
||||
const char spindle_program[] =
|
||||
"G21\n"
|
||||
@@ -3769,6 +3831,9 @@ int main() {
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim, cutter_comp_cycle_program, sizeof(cutter_comp_cycle_program) - 1) != 0,
|
||||
"expected canned cycle with cutter compensation on to fail");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) ==
|
||||
"Cannot use canned cycles with cutter compensation on",
|
||||
"expected LinuxCNC canned-cycle cutter-comp error text");
|
||||
|
||||
const char missing_g73_q_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -4202,6 +4267,8 @@ int main() {
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim, recursive_subprogram, sizeof(recursive_subprogram) - 1) != 0,
|
||||
"expected recursive M98 nesting limit to fail");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Too many subroutine levels",
|
||||
"expected LinuxCNC recursive-M98 nesting-limit error text");
|
||||
|
||||
const char fanuc_subprogram_endsub_program[] =
|
||||
"G21\n"
|
||||
@@ -4650,6 +4717,24 @@ int main() {
|
||||
sizeof(out_of_range_numbered_parameter_reference) - 1) != 0,
|
||||
"expected out-of-range numbered parameter reference to fail");
|
||||
|
||||
const char zero_numbered_parameter_assignment[] =
|
||||
"#0 = 1\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
zero_numbered_parameter_assignment,
|
||||
sizeof(zero_numbered_parameter_assignment) - 1) != 0,
|
||||
"expected #0 numbered parameter assignment to fail");
|
||||
|
||||
const char zero_numbered_parameter_reference[] =
|
||||
"G21 G90\n"
|
||||
"F100\n"
|
||||
"G1 X#0\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
zero_numbered_parameter_reference,
|
||||
sizeof(zero_numbered_parameter_reference) - 1) != 0,
|
||||
"expected #0 numbered parameter reference to fail");
|
||||
|
||||
const char named_oword_subprogram[] =
|
||||
"G21 G90\n"
|
||||
"G0 X0 Y0 Z0\n"
|
||||
@@ -4792,6 +4877,72 @@ int main() {
|
||||
ok &= expect(saw_named_parameter_local, "expected local named parameter assignment in O-word call");
|
||||
ok &= expect(saw_named_parameter_global_after_call, "expected global named parameter after O-word return");
|
||||
|
||||
const char too_many_oword_call_parameters_program[] =
|
||||
"O<too_many> sub\n"
|
||||
"O<too_many> endsub\n"
|
||||
"O<too_many> call "
|
||||
"[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] "
|
||||
"[11] [12] [13] [14] [15] [16] [17] [18] [19] [20] "
|
||||
"[21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31]\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
too_many_oword_call_parameters_program,
|
||||
sizeof(too_many_oword_call_parameters_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject more than 30 O-word call parameters");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Too many subroutine parameters",
|
||||
"expected LinuxCNC too-many-O-word-call-parameters error text");
|
||||
|
||||
const char empty_oword_call_parameter_program[] =
|
||||
"O<empty_arg> sub\n"
|
||||
"O<empty_arg> endsub\n"
|
||||
"O<empty_arg> call []\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
empty_oword_call_parameter_program,
|
||||
sizeof(empty_oword_call_parameter_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject an empty O-word call parameter expression");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "No characters found in reading real value",
|
||||
"expected LinuxCNC empty-O-word-call-parameter error text");
|
||||
|
||||
const char too_many_oword_call_levels_program[] =
|
||||
"O<n1> sub\n"
|
||||
"O<n2> call\n"
|
||||
"O<n1> endsub\n"
|
||||
"O<n2> sub\n"
|
||||
"O<n3> call\n"
|
||||
"O<n2> endsub\n"
|
||||
"O<n3> sub\n"
|
||||
"O<n4> call\n"
|
||||
"O<n3> endsub\n"
|
||||
"O<n4> sub\n"
|
||||
"O<n5> call\n"
|
||||
"O<n4> endsub\n"
|
||||
"O<n5> sub\n"
|
||||
"O<n6> call\n"
|
||||
"O<n5> endsub\n"
|
||||
"O<n6> sub\n"
|
||||
"O<n7> call\n"
|
||||
"O<n6> endsub\n"
|
||||
"O<n7> sub\n"
|
||||
"O<n8> call\n"
|
||||
"O<n7> endsub\n"
|
||||
"O<n8> sub\n"
|
||||
"O<n9> call\n"
|
||||
"O<n8> endsub\n"
|
||||
"O<n9> sub\n"
|
||||
"O<n10> call\n"
|
||||
"O<n9> endsub\n"
|
||||
"O<n10> sub\n"
|
||||
"O<n10> endsub\n"
|
||||
"O<n1> call\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
too_many_oword_call_levels_program,
|
||||
sizeof(too_many_oword_call_levels_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject the tenth nested O-word call level");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Too many subroutine levels",
|
||||
"expected LinuxCNC too-many-subroutine-levels error text");
|
||||
|
||||
const char parameter_expression_assignment_program[] =
|
||||
"G20\n"
|
||||
"#<a> = 2\n"
|
||||
@@ -4939,6 +5090,9 @@ int main() {
|
||||
cutter_comp_arc_exit_program,
|
||||
sizeof(cutter_comp_arc_exit_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject arc move immediately after exiting cutter compensation");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) ==
|
||||
"The move just after exiting cutter compensation mode must be straight, not an arc",
|
||||
"expected LinuxCNC cutter-comp arc-exit error text");
|
||||
|
||||
const char abort_hot_comment_program[] =
|
||||
"#42 = 0\n"
|
||||
@@ -4970,6 +5124,9 @@ int main() {
|
||||
cutter_comp_gouging_program,
|
||||
sizeof(cutter_comp_gouging_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject straight-feed concave cutter-comp gouging");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) ==
|
||||
"Straight feed in concave corner cannot be reached by the tool without gouging",
|
||||
"expected LinuxCNC cutter-comp gouging error text");
|
||||
|
||||
const char readonly_numbered_parameter_program[] =
|
||||
"G21 G90 G17\n"
|
||||
@@ -6218,6 +6375,8 @@ int main() {
|
||||
malformed_number_program,
|
||||
sizeof(malformed_number_program) - 1) != 0,
|
||||
"expected LinuxCNC bad number format to reject malformed real values");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "bad number format (conversion failed) parsing '1.2.3'",
|
||||
"expected LinuxCNC malformed-real-value error text");
|
||||
|
||||
const char unused_p_word_program[] =
|
||||
"G21 G90\n"
|
||||
@@ -6417,6 +6576,9 @@ int main() {
|
||||
g71_rejects_cutter_comp_program,
|
||||
sizeof(g71_rejects_cutter_comp_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject G71/G72 with cutter compensation enabled");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) ==
|
||||
"G71.0 cannot be used with cutter compensation enabled",
|
||||
"expected LinuxCNC G71 cutter-comp error text");
|
||||
|
||||
const char negative_l_word_program[] =
|
||||
"G21 G90\n"
|
||||
@@ -7594,6 +7756,17 @@ int main() {
|
||||
sizeof(invalid_g62_code_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject G62 as an unknown G code");
|
||||
|
||||
const char mixed_g434_motion_program[] =
|
||||
"G21 G90\n"
|
||||
"G43.4 H7 X10\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
mixed_g434_motion_program,
|
||||
sizeof(mixed_g434_motion_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject mixed G43.4 motion as an unknown G code");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Unknown g code used",
|
||||
"expected mixed G43.4 motion to use LinuxCNC unknown-G error text");
|
||||
|
||||
const char invalid_character_program[] =
|
||||
"G21 G90\n"
|
||||
"?\n";
|
||||
@@ -8685,6 +8858,64 @@ int main() {
|
||||
missing_function_brackets_program,
|
||||
sizeof(missing_function_brackets_program) - 1) != 0,
|
||||
"expected LinuxCNC function syntax to require bracketed arguments");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Left bracket missing after unary operation name",
|
||||
"expected LinuxCNC missing-function-left-bracket error text");
|
||||
|
||||
const char missing_word_function_brackets_program[] =
|
||||
"G21 G90\n"
|
||||
"F100\n"
|
||||
"G1 XSIN30\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
missing_word_function_brackets_program,
|
||||
sizeof(missing_word_function_brackets_program) - 1) != 0,
|
||||
"expected LinuxCNC word function syntax to require bracketed arguments");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Left bracket missing after unary operation name",
|
||||
"expected LinuxCNC word missing-function-left-bracket error text");
|
||||
|
||||
const char unknown_function_word_program[] =
|
||||
"G21 G90\n"
|
||||
"F100\n"
|
||||
"G1 XFOO[1]\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
unknown_function_word_program,
|
||||
sizeof(unknown_function_word_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject unknown unary word values");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Unknown word starting with f",
|
||||
"expected LinuxCNC unknown-unary-word error text");
|
||||
|
||||
const char unknown_function_word_without_brackets_program[] =
|
||||
"G21 G90\n"
|
||||
"F100\n"
|
||||
"G1 XFOO\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
unknown_function_word_without_brackets_program,
|
||||
sizeof(unknown_function_word_without_brackets_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject unknown unbracketed unary word values");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Unknown word starting with f",
|
||||
"expected LinuxCNC unknown-unbracketed-unary-word error text");
|
||||
|
||||
const char atan_missing_slash_program[] =
|
||||
"#1 = ATAN[1]\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
atan_missing_slash_program,
|
||||
sizeof(atan_missing_slash_program) - 1) != 0,
|
||||
"expected LinuxCNC ATAN syntax to require a slash before the second argument");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Slash missing after first atan argument",
|
||||
"expected LinuxCNC missing-ATAN-slash error text");
|
||||
|
||||
const char atan_missing_second_bracket_program[] =
|
||||
"#1 = ATAN[1]/1\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
atan_missing_second_bracket_program,
|
||||
sizeof(atan_missing_second_bracket_program) - 1) != 0,
|
||||
"expected LinuxCNC ATAN syntax to require a bracketed second argument");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Left bracket missing after slash with atan",
|
||||
"expected LinuxCNC missing-ATAN-second-left-bracket error text");
|
||||
|
||||
const char negative_sqrt_program[] =
|
||||
"#1 = SQRT[-1]\n"
|
||||
@@ -8694,6 +8925,102 @@ int main() {
|
||||
negative_sqrt_program,
|
||||
sizeof(negative_sqrt_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject negative SQRT arguments");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Negative argument to sqrt",
|
||||
"expected LinuxCNC negative-SQRT error text");
|
||||
|
||||
const char zero_ln_program[] =
|
||||
"#1 = LN[0]\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
zero_ln_program,
|
||||
sizeof(zero_ln_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject zero LN arguments");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Zero or negative argument to ln",
|
||||
"expected LinuxCNC zero-LN error text");
|
||||
|
||||
const char out_of_range_acos_program[] =
|
||||
"#1 = ACOS[2]\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
out_of_range_acos_program,
|
||||
sizeof(out_of_range_acos_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject ACOS arguments outside [-1, 1]");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Argument to acos out of range",
|
||||
"expected LinuxCNC out-of-range-ACOS error text");
|
||||
|
||||
const char out_of_range_asin_program[] =
|
||||
"#1 = ASIN[2]\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
out_of_range_asin_program,
|
||||
sizeof(out_of_range_asin_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject ASIN arguments outside [-1, 1]");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Argument to asin out of range",
|
||||
"expected LinuxCNC out-of-range-ASIN error text");
|
||||
|
||||
const char negative_fractional_power_program[] =
|
||||
"#1 = [-2 ** 0.5]\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
negative_fractional_power_program,
|
||||
sizeof(negative_fractional_power_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject a negative base raised to a non-integer power");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Attempt to raise negative to non integer power",
|
||||
"expected LinuxCNC negative-fractional-power error text");
|
||||
|
||||
const char divide_by_zero_program[] =
|
||||
"#1 = [1 / 0]\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
divide_by_zero_program,
|
||||
sizeof(divide_by_zero_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject division by zero");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Attempt to divide by zero",
|
||||
"expected LinuxCNC divide-by-zero error text");
|
||||
|
||||
const char modulo_by_zero_program[] =
|
||||
"#1 = [1 MOD 0]\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
modulo_by_zero_program,
|
||||
sizeof(modulo_by_zero_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject modulo by zero");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Calculation resulted in 'not a number'",
|
||||
"expected LinuxCNC modulo-by-zero error text");
|
||||
|
||||
const char unknown_n_operation_program[] =
|
||||
"#1 = [1 NAND 1]\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
unknown_n_operation_program,
|
||||
sizeof(unknown_n_operation_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject unknown n-starting binary operation names");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Unknown operation name starting with n",
|
||||
"expected LinuxCNC unknown-n-operation error text");
|
||||
|
||||
const char unknown_word_bracket_operation_program[] =
|
||||
"G21 G90\n"
|
||||
"F100\n"
|
||||
"G1 X[1 AXX 1]\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
unknown_word_bracket_operation_program,
|
||||
sizeof(unknown_word_bracket_operation_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject unknown word bracket binary operation names");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Unknown operation name starting with a",
|
||||
"expected LinuxCNC unknown-word-bracket-operation error text");
|
||||
|
||||
const char unknown_symbol_word_bracket_operation_program[] =
|
||||
"G21 G90\n"
|
||||
"F100\n"
|
||||
"G1 X[1 ? 2]\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
unknown_symbol_word_bracket_operation_program,
|
||||
sizeof(unknown_symbol_word_bracket_operation_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject unknown symbolic word bracket operations");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Unknown operation",
|
||||
"expected LinuxCNC unknown-symbol-word-bracket-operation error text");
|
||||
|
||||
const char infinite_expression_program[] =
|
||||
"#1 = EXP[1000]\n"
|
||||
@@ -8703,6 +9030,8 @@ int main() {
|
||||
infinite_expression_program,
|
||||
sizeof(infinite_expression_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject infinite expression results");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Calculation resulted in 'infinity'",
|
||||
"expected LinuxCNC infinite-expression error text");
|
||||
|
||||
const char hidden_infinite_expression_program[] =
|
||||
"O10 if [EXP[1000] EQ EXP[1000]]\n"
|
||||
@@ -8723,6 +9052,8 @@ int main() {
|
||||
hidden_infinite_bracket_expression_program,
|
||||
sizeof(hidden_infinite_bracket_expression_program) - 1) != 0,
|
||||
"expected LinuxCNC to reject infinite bracket expression values before comparison");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Calculation resulted in 'infinity'",
|
||||
"expected LinuxCNC infinite-bracket-expression error text");
|
||||
|
||||
const char spaced_function_bracket_program[] =
|
||||
"G21 G90\n"
|
||||
@@ -9714,6 +10045,56 @@ int main() {
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Unknown m code used: M98",
|
||||
"expected smoke comment-prefixed M98 error text");
|
||||
|
||||
const char oword_if_missing_bracket_program[] =
|
||||
"O100 if\n"
|
||||
"G1 X1\n"
|
||||
"O100 endif\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
oword_if_missing_bracket_program,
|
||||
sizeof(oword_if_missing_bracket_program) - 1) != 0,
|
||||
"expected LinuxCNC O-word if without a bracketed condition to fail");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Left bracket missing after 'if'",
|
||||
"expected LinuxCNC missing-O-word-if-left-bracket error text");
|
||||
|
||||
const char oword_while_missing_bracket_program[] =
|
||||
"O100 while\n"
|
||||
"G1 X1\n"
|
||||
"O100 endwhile\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
oword_while_missing_bracket_program,
|
||||
sizeof(oword_while_missing_bracket_program) - 1) != 0,
|
||||
"expected LinuxCNC O-word while without a bracketed condition to fail");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Left bracket missing after 'while'",
|
||||
"expected LinuxCNC missing-O-word-while-left-bracket error text");
|
||||
|
||||
const char oword_repeat_missing_bracket_program[] =
|
||||
"O100 repeat\n"
|
||||
"G1 X1\n"
|
||||
"O100 endrepeat\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
oword_repeat_missing_bracket_program,
|
||||
sizeof(oword_repeat_missing_bracket_program) - 1) != 0,
|
||||
"expected LinuxCNC O-word repeat without a bracketed count to fail");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Left bracket missing after 'repeat'",
|
||||
"expected LinuxCNC missing-O-word-repeat-left-bracket error text");
|
||||
|
||||
const char oword_elseif_missing_bracket_program[] =
|
||||
"O100 if [0]\n"
|
||||
"G1 X1\n"
|
||||
"O100 elseif\n"
|
||||
"G1 X2\n"
|
||||
"O100 endif\n";
|
||||
events.clear();
|
||||
ok &= expect(cnc_sim_parse_program(sim,
|
||||
oword_elseif_missing_bracket_program,
|
||||
sizeof(oword_elseif_missing_bracket_program) - 1) != 0,
|
||||
"expected LinuxCNC O-word elseif without a bracketed condition to fail");
|
||||
ok &= expect(std::string(cnc_sim_last_error(sim)) == "Left bracket missing after 'elseif'",
|
||||
"expected LinuxCNC missing-O-word-elseif-left-bracket error text");
|
||||
|
||||
const char oword_if_extra_gcode_program[] =
|
||||
"O100 if [1] G1 X1\n"
|
||||
"O100 endif\n"
|
||||
|
||||
1235
core/tests/linuxcnc_gees_table_smoke.cpp
Normal file
1235
core/tests/linuxcnc_gees_table_smoke.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -63,5 +63,13 @@ int main() {
|
||||
const CncSimPose roundtrip = rtcp_tool_tip_from_pivot(pivot, 123.4);
|
||||
ok &= expect_pose_near(roundtrip, tip, "RTCP pivot/tool-tip roundtrip");
|
||||
|
||||
tip = {};
|
||||
tip.a = 90.0;
|
||||
tip.b = 90.0;
|
||||
const RtcpVector vector = rtcp_tool_vector_from_pose(tip, 10.0);
|
||||
ok &= expect_near(vector.x, 0.0, "A90 B90 tool vector x");
|
||||
ok &= expect_near(vector.y, 10.0, "A90 B90 tool vector y");
|
||||
ok &= expect_near(vector.z, 0.0, "A90 B90 tool vector z");
|
||||
|
||||
return ok ? 0 : 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user