Skip to content

Commit

Permalink
chore: day template updates
Browse files Browse the repository at this point in the history
  • Loading branch information
GriceTurrble committed Dec 12, 2024
1 parent d6f776a commit d988e02
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
16 changes: 10 additions & 6 deletions 2024/python/src/grice_py_aoc_2024/templates/main.py-tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,28 @@ DIR = Path(__file__).parent
FILE = DIR.parents[3] / "inputs" / f"{DIR.stem}.txt"


def part1(contents: str):
return "Not done yet!"
def part1(contents: str) -> int:
total = 0
# TODO part 1
return total


def part2(contents: str):
return "Not done yet!"
def part2(contents: str) -> int:
total = 0
# TODO part 2
return total


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

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

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

Expand Down
8 changes: 4 additions & 4 deletions 2024/python/src/grice_py_aoc_2024/templates/test_day.py-tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ 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!"
EXPECTED_PART_1 = 123 # TODO replace!
EXPECTED_PART_2 = 456 # TODO replace!


def test_part1():
contents = TEST_FILE.read_text()
result = part1(contents)
result = part1(contents=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)
result = part2(contents=contents)
assert result == EXPECTED_PART_2

0 comments on commit d988e02

Please sign in to comment.