-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestall
executable file
·85 lines (69 loc) · 1.9 KB
/
testall
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
#!/bin/bash
export LAB=lab5
(make clean; make) || exit 1
total=0
totalmax=0
rm -f total.txt *out total.txt
# Test driver
function runtest {
prog=$1
args=$2
testinput=$3
grade=$4
totalmax=`expr $totalmax + $grade`;
inputdescr=
echo > none
if [ "$testinput" != "none" ]; then
inputdescr=" < $testinput"
fi
descr="$prog $args $inputdescr"
echo "======= $descr ==========="
#Run tested program
./$prog $args < $testinput > $prog.out
./$prog.org $args< $testinput > $prog.org.out
diff $prog.out $prog.org.out > diff.out
if [ $? -eq 0 ]; then
cat $prog.out
echo Test passed...;
printf "%-36s: %-3d of %-3d\n" "$descr " $grade $grade >> total.txt
total=`expr $total + $grade`;
else
echo "*****Test Failed*****";
echo ------ Your Output ----------
cat $prog.out
echo ------ Expected Output ------
cat $prog.org.out
echo ------ Difference -----------
cat diff.out
echo -----------------------------
printf "%-36s: %-3d of %-3d\n" "$descr " 0 $grade >> total.txt
fi
echo
}
# List of tests running
runtest test0 "" none 5
runtest test1-1 "" none 5
runtest test1-2 "" none 10
runtest test1-3 "" none 10
runtest test1-4 "" none 10
runtest test2 "" none 10
runtest test3 "" none 10
runtest test4 "" none 10
runtest test5 "" none 10
runtest test6 "" none 10
runtest test7 "" none 10
echo
echo
echo "-------------------------------------------------"
echo "CS252: $LAB. $USER "
echo "-------------------------------------------------"
cat total.txt
echo "-------------------------------------------------"
echo "CS252: $LAB. $USER" `date` " Total: " $total of $totalmax >> total.out
echo >> total.out
cat total.out
cat total.out >> .local.total.out
#labout=/homes/cs252/LABOUT/$LAB/$USER/total.txt
#cat total.out >> $labout
#git add -A >> .local.git.out
#git commit -a -m "$total of $totalmax" >> .local.git.out