-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_runner.py
90 lines (82 loc) · 2.35 KB
/
test_runner.py
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
#!/usr/bin/env python
import argparse
from unimatrix_zero import zero
def main():
parser = argparse.ArgumentParser()
parser.add_argument('test_case', help = 'Run a particular test case', type = str)
args = parser.parse_args()
test_case = args.test_case
if test_case == 'test1':
max_number = 10
line_length = 6
picked = 6
cover = 5
line_count = 15
elif test_case == 'test2':
max_number = 10
line_length = 6
picked = 6
cover = 4
line_count = 3
elif test_case == 'test3':
max_number = 10
line_length = 6
picked = 7
cover = 5
line_count = 4
elif test_case == 'test4':
max_number = 10
line_length = 6
picked = 7
cover = 4
line_count = 2
elif test_case == 'test5':
max_number = 10
line_length = 6
picked = 5
cover = 5
line_count = 59
elif test_case == 'test6':
max_number = 10
line_length = 6
picked = 4
cover = 4
line_count = 23
elif test_case == 'test7':
max_number = 10
line_length = 6
picked = 5
cover = 4
line_count = 8
elif test_case == 'test8':
max_number = 10
line_length = 6
picked = 4
cover = 3
line_count = 4
elif test_case == 'test9':
max_number = 10
line_length = 3
picked = 6
cover = 3
line_count = 12
elif test_case == 'test10':
max_number = 10
line_length = 3
picked = 5
cover = 2
line_count = 3
results = zero.create(max_number, line_length, picked, cover, True, "")
if len(results) == line_count:
print ("Test successful: line count is correct")
else:
if len(results) > line_count:
print ("Test FAILED: more lines than expected")
print ("Run this command to see the results:")
print ("python generator.py",max_number,line_length,picked,cover,"testmode")
else:
print ("Test FAILED: fewer lines than expected")
print ("Run this command to see the results:")
print ("python generator.py",max_number,line_length,picked,cover,"testmode")
if __name__ == "__main__":
main()