继续按 align-linuxcnc 约束:补极坐标变体源码覆盖,测试通过

This commit is contained in:
cnc
2026-06-02 22:20:03 +08:00
parent 84fdc8a1c5
commit 030074b8c5
3 changed files with 31 additions and 0 deletions

View File

@@ -555,6 +555,9 @@ CNC_SIM_RS274_VAR="$var_file" \
CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_polar_coordinates.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_polar_coordinates.json"
CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_polar_coordinate_variants.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_polar_coordinate_variants.json"
polar_coordinate_error_cases=(
"linuxcnc_polar_g18_error|Cannot use polar coordinate except in G17 plane"
"linuxcnc_polar_with_x_error|Cannot specify both polar coordinate and X word"
@@ -2122,6 +2125,25 @@ if len(polar_linear_events) != len(expected_polar_linear_ends) or any(
]
raise SystemExit(f"unexpected source-linked polar-coordinate endpoints: {polar_linear_ends!r}")
polar_coordinate_variants = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_polar_coordinate_variants.json").read_text())
polar_variant_linear_events = [
event
for event in polar_coordinate_variants
if event["type"] == "linear-feed"
]
expected_polar_variant_ends = [(3, 6, 8), (4, 10, 0), (6, 15, 0), (7, 0, 15)]
if len(polar_variant_linear_events) != len(expected_polar_variant_ends) or any(
event["line"] != line or
abs(event["end"]["x"] - x) > 1e-9 or
abs(event["end"]["y"] - y) > 1e-9
for event, (line, x, y) in zip(polar_variant_linear_events, expected_polar_variant_ends)
):
polar_variant_linear_ends = [
(event["line"], event["end"]["x"], event["end"]["y"])
for event in polar_variant_linear_events
]
raise SystemExit(f"unexpected source-linked polar-coordinate variant endpoints: {polar_variant_linear_ends!r}")
predefined = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_predefined_positions.json").read_text())
predefined_rapids = [
(

View File

@@ -147,6 +147,7 @@ grep -F 'tests/gcode/linuxcnc_lathe_diameter_g76.ngc' docs/linuxcnc-porting.md >
grep -F 'missing source-linked G7 diameter-mode G76 final threading pass' 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
grep -F 'enhance_block() assigns motion_to_be' test-linuxcnc-source-link.sh >/dev/null
grep -F 'linuxcnc_g80_axis_error|Cannot use axis values with g80' test-linuxcnc-source-link.sh >/dev/null
grep -F 'lookup_named_param()' test-linuxcnc-rs274-native.sh >/dev/null

View File

@@ -0,0 +1,8 @@
G21 G90 G17
G0 X3 Y4
G1 @10 F100
G1 ^0
G91
G1 @5
G1 ^90
M30