Testing for all Project Euler solutions
(solution_path: pathlib.Path)
| 96 | ids=lambda path: f"{path.parent.name}/{path.name}", |
| 97 | ) |
| 98 | def test_project_euler(solution_path: pathlib.Path) -> None: |
| 99 | """Testing for all Project Euler solutions""" |
| 100 | # problem_[extract this part] and pad it with zeroes for width 3 |
| 101 | problem_number: str = solution_path.parent.name[8:].zfill(3) |
| 102 | expected: str = PROBLEM_ANSWERS[problem_number] |
| 103 | solution_module = convert_path_to_module(solution_path) |
| 104 | answer = str(solution_module.solution()) |
| 105 | answer = hashlib.sha256(answer.encode()).hexdigest() |
| 106 | assert answer == expected, ( |
| 107 | f"Expected solution to {problem_number} to have hash {expected}, got {answer}" |
| 108 | ) |
nothing calls this directly
no test coverage detected