Skip to content

Instantly share code, notes, and snippets.

@vaughany
Created June 7, 2018 08:58
Show Gist options
  • Select an option

  • Save vaughany/1b843aa7646f8ee5ad77c40037a56977 to your computer and use it in GitHub Desktop.

Select an option

Save vaughany/1b843aa7646f8ee5ad77c40037a56977 to your computer and use it in GitHub Desktop.
For messing around with people...
#!/bin/bash
LOOPS=93
LINES=5
TESTS=0
FAILS=0
CERRORS=0
PASSES=0
clear
echo -e '\e[1mRunning P.o.o.P.\e[0m'
echo -en '\e[37mInitialising'
for (( i=1; i <= 7; i++ ))
do
echo -n '.'
sleep .2
done
echo -e ' done.\e[0m'
for (( j=1; j <= $LINES; j++ ))
do
for (( i=1; i <= $LOOPS; i++ ))
do
((TESTS++))
if [ $RANDOM -gt 3000 ]
then
echo -en "."
else
if [ $RANDOM -gt 5000 ]
then
sleep .3
echo -en "\e[31mx\e[0m"
((FAILS++))
else
echo -en "\e[33mc\e[0m"
((CERRORS++))
fi
fi
sleep .01
done
echo ""
done
let "PASSES=$TESTS - $FAILS - $CERRORS"
echo
echo -en "$TESTS tests: \e[32m$PASSES passes\e[0m, "
if [ $FAILS -eq 0 ]
then
echo -en "\e[32m$FAILS failures\e[0m and "
else
echo -en "\e[31m$FAILS failures\e[0m and "
fi
if [ $CERRORS -eq 0 ]
then
echo -e "\e[32m$CERRORS compiler errors.\e[0m "
else
echo -e "\e[33m$CERRORS compiler errors.\e[0m "
fi
echo -n "Result: "
if [ $PASSES -eq $TESTS ]
then
echo -e "All tests passed."
else
echo -e "\e[31mFAILED\e[0m"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment