diff --git a/test-all-native.sh b/test-all-native.sh index 10e69af..8b6ee28 100755 --- a/test-all-native.sh +++ b/test-all-native.sh @@ -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 \ diff --git a/test-linuxcnc-source-link.sh b/test-linuxcnc-source-link.sh index 84b3b07..1fa62ba 100755 --- a/test-linuxcnc-source-link.sh +++ b/test-linuxcnc-source-link.sh @@ -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" diff --git a/tests/gcode/linuxcnc_extended_linenumbers.ngc b/tests/gcode/linuxcnc_extended_linenumbers.ngc new file mode 100644 index 0000000..bb7b76c --- /dev/null +++ b/tests/gcode/linuxcnc_extended_linenumbers.ngc @@ -0,0 +1,4 @@ +N000001 S111 +N100000 S222 +N123456789 S333 +M2