Update the script so that it doesn't need a solution
This commit is contained in:
parent
ad5aedd454
commit
41245cae8f
20
run.sh
20
run.sh
@ -15,19 +15,23 @@ if [[ -z $SOLUTIONS_FILE ]]; then
|
||||
fi
|
||||
|
||||
declare -A solutions
|
||||
while read line; do
|
||||
solutions[$(awk '{print $1}' <<< "$line")]=$(awk '{print $2}' <<< "$line")
|
||||
done < "$SOLUTIONS_FILE"
|
||||
if [[ -f "$SOLUTIONS_FILE" ]]; then
|
||||
while read line; do
|
||||
solutions[$(awk '{print $1}' <<< "$line")]=$(awk '{print $2}' <<< "$line")
|
||||
done < "$SOLUTIONS_FILE"
|
||||
fi
|
||||
|
||||
for file in $(find "$TEST_FOLDER" -type f); do
|
||||
echo "Arquivo de teste: $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}")"
|
||||
if [[ ! -z $optimal ]]; then
|
||||
echo "Resultado ótimo: ${optimal}"
|
||||
if [[ $res = $optimal ]]; then
|
||||
echo "Resultado ótimo!"
|
||||
else
|
||||
echo "Diferença de $(bc <<< "${res} - ${optimal}")"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user