stress Linux:
if [ "$3" == "" ] || [ "$4" != "" ] ; then
echo "Usage: <okSol> <mySol> <gen>"
exit 1
fi
if [ -e $1 ] && [ -e $2 ] && [ -e $3 ] ; then
for ((i = 1; i < 1000000000; i++))
do
echo -n -e "\rtest $i \x1b[32mOK\x1b[0m"
./$3 $i >testIn
./$2 <testIn >myAns
./$1 <testIn >okAns
diff myAns okAns >/dev/null || break
done
echo -n -e "\rtest $i \x1b[31mWA\x1b[0m"
echo ""
cat testIn
echo ""
echo "my answer:"
cat myAns
echo ""
echo "right answer:"
cat okAns
echo ""
else
echo "some files don't exist"
fi
stress Windows:
@echo off
for /L %%i in (1, 1, 100000000000000) do (
%3.exe %%i >input.txt
%2.exe <input.txt >outputOk.txt
%1.exe <input.txt >output.txt
FC outputOk.txt output.txt >null
echo %%i
if errorlevel 1 (
echo wa
exit
) else (
echo ok
)
)
compile Linux:
name=${1:0:-2}
run=$2
if [ "$2" == "" ] ; then
if [ "$name.c" == "$1" ] ; then
run=$name
else
run=${1:0:-4}
fi
fi
g++ $1 -o $run -std=c++17 -Wall -pedantic -Wpedantic -Wextra -fsanitize=address,undefined