Skip to content

Commit

Permalink
chore: day 9 scaffolded
Browse files Browse the repository at this point in the history
  • Loading branch information
GriceTurrble committed Dec 8, 2024
1 parent add4352 commit a1c8a41
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
Empty file added 2024/inputs/day09.txt
Empty file.
Empty file.
1 change: 1 addition & 0 deletions 2024/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ day05 = "grice_py_aoc_2024.day05.main:main"
day06 = "grice_py_aoc_2024.day06.main:main"
day07 = "grice_py_aoc_2024.day07.main:main"
day08 = "grice_py_aoc_2024.day08.main:main"
day09 = "grice_py_aoc_2024.day09.main:main"

[tool.pytest.ini_options]
addopts = "-ra -q"
Empty file.
33 changes: 33 additions & 0 deletions 2024/python/src/grice_py_aoc_2024/day09/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from __future__ import annotations

import time
from pathlib import Path

DIR = Path(__file__).parent
FILE = DIR.parents[3] / "inputs" / f"{DIR.stem}.txt"


def part1(contents: str):
return "Not done yet!"


def part2(contents: str):
return "Not done yet!"


def main():
contents = FILE.read_text()

_start1 = time.perf_counter()
result1 = part1(contents)
_delta1 = time.perf_counter() - _start1
print(f">> Part 1: {result1} ({_delta1:.6f}s)")

_start2 = time.perf_counter()
result2 = part2(contents)
_delta2 = time.perf_counter() - _start2
print(f">> Part 2: {result2} ({_delta2:.6f}s)")


if __name__ == "__main__":
main()
25 changes: 25 additions & 0 deletions 2024/python/src/grice_py_aoc_2024/day09/test_day09.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from __future__ import annotations

from pathlib import Path

import pytest

from .main import part1, part2

DIR = Path(__file__).parent
TEST_FILE = DIR.parents[3] / "inputs/tests" / f"test_{DIR.stem}.txt"
EXPECTED_PART_1 = "REPLACE ME!"
EXPECTED_PART_2 = "REPLACE ME!"


def test_part1():
contents = TEST_FILE.read_text()
result = part1(contents)
assert result == EXPECTED_PART_1


@pytest.mark.xfail(reason=f"{DIR.stem} P1 incomplete")
def test_part2():
contents = TEST_FILE.read_text()
result = part2(contents)
assert result == EXPECTED_PART_2

0 comments on commit a1c8a41

Please sign in to comment.