Skip to content

Commit 9d8e290

Browse files
feat(2024): init day 21
1 parent fe67cca commit 9d8e290

File tree

6 files changed

+55
-0
lines changed

6 files changed

+55
-0
lines changed

2024/Day21/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# --- Day 0: Template ---
2+
3+
To be used as template for the other days.

2024/Day21/input.txt

Whitespace-only changes.

2024/Day21/input_test.txt

Whitespace-only changes.

2024/Day21/main.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import os
2+
import sys
3+
4+
sys.path.append(".")
5+
6+
from solutions import part1, part2
7+
8+
from utils.inputs import get_inputs
9+
from utils.profiling import profile_run
10+
11+
if __name__ == "__main__":
12+
input_path = f"{os.path.dirname(os.path.realpath(__file__))}/input.txt"
13+
inputs = get_inputs(input_path)
14+
15+
profile_run("Part 1", lambda: part1(inputs))
16+
profile_run("Part 2", lambda: part2(inputs))

2024/Day21/solutions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def part1(inputs: list[str]) -> int:
2+
return 1
3+
4+
5+
def part2(inputs: list[str]) -> int:
6+
return 2

2024/Day21/test_solutions.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import os
2+
3+
import pytest
4+
from solutions import part1, part2
5+
6+
from utils.inputs import get_inputs
7+
8+
current_dir = os.path.dirname(os.path.realpath(__file__))
9+
10+
input = get_inputs(f"{current_dir}/input.txt")
11+
input_test = get_inputs(f"{current_dir}/input_test.txt")
12+
13+
14+
class TestPart1:
15+
def test_with_test_data(self):
16+
assert part1(input_test) == 1
17+
18+
@pytest.mark.skip(reason="not implemented")
19+
def test_with_real_data(self):
20+
assert part1(input) == 1
21+
22+
23+
class TestPart2:
24+
@pytest.mark.skip(reason="not implemented")
25+
def test_with_test_data(self):
26+
assert part2(input_test) == 2
27+
28+
@pytest.mark.skip(reason="not implemented")
29+
def test_with_real_data(self):
30+
assert part2(input) == 2

0 commit comments

Comments
 (0)