test: Add --gitlab flag

This commit is contained in:
Tomáš Kléger 2025-10-13 19:12:30 +02:00
parent 579650d3b7
commit f9726d0229

View File

@ -7,11 +7,21 @@ GREEN="\e[32m"
YELLOW="\e[33m"
RESET="\e[0m"
if [[ "$1" =~ --all|-a ]]; then
check_all=true
else
check_all=false
fi
DIFF_COMMAND="diff --color"
for arg in "$@"; do
case "$arg" in
--all|-a)
check_all=true
;;
--gitlab|-g)
# Disable colored output, because alpine diff is missing --color flag
DIFF_COMMAND="diff"
;;
esac
done
EXIT_STATUS=0
@ -74,7 +84,7 @@ _test_dir() {
input_file=${input//*\/}
test_case_number=${input_file%%_in.txt}
if ! diff --color <(./a.out < "test_data/${test_case_number}_in.txt") "test_data/${test_case_number}_out.txt"; then
if ! $DIFF_COMMAND <(./a.out < "test_data/${test_case_number}_in.txt") "test_data/${test_case_number}_out.txt"; then
EXIT_STATUS=1
((failed_inputs++))
_log 2 "$dir (#$test_case_number)"