File tree Expand file tree Collapse file tree 6 files changed +59
-0
lines changed
src/grice_py_aoc_2024/day09 Expand file tree Collapse file tree 6 files changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ day05 = "grice_py_aoc_2024.day05.main:main"
2626day06 = " grice_py_aoc_2024.day06.main:main"
2727day07 = " grice_py_aoc_2024.day07.main:main"
2828day08 = " grice_py_aoc_2024.day08.main:main"
29+ day09 = " grice_py_aoc_2024.day09.main:main"
2930
3031[tool .pytest .ini_options ]
3132addopts = " -ra -q"
Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+
3+ import time
4+ from pathlib import Path
5+
6+ DIR = Path (__file__ ).parent
7+ FILE = DIR .parents [3 ] / "inputs" / f"{ DIR .stem } .txt"
8+
9+
10+ def part1 (contents : str ):
11+ return "Not done yet!"
12+
13+
14+ def part2 (contents : str ):
15+ return "Not done yet!"
16+
17+
18+ def main ():
19+ contents = FILE .read_text ()
20+
21+ _start1 = time .perf_counter ()
22+ result1 = part1 (contents )
23+ _delta1 = time .perf_counter () - _start1
24+ print (f">> Part 1: { result1 } ({ _delta1 :.6f} s)" )
25+
26+ _start2 = time .perf_counter ()
27+ result2 = part2 (contents )
28+ _delta2 = time .perf_counter () - _start2
29+ print (f">> Part 2: { result2 } ({ _delta2 :.6f} s)" )
30+
31+
32+ if __name__ == "__main__" :
33+ main ()
Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+
3+ from pathlib import Path
4+
5+ import pytest
6+
7+ from .main import part1 , part2
8+
9+ DIR = Path (__file__ ).parent
10+ TEST_FILE = DIR .parents [3 ] / "inputs/tests" / f"test_{ DIR .stem } .txt"
11+ EXPECTED_PART_1 = "REPLACE ME!"
12+ EXPECTED_PART_2 = "REPLACE ME!"
13+
14+
15+ def test_part1 ():
16+ contents = TEST_FILE .read_text ()
17+ result = part1 (contents )
18+ assert result == EXPECTED_PART_1
19+
20+
21+ @pytest .mark .xfail (reason = f"{ DIR .stem } P1 incomplete" )
22+ def test_part2 ():
23+ contents = TEST_FILE .read_text ()
24+ result = part2 (contents )
25+ assert result == EXPECTED_PART_2
You can’t perform that action at this time.
0 commit comments