@@ -70,26 +70,26 @@ function helpFun {
70
70
# ########### Do automated testing by taking inputs from $filename.test file for C & C++ ##################
71
71
function memoryTest {
72
72
if test $compiled == true ; then
73
- # echo #newline
74
- if test -f $filename .test && test " $2 " == " t " ; then
73
+ echo # newline
74
+ if test -f $filename .test; then
75
75
echo " * * * Valgrind Test: $filename .test found * * *"
76
- time cat $filename .test | valgrind ./ $filename .out
77
- elif test -f $filename .test && test " $2 " == " t1 " ; then
78
- echo " * * * Valgrind Test: $filename .test found * * * "
79
- time cat $filename .test | valgrind --leak-check=full ./ $filename .out
80
- elif test -f $filename .test && test " $2 " == " t2 " ; then
81
- echo " * * * Valgrind Test: $filename .test found * * * "
82
- time cat $filename .test | valgrind --leak-check=full -v ./$filename .out
83
- elif test -f $filename .test && test " $2 " == " t3" ; then
84
- echo " * * * Valgrind Test: $filename .test found * * * "
85
- time cat $filename .test | valgrind --leak-check=full --show-reachable=yes --track-origins=yes -v ./ $filename .out
86
- # else #No test arguments
87
- # echo #newline
88
- # echo "= = = For Copy/Paste = = = "
89
- # echo "time cat $filename.test | valgrind ./$filename.out #[ t ]"
90
- # echo "time cat $filename.test | valgrind --leak-check=full ./$filename.out #[ t1 ]"
91
- # echo "time cat $filename.test | valgrind --leak-check=full -v ./$filename.out #[ t2 ]"
92
- # echo "time cat $filename.test | valgrind --leak-check=full --show-reachable=yes --track-origins=yes -v ./$filename.out #[ t3 ]"
76
+ if test " $2 " == " t " ; then
77
+ time cat $filename .test | valgrind ./ $filename .out
78
+ elif test " $2 " == " t1 " ; then
79
+ echo " in t1 "
80
+ time cat $filename .test | valgrind --leak-check=full ./ $filename .out
81
+ elif test " $2 " == " t2 " ; then
82
+ time cat $filename .test | valgrind --leak-check=full -v ./$filename .out
83
+ elif test " $2 " == " t3" ; then
84
+ time cat $filename .test | valgrind --leak-check=full --show-reachable=yes --track-origins=yes -v ./ $filename .out
85
+ else # No test arguments
86
+ # echo #newline
87
+ echo " = = = For Copy/Paste = = = "
88
+ echo " time cat $filename .test | valgrind ./ $filename .out #[ t ] "
89
+ # echo "time cat $filename.test | valgrind --leak-check=full ./$filename.out #[ t1 ]"
90
+ # echo "time cat $filename.test | valgrind --leak-check=full -v ./$filename.out #[ t2 ]"
91
+ # echo "time cat $filename.test | valgrind --leak-check=full --show-reachable=yes --track-origins=yes - v ./$filename.out #[ t3 ]"
92
+ fi
93
93
fi
94
94
echo # newline
95
95
fi
@@ -134,7 +134,7 @@ function main {
134
134
echo " gcc -g -O2 -Wall -Wextra -Isrc -rdynamic -O2 -fomit-frame-pointer -o $filename .out $1 "
135
135
echo " Error(if any):" # newline
136
136
command gcc -g -O2 -Wall -Wextra -Isrc -rdynamic -O2 -fomit-frame-pointer -o $filename .out $1 || compiled=false;
137
- memoryTest
137
+ memoryTest $1 $2 $3
138
138
$compiled && echo " For Copy/Paste ===> ./$filename .out"
139
139
# gcc -Werror -pedantic-errors -std=c99 -O2 -fomit-frame-pointer -o prog prog.c #C99 strict (gcc-4.3.2)
140
140
# echo ".c file found"
@@ -150,7 +150,7 @@ function main {
150
150
echo " g++ -g -O2 -Wall -Wextra -Isrc -rdynamic -O2 -fomit-frame-pointer -o $filename .out $1 "
151
151
echo " Error(if any):" # newline
152
152
command g++ -g -O2 -Wall -Wextra -Isrc -rdynamic -O2 -fomit-frame-pointer -o $filename .out $1 || compiled=false
153
- memoryTest
153
+ memoryTest $1 $2 $3
154
154
$compiled && echo " For Copy/Paste ===> ./$filename .out"
155
155
# echo ".cpp file found"
156
156
@@ -196,12 +196,12 @@ function main {
196
196
then
197
197
echo # newline
198
198
echo " Ouch, The process of compilation failed."
199
- echo " For Copy/Paste ===> gedit $1 "
199
+ echo " For Copy/Paste ===> vi $1 "
200
200
compiled=false
201
201
fi
202
202
} # end of main function
203
203
# if test $compiled == true ; then
204
204
# else #Show Usage & Help
205
205
# usage
206
206
# fi
207
- main $1
207
+ main $1 $2 $3
0 commit comments