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