Upgrade the script
This commit is contained in:
parent
d3871084e6
commit
6c7ba28320
19
run.sh
19
run.sh
@ -10,7 +10,24 @@ if [[ -z $TEST_FOLDER ]]; then
|
||||
TEST_FOLDER="test"
|
||||
fi
|
||||
|
||||
if [[ -z $SOLUTIONS_FILE ]]; then
|
||||
SOLUTIONS_FILE=solucoes.txt
|
||||
fi
|
||||
|
||||
declare -A solutions
|
||||
while read line; do
|
||||
solutions[$(awk '{print $1}' <<< "$line")]=$(awk '{print $2}' <<< "$line")
|
||||
done < "$SOLUTIONS_FILE"
|
||||
|
||||
for file in $(find "$TEST_FOLDER" -type f); do
|
||||
echo "Arquivo de teste: $file"
|
||||
"$EXEC" < "$file"
|
||||
res=$("$EXEC" -i -c < "$file" | awk '{print $4}')
|
||||
optimal=${solutions[$(basename "$file")]}
|
||||
echo "Resultado do programa: ${res}"
|
||||
echo "Resultado ótimo: ${optimal}"
|
||||
if [[ $res = $optimal ]]; then
|
||||
echo "Resultado ótimo!"
|
||||
else
|
||||
echo "Diferença de $(bc <<< "${res} - ${optimal}")"
|
||||
fi
|
||||
done
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user