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