继续按 align-linuxcnc 约束:补螺纹转换错误源码覆盖,测试通过

This commit is contained in:
cnc
2026-06-02 20:15:04 +08:00
parent cde0bdaba6
commit 868f20382a
12 changed files with 65 additions and 1 deletions

View File

@@ -857,6 +857,33 @@ for case in "${threading_check_error_cases[@]}"; do
fi
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err"
done
# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc
# convert_straight() and convert_threading_cycle() reject invalid
# spindle state/selector, rotary-axis motion, and G76 I/J/K geometry
# before issuing synchronized threading motion.
threading_convert_error_cases=(
"linuxcnc_g33_stopped_spindle_error|Spindle not turning in G33"
"linuxcnc_g33_1_stopped_spindle_error|Spindle not turning in G33.1"
"linuxcnc_g33_spindle_dollar_out_of_range_error|Invalid spindle (\$) number in G33 move"
"linuxcnc_g33_1_spindle_dollar_out_of_range_error|Invalid spindle (\$) number in G33.1 move"
"linuxcnc_g76_spindle_dollar_out_of_range_error|Invalid D-number in G76 cycle"
"linuxcnc_g76_stopped_spindle_error|Chosen spindle (0) not turning in G76"
"linuxcnc_g76_rotary_axis_error|Cannot move rotary axes with G76"
"linuxcnc_g76_i_zero_error|In G76, I must not be 0"
"linuxcnc_g76_j_zero_error|In G76, J must be greater than 0"
"linuxcnc_g76_k_less_equal_j_error|In G76, K must be greater than J"
)
for case in "${threading_convert_error_cases[@]}"; do
fixture=${case%%|*}
expected=${case#*|}
if CNC_SIM_RS274_FILE_MODE=1 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
# Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc
# read_items() only consumes a leading N word before item dispatch;
# read_one_item() then uses the default reader table from interp_array.cc