31 lines
441 B
Bash
31 lines
441 B
Bash
#!/bin/bash
|
|
|
|
# This script is used to test the program
|
|
# test case 1
|
|
|
|
echo "Test case 1"
|
|
MAX=0
|
|
MIN=10000
|
|
for i in {1..100}
|
|
do
|
|
ARG=$(shuf -i 0-1000 -n 500)
|
|
N=$(./push_swap $ARG | wc -l)
|
|
if [ $N -gt $MAX ]
|
|
then
|
|
if [ $N -gt 5500 ]; then
|
|
echo "Max: $N | $(echo $ARG | tr -d '\n')"
|
|
fi
|
|
MAX=$N
|
|
fi
|
|
if [ $N -lt $MIN ]
|
|
then
|
|
MIN=$N
|
|
fi
|
|
AVG=$((AVG + N))
|
|
done
|
|
AVG=$((AVG / 100))
|
|
echo "Max: $MAX"
|
|
echo "Min: $MIN"
|
|
echo "Average: $AVG"
|
|
|