参考所有分组:补 extended N 行号 source 覆盖,测试通过

This commit is contained in:
cnc
2026-06-03 08:41:44 +08:00
parent 1b16d3e0b5
commit 2f7a46758b
3 changed files with 23 additions and 1 deletions

View File

@@ -562,6 +562,7 @@ grep -F 'tests/gcode/linuxcnc_lathe_diameter_g76.ngc' test-native.sh >/dev/null
grep -F 'tests/gcode/linuxcnc_readonly_named_parameters.ngc' test-native.sh >/dev/null
grep -F 'read_n_number()' test-linuxcnc-source-link.sh >/dev/null
grep -F 'tests/gcode/linuxcnc_fractional_linenumbers.ngc' test-linuxcnc-source-link.sh >/dev/null
grep -F 'tests/gcode/linuxcnc_extended_linenumbers.ngc' test-linuxcnc-source-link.sh >/dev/null
for script in \
test-native.sh \

View File

@@ -1485,12 +1485,16 @@ CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_g62_xz_nurbs.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_g62_xz_nurbs.json"
# Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc read_n_number()
# accepts and ignores the fractional suffix after an N word; execute_block()
# accepts and ignores the fractional suffix after an N word, preserves leading
# zero line numbers, and has the >99999 range check disabled; execute_block()
# in src/emc/rs274ngc/interp_execute.cc still tags canon output with the
# interpreter sequence number.
CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_fractional_linenumbers.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_fractional_linenumbers.json"
CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_extended_linenumbers.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_extended_linenumbers.json"
CNC_SIM_RS274_SOURCE_OUTPUT_DIR="$output_dir" python3 - <<'PY'
import json
@@ -1540,6 +1544,18 @@ if fractional_spindle_states[:3] != [(1, 300), (2, 600), (3, 1200)]:
f"{fractional_spindle_states!r}"
)
extended_linenumbers = load("cnc_sim_linuxcnc_source_extended_linenumbers.json")
extended_spindle_states = [
(event["line"], event["spindle"])
for event in extended_linenumbers
if event["type"] == "set-spindle"
]
if extended_spindle_states[:3] != [(1, 111), (2, 222), (3, 333)]:
raise SystemExit(
"unexpected source-linked extended N-word spindle sequence: "
f"{extended_spindle_states!r}"
)
block_delete_off = load("cnc_sim_linuxcnc_source_block_delete_off.json")
if not any(
event["type"] == "linear-feed" and event["line"] == 2 and event["end"]["x"] == 5
@@ -3427,3 +3443,4 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_source_g52_offset.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_g52_xz_nurbs.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_g62_xz_nurbs.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_fractional_linenumbers.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_extended_linenumbers.json"

View File

@@ -0,0 +1,4 @@
N000001 S111
N100000 S222
N123456789 S333
M2