From 7b5aa97c0c11033d27d1482b95bdcf3991382513 Mon Sep 17 00:00:00 2001 From: hugogogo Date: Thu, 14 May 2026 13:24:53 +0200 Subject: [PATCH] improve tester --- tester.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tester.sh b/tester.sh index 8e3592f..2309460 100644 --- a/tester.sh +++ b/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