forked from adnanaziz/EPIJudge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadding_credits.py
58 lines (47 loc) · 1.59 KB
/
adding_credits.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
from test_framework import generic_test
from test_framework.test_failure import TestFailure
class ClientsCreditsInfo:
def insert(self, client_id: str, c: int) -> None:
# TODO - you fill in here.
return
def remove(self, client_id: str) -> bool:
# TODO - you fill in here.
return True
def lookup(self, client_id: str) -> int:
# TODO - you fill in here.
return 0
def add_all(self, C: int) -> None:
# TODO - you fill in here.
return
def max(self) -> str:
# TODO - you fill in here.
return ''
def client_credits_info_tester(ops):
cr = ClientsCreditsInfo()
for x in ops:
op = x[0]
s_arg = x[1]
i_arg = x[2]
if op == 'ClientsCreditsInfo':
pass
if op == 'max':
result = cr.max()
if result != s_arg:
raise TestFailure('Max: return value mismatch')
elif op == 'remove':
result = cr.remove(s_arg)
if result != i_arg:
raise TestFailure('Remove: return value mismatch')
elif op == 'insert':
cr.insert(s_arg, i_arg)
elif op == 'add_all':
cr.add_all(i_arg)
elif op == 'lookup':
result = cr.lookup(s_arg)
if result != i_arg:
raise TestFailure('Lookup: return value mismatch')
if __name__ == '__main__':
exit(
generic_test.generic_test_main('adding_credits.py',
'adding_credits.tsv',
client_credits_info_tester))