Allow directories as test arguments

This commit is contained in:
Joscha 2022-12-06 11:38:56 +01:00
parent dbdd5dea64
commit 009876aa7b

18
test.py
View file

@ -11,12 +11,20 @@ MAGENTA = "\033[1;35m"
RED = "\033[1;31m" RED = "\033[1;31m"
def find_solutions(paths): def find_solution(path, solutions):
pairs = {}
for path in paths:
if path.suffix == ".input": if path.suffix == ".input":
pairs[path] = path.parent / (path.stem + ".solution") solutions[path] = path.parent / (path.stem + ".solution")
return pairs
def find_solutions(paths):
solutions = {}
for path in paths:
if path.is_dir():
for subpath in path.glob("**/*.input"):
find_solution(subpath, solutions)
else:
find_solution(path, solutions)
return solutions
def main(): def main():