参考所有分组:补 G10 source 覆盖,测试通过
This commit is contained in:
@@ -217,7 +217,12 @@ check_g_code_error_cases=(
|
|||||||
"linuxcnc_g10_invalid_l_error|Line with G10 does not have L0, L1, L10, L11, L2, or L20"
|
"linuxcnc_g10_invalid_l_error|Line with G10 does not have L0, L1, L10, L11, L2, or L20"
|
||||||
"linuxcnc_g10_p_non_integer_error|P value not an integer with G10"
|
"linuxcnc_g10_p_non_integer_error|P value not an integer with G10"
|
||||||
"linuxcnc_g10_l2_p_out_of_range_error|P value out of range (0-9) with G10 L2"
|
"linuxcnc_g10_l2_p_out_of_range_error|P value out of range (0-9) with G10 L2"
|
||||||
|
"linuxcnc_g10_l2_p_missing_error|P value out of range (0-9) with G10 L2"
|
||||||
|
"linuxcnc_g10_l20_p_out_of_range_error|P value out of range (0-9) with G10 L20"
|
||||||
|
"linuxcnc_g10_l20_p_missing_error|P value out of range (0-9) with G10 L20"
|
||||||
"linuxcnc_g10_l1_p_out_of_range_error|P value out of range with G10 L1"
|
"linuxcnc_g10_l1_p_out_of_range_error|P value out of range with G10 L1"
|
||||||
|
"linuxcnc_g10_l10_p_out_of_range_error|P value out of range with G10 L10"
|
||||||
|
"linuxcnc_g10_l11_p_out_of_range_error|P value out of range with G10 L11"
|
||||||
"linuxcnc_g53_arc_error|Must use g0 or g1 with g53"
|
"linuxcnc_g53_arc_error|Must use g0 or g1 with g53"
|
||||||
"linuxcnc_g53_incremental_error|Cannot use g53 incremental"
|
"linuxcnc_g53_incremental_error|Cannot use g53 incremental"
|
||||||
)
|
)
|
||||||
@@ -232,6 +237,26 @@ for case in "${check_g_code_error_cases[@]}"; do
|
|||||||
fi
|
fi
|
||||||
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_$fixture.err"
|
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_$fixture.err"
|
||||||
done
|
done
|
||||||
|
# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc
|
||||||
|
# convert_setup() rejects disallowed G10 L2/L20 words, and
|
||||||
|
# convert_tool_table() rejects G10 L1 table updates without offsets.
|
||||||
|
g10_convert_error_cases=(
|
||||||
|
"linuxcnc_g10_l1_without_offsets_error|G10 L1 without offsets has no effect"
|
||||||
|
"linuxcnc_g10_l2_i_word_error|I J words not allowed with G10 L2"
|
||||||
|
"linuxcnc_g10_l20_i_word_error|I J words not allowed with G10 L2"
|
||||||
|
"linuxcnc_g10_l20_r_word_error|R not allowed in G10 L20"
|
||||||
|
)
|
||||||
|
for case in "${g10_convert_error_cases[@]}"; do
|
||||||
|
fixture=${case%%|*}
|
||||||
|
expected=${case#*|}
|
||||||
|
if CNC_SIM_RS274_VAR="$var_file" \
|
||||||
|
"$build_dir/linuxcnc_rs274_dump" "tests/gcode/$fixture.ngc" \
|
||||||
|
>"$output_dir/cnc_sim_linuxcnc_$fixture.json" 2>"$output_dir/cnc_sim_linuxcnc_$fixture.err"; then
|
||||||
|
echo "expected $fixture.ngc to fail" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_$fixture.err"
|
||||||
|
done
|
||||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc
|
# Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc
|
||||||
# read_g()/read_m() validate numeric range, known code tables from
|
# read_g()/read_m() validate numeric range, known code tables from
|
||||||
# interp_array.cc, and same-modal-group conflicts while filling a block.
|
# interp_array.cc, and same-modal-group conflicts while filling a block.
|
||||||
|
|||||||
@@ -661,7 +661,12 @@ check_g_code_error_cases=(
|
|||||||
"linuxcnc_g10_invalid_l_error|Line with G10 does not have L0, L1, L10, L11, L2, or L20"
|
"linuxcnc_g10_invalid_l_error|Line with G10 does not have L0, L1, L10, L11, L2, or L20"
|
||||||
"linuxcnc_g10_p_non_integer_error|P value not an integer with G10"
|
"linuxcnc_g10_p_non_integer_error|P value not an integer with G10"
|
||||||
"linuxcnc_g10_l2_p_out_of_range_error|P value out of range (0-9) with G10 L2"
|
"linuxcnc_g10_l2_p_out_of_range_error|P value out of range (0-9) with G10 L2"
|
||||||
|
"linuxcnc_g10_l2_p_missing_error|P value out of range (0-9) with G10 L2"
|
||||||
|
"linuxcnc_g10_l20_p_out_of_range_error|P value out of range (0-9) with G10 L20"
|
||||||
|
"linuxcnc_g10_l20_p_missing_error|P value out of range (0-9) with G10 L20"
|
||||||
"linuxcnc_g10_l1_p_out_of_range_error|P value out of range with G10 L1"
|
"linuxcnc_g10_l1_p_out_of_range_error|P value out of range with G10 L1"
|
||||||
|
"linuxcnc_g10_l10_p_out_of_range_error|P value out of range with G10 L10"
|
||||||
|
"linuxcnc_g10_l11_p_out_of_range_error|P value out of range with G10 L11"
|
||||||
"linuxcnc_g53_arc_error|Must use g0 or g1 with g53"
|
"linuxcnc_g53_arc_error|Must use g0 or g1 with g53"
|
||||||
"linuxcnc_g53_incremental_error|Cannot use g53 incremental"
|
"linuxcnc_g53_incremental_error|Cannot use g53 incremental"
|
||||||
)
|
)
|
||||||
@@ -676,6 +681,26 @@ for case in "${check_g_code_error_cases[@]}"; do
|
|||||||
fi
|
fi
|
||||||
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err"
|
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err"
|
||||||
done
|
done
|
||||||
|
# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc
|
||||||
|
# convert_setup() rejects disallowed G10 L2/L20 words, and
|
||||||
|
# convert_tool_table() rejects G10 L1 table updates without offsets.
|
||||||
|
g10_convert_error_cases=(
|
||||||
|
"linuxcnc_g10_l1_without_offsets_error|G10 L1 without offsets has no effect"
|
||||||
|
"linuxcnc_g10_l2_i_word_error|I J words not allowed with G10 L2"
|
||||||
|
"linuxcnc_g10_l20_i_word_error|I J words not allowed with G10 L2"
|
||||||
|
"linuxcnc_g10_l20_r_word_error|R not allowed in G10 L20"
|
||||||
|
)
|
||||||
|
for case in "${g10_convert_error_cases[@]}"; do
|
||||||
|
fixture=${case%%|*}
|
||||||
|
expected=${case#*|}
|
||||||
|
if CNC_SIM_RS274_VAR="$var_file" \
|
||||||
|
"$build_dir/linuxcnc_rs274_source_dump" "tests/gcode/$fixture.ngc" \
|
||||||
|
>"$output_dir/cnc_sim_linuxcnc_source_$fixture.json" 2>"$output_dir/cnc_sim_linuxcnc_source_$fixture.err"; then
|
||||||
|
echo "expected $fixture.ngc to fail" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err"
|
||||||
|
done
|
||||||
CNC_SIM_RS274_VAR="$var_file" \
|
CNC_SIM_RS274_VAR="$var_file" \
|
||||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_predefined_positions.ngc \
|
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_predefined_positions.ngc \
|
||||||
>"$output_dir/cnc_sim_linuxcnc_source_predefined_positions.json"
|
>"$output_dir/cnc_sim_linuxcnc_source_predefined_positions.json"
|
||||||
|
|||||||
2
tests/gcode/linuxcnc_g10_l10_p_out_of_range_error.ngc
Normal file
2
tests/gcode/linuxcnc_g10_l10_p_out_of_range_error.ngc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
G21 G90
|
||||||
|
G10 L10 P0 X0
|
||||||
2
tests/gcode/linuxcnc_g10_l11_p_out_of_range_error.ngc
Normal file
2
tests/gcode/linuxcnc_g10_l11_p_out_of_range_error.ngc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
G21 G90
|
||||||
|
G10 L11 P0 X0
|
||||||
2
tests/gcode/linuxcnc_g10_l1_without_offsets_error.ngc
Normal file
2
tests/gcode/linuxcnc_g10_l1_without_offsets_error.ngc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
G21 G90
|
||||||
|
G10 L1 P1
|
||||||
2
tests/gcode/linuxcnc_g10_l20_i_word_error.ngc
Normal file
2
tests/gcode/linuxcnc_g10_l20_i_word_error.ngc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
G21 G90
|
||||||
|
G10 L20 P1 I2
|
||||||
2
tests/gcode/linuxcnc_g10_l20_p_missing_error.ngc
Normal file
2
tests/gcode/linuxcnc_g10_l20_p_missing_error.ngc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
G21 G90
|
||||||
|
G10 L20 X1
|
||||||
2
tests/gcode/linuxcnc_g10_l20_p_out_of_range_error.ngc
Normal file
2
tests/gcode/linuxcnc_g10_l20_p_out_of_range_error.ngc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
G21 G90
|
||||||
|
G10 L20 P10 X1
|
||||||
2
tests/gcode/linuxcnc_g10_l20_r_word_error.ngc
Normal file
2
tests/gcode/linuxcnc_g10_l20_r_word_error.ngc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
G21 G90
|
||||||
|
G10 L20 P1 X1 R30
|
||||||
2
tests/gcode/linuxcnc_g10_l2_i_word_error.ngc
Normal file
2
tests/gcode/linuxcnc_g10_l2_i_word_error.ngc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
G21 G90
|
||||||
|
G10 L2 P1 X1 I2
|
||||||
2
tests/gcode/linuxcnc_g10_l2_p_missing_error.ngc
Normal file
2
tests/gcode/linuxcnc_g10_l2_p_missing_error.ngc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
G21 G90
|
||||||
|
G10 L2 X1
|
||||||
Reference in New Issue
Block a user