继续按 align-linuxcnc 约束:补工具长度错误源码覆盖,测试通过
This commit is contained in:
@@ -289,6 +289,27 @@ CNC_SIM_RS274_VAR="$var_file" \
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_dynamic_tool_length.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_dynamic_tool_length.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc
|
||||
# convert_tool_length_offset() rejects invalid G43.2 H/axis combinations,
|
||||
# and src/emc/rs274ngc/interp_find.cc find_tool_index() rejects H tool
|
||||
# numbers missing from the LinuxCNC tooldata table.
|
||||
tool_length_offset_error_cases=(
|
||||
"linuxcnc_g43_missing_tool_error|Requested tool 99 not found in the tool table"
|
||||
"linuxcnc_g43_2_missing_tool_error|Requested tool 99 not found in the tool table"
|
||||
"linuxcnc_g43_2_h_axis_error|G43.2: Can not have both H and axis words"
|
||||
"linuxcnc_g43_2_missing_h_axis_error|G43.2: No axes specified and H word missing"
|
||||
)
|
||||
for case in "${tool_length_offset_error_cases[@]}"; do
|
||||
fixture=${case%%|*}
|
||||
expected=${case#*|}
|
||||
if CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" "tests/gcode/$fixture.ngc" \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_$fixture.json" 2>"$output_dir/cnc_sim_linuxcnc_source_$fixture.err"; then
|
||||
echo "expected $fixture.ngc to fail" >&2
|
||||
exit 1
|
||||
fi
|
||||
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err"
|
||||
done
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_canned_cycle.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_canned_cycle.json"
|
||||
|
||||
@@ -145,6 +145,8 @@ grep -F 'convert_lathe_diameter_mode() scales G7/G8 X words and G76 I/J/K words'
|
||||
grep -F 'tests/gcode/linuxcnc_lathe_diameter_mode.ngc' docs/linuxcnc-porting.md >/dev/null
|
||||
grep -F 'tests/gcode/linuxcnc_lathe_diameter_g76.ngc' docs/linuxcnc-porting.md >/dev/null
|
||||
grep -F 'missing source-linked G7 diameter-mode G76 final threading pass' test-linuxcnc-source-link.sh >/dev/null
|
||||
grep -F 'convert_tool_length_offset() rejects invalid G43.2 H/axis combinations' test-linuxcnc-source-link.sh >/dev/null
|
||||
grep -F 'linuxcnc_g43_2_missing_h_axis_error|G43.2: No axes specified and H word missing' test-linuxcnc-source-link.sh >/dev/null
|
||||
grep -F 'read_atsign()' test-linuxcnc-source-link.sh >/dev/null
|
||||
grep -F 'tests/gcode/linuxcnc_polar_coordinates.ngc' test-linuxcnc-source-link.sh >/dev/null
|
||||
grep -F 'tests/gcode/linuxcnc_polar_coordinate_variants.ngc' test-linuxcnc-source-link.sh >/dev/null
|
||||
|
||||
3
tests/gcode/linuxcnc_g43_2_h_axis_error.ngc
Normal file
3
tests/gcode/linuxcnc_g43_2_h_axis_error.ngc
Normal file
@@ -0,0 +1,3 @@
|
||||
G21 G90 G17
|
||||
G43.2 H1 X1
|
||||
M30
|
||||
3
tests/gcode/linuxcnc_g43_2_missing_h_axis_error.ngc
Normal file
3
tests/gcode/linuxcnc_g43_2_missing_h_axis_error.ngc
Normal file
@@ -0,0 +1,3 @@
|
||||
G21 G90 G17
|
||||
G43.2
|
||||
M30
|
||||
3
tests/gcode/linuxcnc_g43_2_missing_tool_error.ngc
Normal file
3
tests/gcode/linuxcnc_g43_2_missing_tool_error.ngc
Normal file
@@ -0,0 +1,3 @@
|
||||
G21 G90 G17
|
||||
G43.2 H99
|
||||
M30
|
||||
3
tests/gcode/linuxcnc_g43_missing_tool_error.ngc
Normal file
3
tests/gcode/linuxcnc_g43_missing_tool_error.ngc
Normal file
@@ -0,0 +1,3 @@
|
||||
G21 G90 G17
|
||||
G43 H99
|
||||
M30
|
||||
Reference in New Issue
Block a user