improve tester
This commit is contained in:
16
tester.sh
16
tester.sh
@@ -30,7 +30,8 @@ RESET="\e[0m"
|
||||
|
||||
NAME="computor"
|
||||
BINARY="./$NAME"
|
||||
#SKIP_REDUCED=true
|
||||
SKIP_REDUCED=true
|
||||
SKIP_SOLUTION=true
|
||||
|
||||
if [[ ! -x "$BINARY" ]]; then
|
||||
|
||||
@@ -61,6 +62,19 @@ run_test() {
|
||||
expected=$(echo "$expected" | grep -v "Reduced form:")
|
||||
fi
|
||||
|
||||
# If SKIP_SOLUTION is true, remove all lines after the 2nd line following "Polynomial degree:"
|
||||
if [[ "$SKIP_SOLUTION" == "true" ]]; then
|
||||
# Get the line number of "Polynomial degree:"
|
||||
line_num=$(echo "$out" | grep -n "Polynomial degree:" | head -1 | cut -d: -f1)
|
||||
if [[ -n "$line_num" ]]; then
|
||||
# Keep lines up to 1 lines after "Polynomial degree:"
|
||||
out=$(echo "$out" | head -n $((line_num + 1)))
|
||||
expected=$(echo "$expected" | head -n $((line_num + 1)))
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# If check_error is true, verify if the output contains an error message or non-zero exit code
|
||||
if [[ "$check_error" == "error" ]]; then
|
||||
if [[ $exit_code -ne 0 || "$out" == *"Error"* ]]; then
|
||||
|
||||
Reference in New Issue
Block a user