-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
29 lines (27 loc) · 840 Bytes
/
test.py
File metadata and controls
29 lines (27 loc) · 840 Bytes
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
def evaluate_test(func,tests):
import time
passed = failed = 0
total = len(tests)
for index,test in enumerate(tests):
start_time = time.time()
result = func(**test["inputs"])
time_taken =time.time() - start_time
print()
print("Test {}".format(index + 1))
print("*"*40)
print()
if result == test["outputs"]:
print("Results: PASSED")
passed += 1
else:
print("Results: FAILED")
failed += 1
#print("*"*20)
print(f"Expected Result: {result}")
print()
print("Actual Result: {}".format(test["outputs"]))
print()
print("Time taken: {:4f}".format(time_taken))
print()
print("*"*25)
print("{}/{} PASSED, {}/{} FAILED".format(passed,total,failed,total))