参考所有分组:补 read_text native 覆盖,测试通过
This commit is contained in:
@@ -287,6 +287,37 @@ for case in "${bad_character_error_cases[@]}"; do
|
||||
fi
|
||||
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_$fixture.err"
|
||||
done
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc read_text()
|
||||
# rejects EOF without the matching percent/program end and overlong file
|
||||
# lines; read_n_number() rejects malformed N-line numbers through
|
||||
# read_integer_unsigned().
|
||||
read_text_error_cases=(
|
||||
"linuxcnc_file_ended_no_program_end_error|File ended with no percent sign"
|
||||
"linuxcnc_file_ended_no_percent_error|File ended with no percent sign"
|
||||
"linuxcnc_bad_n_number_format_error|Bad format unsigned integer"
|
||||
)
|
||||
for case in "${read_text_error_cases[@]}"; do
|
||||
fixture=${case%%|*}
|
||||
expected=${case#*|}
|
||||
if CNC_SIM_RS274_FILE_MODE=1 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
|
||||
long_line_fixture="$output_dir/linuxcnc_command_too_long_error.ngc"
|
||||
printf 'G1 X' > "$long_line_fixture"
|
||||
printf '1%.0s' {1..260} >> "$long_line_fixture"
|
||||
printf '\n' >> "$long_line_fixture"
|
||||
if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_dump" "$long_line_fixture" \
|
||||
>"$output_dir/cnc_sim_linuxcnc_command_too_long_error.json" 2>"$output_dir/cnc_sim_linuxcnc_command_too_long_error.err"; then
|
||||
echo "expected linuxcnc_command_too_long_error.ngc to fail" >&2
|
||||
exit 1
|
||||
fi
|
||||
grep -Fq "Command too long" "$output_dir/cnc_sim_linuxcnc_command_too_long_error.err"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_check.cc
|
||||
# check_m_codes() rejects blocks with more than MAX_EMS M-codes.
|
||||
if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||
|
||||
Reference in New Issue
Block a user