Allow directories as test arguments
This commit is contained in:
parent
dbdd5dea64
commit
009876aa7b
1 changed files with 12 additions and 4 deletions
18
test.py
18
test.py
|
|
@ -11,12 +11,20 @@ MAGENTA = "\033[1;35m"
|
|||
RED = "\033[1;31m"
|
||||
|
||||
|
||||
def find_solutions(paths):
|
||||
pairs = {}
|
||||
for path in paths:
|
||||
def find_solution(path, solutions):
|
||||
if path.suffix == ".input":
|
||||
pairs[path] = path.parent / (path.stem + ".solution")
|
||||
return pairs
|
||||
solutions[path] = path.parent / (path.stem + ".solution")
|
||||
|
||||
|
||||
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():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue