77 lines
1.1 KiB
Bash
77 lines
1.1 KiB
Bash
#!/bin/sh
|
|
|
|
###########################################
|
|
# PIERRE PAGNOUX EXPERIENCE TESTSUITE #
|
|
###########################################
|
|
|
|
#----------------- COLOR -----------------#
|
|
# 0 - No style | 1 - Bold
|
|
RED="\e[0;31m"
|
|
BRED="\e[1;31m"
|
|
GRN="\e[0;32m"
|
|
BGRN="\e[1;32m"
|
|
YEL="\e[0;33m"
|
|
BYEL="\e[1;33m"
|
|
BLU="\e[0;34m"
|
|
BBLU="\e[1;34m"
|
|
PUR="\e[0;35m"
|
|
BPUR="\e[1;35m"
|
|
CYA="\e[0;36m"
|
|
BCYA="\e[1;36m"
|
|
WHI="\e[0;37m"
|
|
BWHI="\e[1;37m"
|
|
GRE="\e[2;37m"
|
|
|
|
#----------------- GLOBV -----------------#
|
|
ref_out=/tmp/ref_out.out
|
|
my_out=/tmp/my_out.out
|
|
|
|
#----------------- TESTS -----------------#
|
|
|
|
tit_wrap()
|
|
{
|
|
echo -e $@$WHI
|
|
}
|
|
|
|
func_test()
|
|
{
|
|
tit_wrap - $PUR $1
|
|
shift
|
|
printf $@ > $ref_out
|
|
../../tinyprintf $@ > $my_out
|
|
|
|
diff $ref_out $my_out > /tmp/null
|
|
|
|
if [ $? -eq 0 ]; then
|
|
tit_wrap $GRN GOOD
|
|
else
|
|
tit_wrap $RED EXPECTED: $BRED$(cat $ref_out) \|$RED GOT: $BRED$(cat $my_out)
|
|
fi
|
|
}
|
|
|
|
func_file()
|
|
{
|
|
for file in *; do
|
|
if [ -f $file ]; then
|
|
func_test $file $(cat $file)
|
|
fi
|
|
done
|
|
}
|
|
|
|
func_dir()
|
|
{
|
|
cd tests
|
|
for dir in *; do
|
|
if [ -d $dir ]; then
|
|
tit_wrap == $dir ==
|
|
cd $dir
|
|
func_file
|
|
cd ..
|
|
fi
|
|
done
|
|
cd ..
|
|
}
|
|
|
|
# func_dir
|
|
|
|
echo "Tests should be here"
|