Repository navigation
Expand file tree
/
Copy pathhw02.py
More file actions
59 lines (40 loc) · 2.09 KB
/
Copy pathhw02.py
File metadata and controls
59 lines (40 loc) · 2.09 KB
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
import unittest
from GradingInterface import interface
import os
path = os.path.join(os.getcwd(), 'TestCases')
def testhw02():
graded = interface.grade_submission(os.path.join(path, '2020homeworks/grade_testing/hw1-8/sort.zip'),
os.path.join(path, '2020homeworks/HW02Sort'))
print(f'grade for hw02 is {graded.get_grade()}')
return graded.get_error_list()
def testhw02_nocompile():
graded = interface.grade_submission(os.path.join(path, '2020homeworks/grade_testing/hw1-8/sort_nocompile.zip'),
os.path.join(path, '2020homeworks/HW02Sort'))
print(f'grade for hw02 is {graded.get_grade()}')
return graded.get_error_list()
def testhw02_incorrect():
graded = interface.grade_submission(os.path.join(path, '2020homeworks/grade_testing/hw1-8/sort_wrong.zip'),
os.path.join(path, '2020homeworks/HW02Sort'))
print(f'grade for hw02 is {graded.get_grade()}')
return graded.get_error_list()
def testhw02_mem():
graded = interface.grade_submission(os.path.join(path, '2020homeworks/grade_testing/hw1-8/sort_mem.zip'),
os.path.join(path, '2020homeworks/HW02Sort'))
print(f'grade for hw02 is {graded.get_grade()}')
return graded.get_error_list()
# ...
if __name__ == '__main__':
print('Start Testing...')
print('start correct homework ----------------------------------')
print(testhw02())
print('end correct homework ----------------------------------\n\n')
print('start nocompile homework ----------------------------------')
print(testhw02_nocompile())
print('end nocompile homework ----------------------------------\n\n')
print('start incorrect homework ----------------------------------')
print(testhw02_incorrect())
print('end incorrect homework ----------------------------------\n\n')
print('start mem leak homework ----------------------------------')
print(testhw02_mem())
print('end mem leak homework ----------------------------------\n\n')
# ......