diff --git a/test-linuxcnc-source-link.sh b/test-linuxcnc-source-link.sh index e296985..7e3c139 100755 --- a/test-linuxcnc-source-link.sh +++ b/test-linuxcnc-source-link.sh @@ -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 = [ ( diff --git a/test-native.sh b/test-native.sh index cbaf2c6..12b4dc5 100755 --- a/test-native.sh +++ b/test-native.sh @@ -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 diff --git a/tests/gcode/linuxcnc_polar_coordinate_variants.ngc b/tests/gcode/linuxcnc_polar_coordinate_variants.ngc new file mode 100644 index 0000000..7164356 --- /dev/null +++ b/tests/gcode/linuxcnc_polar_coordinate_variants.ngc @@ -0,0 +1,8 @@ +G21 G90 G17 +G0 X3 Y4 +G1 @10 F100 +G1 ^0 +G91 +G1 @5 +G1 ^90 +M30