test: Update script for new order indifferent program outputs
This commit is contained in:
parent
5f73b10976
commit
73699fb945
10
test/main.sh
10
test/main.sh
@ -1,13 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CC_COMMAND='g++ -Wall -Wextra -Werror -pedantic -D__PROGTEST__ -Wdouble-promotion -Wfloat-conversion'
|
CC_COMMAND='g++ -Wall -Wextra -Werror -pedantic -D__PROGTEST__'
|
||||||
|
|
||||||
RED="\e[31m"
|
RED="\e[31m"
|
||||||
GREEN="\e[32m"
|
GREEN="\e[32m"
|
||||||
YELLOW="\e[33m"
|
YELLOW="\e[33m"
|
||||||
RESET="\e[0m"
|
RESET="\e[0m"
|
||||||
|
|
||||||
DIFF_COMMAND="diff --color"
|
DIFF_COMMAND="diff --color" # Enable colors by default
|
||||||
|
SORT_COMMAND="cat" # Just print it by default
|
||||||
|
|
||||||
check_all=false
|
check_all=false
|
||||||
|
|
||||||
@ -20,6 +21,9 @@ for arg in "$@"; do
|
|||||||
# Disable colored output, because alpine diff is missing --color flag
|
# Disable colored output, because alpine diff is missing --color flag
|
||||||
DIFF_COMMAND="diff"
|
DIFF_COMMAND="diff"
|
||||||
;;
|
;;
|
||||||
|
--sort|-s)
|
||||||
|
SORT_COMMAND="sort"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -86,7 +90,7 @@ _test_dir() {
|
|||||||
input_file=${input//*\/}
|
input_file=${input//*\/}
|
||||||
test_case_number=${input_file%%_in.txt}
|
test_case_number=${input_file%%_in.txt}
|
||||||
|
|
||||||
if ! $DIFF_COMMAND <(./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" | $SORT_COMMAND) <($SORT_COMMAND "test_data/${test_case_number}_out.txt"); then
|
||||||
EXIT_STATUS=1
|
EXIT_STATUS=1
|
||||||
((failed_inputs++))
|
((failed_inputs++))
|
||||||
_log 2 "$dir (#$test_case_number)"
|
_log 2 "$dir (#$test_case_number)"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user