Skip to content

Commit a1c8a41

Browse files
committed
chore: day 9 scaffolded
1 parent add4352 commit a1c8a41

File tree

6 files changed

+59
-0
lines changed

6 files changed

+59
-0
lines changed

2024/inputs/day09.txt

Whitespace-only changes.

2024/inputs/tests/test_day09.txt

Whitespace-only changes.

2024/python/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ day05 = "grice_py_aoc_2024.day05.main:main"
2626
day06 = "grice_py_aoc_2024.day06.main:main"
2727
day07 = "grice_py_aoc_2024.day07.main:main"
2828
day08 = "grice_py_aoc_2024.day08.main:main"
29+
day09 = "grice_py_aoc_2024.day09.main:main"
2930

3031
[tool.pytest.ini_options]
3132
addopts = "-ra -q"

2024/python/src/grice_py_aoc_2024/day09/__init__.py

Whitespace-only changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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()
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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

0 commit comments

Comments
 (0)