-
Notifications
You must be signed in to change notification settings - Fork 0
/
grade
34 lines (28 loc) · 976 Bytes
/
grade
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
#!/bin/bash
source grade_utils
printf "\n\n### Grade Solver Part A ###\n"
make -f Makefile clean
i=0
printf "\n\n### Check $i: our demo program should compile with your class\n"
grade_command make -f Makefile demo
grades[$i]=$grade
printf "### Score $i: ${grades[$i]}\n"
let "i=i+1"
printf "\n\n### Check $i: our demo program should run without errors\n"
grade_command ./demo
grades[$i]=$grade
printf "### Score $i: ${grades[$i]}\n"
let "i=i+1"
printf "\n\n### Check $i: your test should compile \n"
grade_command make -f Makefile test
grades[$i]=$grade
printf "### Score $i: ${grades[$i]}\n"
let "i=i+1"
printf "\n\n### Check $i: you should write some new tests\n"
grade_program test
grades[$i]=$grade
printf "### Score $i: ${grades[$i]}\n"
# from https://stackoverflow.com/a/31653407/827927
IFS='+' average_grade=$(echo "scale=1;(${grades[*]})/${#grades[@]}"|bc)
printf "\n\nGrade: $average_grade\n\n"
make -f Makefile --silent clean