-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevaluate-c06.sh
executable file
·91 lines (84 loc) · 1.56 KB
/
evaluate-c06.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Automate test C06 only
# Author Araiva
#
#Helper
c_red="\033[1;31m"
c_blue="\033[1;34m"
c_green="\033[1;32m"
c_reset="\033[m"
seperator(){
echo "$c_green========= $1 =========$c_reset"
echo "Evaluating file\t: $2"
echo "Start testing file"
}
gcc_runner(){
gcc -Werror -Wall -Wextra $1 -o $2
}
# SETUP
if [[ -z $1 ]]
then
echo "need evaluate c06 directory"
fi
TEST_DIR=$1
# RUNNER
echo "$c_red...Araiva Testing Suite...$c_reset"
## Check Norminette
echo ""
echo "$c_green>> Checking Norminette <<$c_reset"
norminette -R CheckforbiddenSourceHeader $1/*/ft*
echo ">> Done <<"
echo ""
ex="ex00"
fullpath="$TEST_DIR/$ex/ft_print_program_name.c"
if [ -f $fullpath ]
then
seperator $ex $fullpath
gcc_runner $fullpath test.out
echo ">> Expect: "
echo "./test.out"
echo "<< Result: "
./test.out
echo "";
fi
ex="ex01"
fullpath="$TEST_DIR/$ex/ft_print_params.c"
if [ -f $fullpath ]
then
seperator $ex $fullpath
gcc_runner $fullpath test.out
echo ">> Expect: "
echo "test1"
echo "test2"
echo "test3"
echo "<< Result:"
./test.out test1 test2 test3
echo "";
fi
ex="ex02"
fullpath="$TEST_DIR/$ex/ft_rev_params.c"
if [ -f $fullpath ]
then
seperator $ex $fullpath
gcc_runner $fullpath test.out
echo ">> Expect: \ntest3\ntest2\ntest1"
echo "<< Result:"
./test.out test1 test2 test3
echo "";
fi
ex="ex03"
fullpath="$TEST_DIR/$ex/ft_sort_params.c"
if [ -f $fullpath ]
then
seperator $ex $fullpath
gcc_runner $fullpath test.out
echo ">> Expect:"
echo "H"
echo "Z"
echo "ab"
echo "ac"
echo "gga"
echo "z"
echo "<< Result:"
./test.out z ab ac Z H gga
echo ""
fi