-
Notifications
You must be signed in to change notification settings - Fork 0
/
evaluate-c.sh
executable file
·70 lines (59 loc) · 1.34 KB
/
evaluate-c.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Automate Test C
# Author Araiva
#
# Ruuner
c_red="\033[1;31m"
c_blue="\033[1;34m"
c_green="\033[1;32m"
c_reset="\033[m"
echo "$c_red...Araiva TESTING SUITE...$c_reset"
echo "main directory: $1"
echo "test directory: $2"
TEST_FILE_NAME=main.c
if [[ -z $1 || -z $2 ]]
then
echo ">> need \$1=testing_path and \$2=evaluating_argument"
exit 0
fi
t_path=$1
e_path=$2
## Check Norminette
echo ""
echo ">> Checking norminette <<"
norminette -R CheckForbiddenSourceHeader $2/*/ft*
echo ">> Done <<"
echo ""
n=$(find $t_path -name $TEST_FILE_NAME | sort -d | wc -l)
start=0
end=$((n -1))
for i in `seq -f '%02g' $start $end`;
do
ex=ex$i
t_file=$(find "$t_path" -name $TEST_FILE_NAME | grep "$ex")
e_file=$(find "$e_path" -name ft_*.c | grep "$ex")
echo "$c_green======= $ex ========$c_reset"
if [ -f "$e_file" ]
then
echo "Evaluating file\t: $e_file"
else
echo "Evaluating file is not existed"
fi
if [ -f "$t_file" ]
then
echo "Testing file\t: $t_file"
else
echo "Testing file is not existed"
fi
if [[ -f "$t_file" && -f "$e_file" ]]
then
echo ""$c_blue"Start testing... $c_reset"
gcc -Wall -Werror -Wextra $t_file $e_file -o bot_eva_test.out && ./bot_eva_test.out
fi
echo "\n"
done
#clear file
if [ -f "bot_eva_test.out" ]
then
rm bot_eva_test.out
fi
# DONE the program