-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.py
29 lines (19 loc) · 805 Bytes
/
test.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
from uci_engine import Engine
import os
engine_path = "engines/"
# Test template
def test(testfile, test_func, print_fails):
for engine_name in os.listdir(engine_path):
engine = Engine(engine_name, engine_path)
with open(f"testfiles/{testfile}", 'r') as fens:
fail_count = 0
for count, fen in enumerate(fens):
print(f"\r[{count+1:4d}] ", end='')
if not test_func(engine, fen):
if print_fails:
print(fen, end='')
fail_count += 1
result = f"{fail_count} failures" if fail_count else "success"
print(f"\r{test_func.__name__} test with {testfile} of {engine_name}: {result}")
if __name__ == "__main__":
test("all.epd", lambda x, y : True)