参考所有分组:补 G4 dwell source 边界覆盖,测试通过
This commit is contained in:
@@ -545,6 +545,10 @@ for case in "${tool_number_error_cases[@]}"; do
|
||||
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_$fixture.err"
|
||||
done
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_program_stops.ngc >"$output_dir/cnc_sim_linuxcnc_program_stops.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_check.cc treats exactly
|
||||
# P-1.0 as a missing G4 dwell P word, while interp_convert.cc convert_dwell()
|
||||
# and interp_queue.cc enqueue_DWELL() pass neighboring values through.
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_g4_dwell_boundaries.ngc >"$output_dir/cnc_sim_linuxcnc_g4_dwell_boundaries.json"
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_coolant.ngc >"$output_dir/cnc_sim_linuxcnc_coolant.json"
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_feed_modes.ngc >"$output_dir/cnc_sim_linuxcnc_feed_modes.json"
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_motion_modes.ngc >"$output_dir/cnc_sim_linuxcnc_motion_modes.json"
|
||||
@@ -1366,6 +1370,16 @@ for expected in [(2, 1), (3, 2), (4, 3), (4, 1), (5, 0)]:
|
||||
if expected not in stop_states:
|
||||
raise SystemExit(f"missing program stop state {expected!r}")
|
||||
|
||||
g4_boundaries = load("cnc_sim_linuxcnc_g4_dwell_boundaries.json")
|
||||
g4_dwell_states = [
|
||||
(event["line"], event["dwellSeconds"])
|
||||
for event in g4_boundaries
|
||||
if event["type"] == "dwell"
|
||||
]
|
||||
expected_g4_dwell_states = [(4, -1.001), (5, -0.9999), (6, 3)]
|
||||
if g4_dwell_states != expected_g4_dwell_states:
|
||||
raise SystemExit(f"unexpected G4 dwell boundary states: {g4_dwell_states!r}")
|
||||
|
||||
coolant = load("cnc_sim_linuxcnc_coolant.json")
|
||||
coolant_states = [
|
||||
(event["line"], event["reserved"])
|
||||
|
||||
@@ -298,6 +298,12 @@ done
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_program_stops.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_program_stops.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_check.cc treats exactly
|
||||
# P-1.0 as a missing G4 dwell P word, while interp_convert.cc convert_dwell()
|
||||
# and interp_queue.cc enqueue_DWELL() pass neighboring values through.
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_g4_dwell_boundaries.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_g4_dwell_boundaries.json"
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_coolant.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_coolant.json"
|
||||
@@ -1916,6 +1922,16 @@ for expected in [(2, 1), (3, 2), (4, 3), (4, 1), (5, 0)]:
|
||||
if expected not in stop_states:
|
||||
raise SystemExit(f"missing source-linked program stop state {expected!r}")
|
||||
|
||||
g4_boundaries = load("cnc_sim_linuxcnc_source_g4_dwell_boundaries.json")
|
||||
g4_dwell_states = [
|
||||
(event["line"], event["dwellSeconds"])
|
||||
for event in g4_boundaries
|
||||
if event["type"] == "dwell"
|
||||
]
|
||||
expected_g4_dwell_states = [(4, -1.001), (5, -0.9999), (6, 3)]
|
||||
if g4_dwell_states != expected_g4_dwell_states:
|
||||
raise SystemExit(f"unexpected source-linked G4 dwell boundary states: {g4_dwell_states!r}")
|
||||
|
||||
coolant = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_coolant.json").read_text())
|
||||
coolant_states = [
|
||||
(event["line"], event["reserved"])
|
||||
|
||||
6
tests/gcode/linuxcnc_g4_dwell_boundaries.ngc
Normal file
6
tests/gcode/linuxcnc_g4_dwell_boundaries.ngc
Normal file
@@ -0,0 +1,6 @@
|
||||
G21 G90
|
||||
(Source basis: LinuxCNC src/emc/rs274ngc/interp_check.cc check_g_codes only treats P-1.0 as missing for G4.)
|
||||
(Source basis: src/emc/rs274ngc/interp_convert.cc convert_dwell passes other P values to DWELL unchanged.)
|
||||
G4 P-1.001
|
||||
G4 P-0.9999
|
||||
G4 P-2 P3
|
||||
Reference in New Issue
Block a user