Skip to content

Commit f36d0a7

Browse files
author
Mallory Brickerd
committed
fix: add test file
1 parent ae746be commit f36d0a7

File tree

10 files changed

+258
-12
lines changed

10 files changed

+258
-12
lines changed

.gitignore

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
# Byte-compiled / optimized / DLL files
22
__pycache__/
3-
.cursor
4-
.pytest_cache
5-
.pdm-build
6-
.mypy_cache
7-
.ruff_cache
3+
.pytest_cache/
4+
.pdm-build/
5+
.mypy_cache/
6+
.ruff_cache/
87
*.py[cod]
98
*$py.class
109

1110
# Environments
12-
.venv
11+
.venv/
12+
.idea/
13+
.cursor/
1314

14-
# AoC
15-
aoc_headers.json
16-
aoc_session
17-
18-
*.DS_Store
15+
*.DS_Store/
1916
*uv.lock
2017

2118
*.envrc

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ The session cookie will now automatically load when you cd into the project dire
208208

209209
```bash
210210
uv run python main.py --year <YEAR> --day <DAY> --part <PART> --add-test-input
211+
uv run python main.py --year <YEAR> --day <DAY> --part <PART> --add-test-file
211212
uv run python main.py --year <YEAR> --day <DAY> --part <PART>
212213
```
213214

_2023/data/day11/puzzle_input.txt

Lines changed: 140 additions & 0 deletions
Large diffs are not rendered by default.

_2023/solutions/day11.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"""Boilerplate solution template for Advent of Code daily challenges.
2+
3+
This module provides a template class for solving Advent of Code puzzle problems.
4+
It includes a base structure with two method stubs (part1 and part2) that can be
5+
implemented for specific day's challenges.
6+
7+
The template follows the SolutionBase pattern used across the Advent of Code solutions,
8+
allowing for consistent handling of input parsing and solution execution.
9+
"""
10+
11+
from aoc.models.base import SolutionBase
12+
13+
14+
class Solution(SolutionBase):
15+
"""Solution template for Advent of Code daily puzzle.
16+
17+
This class provides a standardized structure for implementing solutions to
18+
daily Advent of Code challenges. It inherits from SolutionBase and includes
19+
method stubs for part1 and part2 of the puzzle.
20+
21+
Subclasses should override these methods with specific implementation logic
22+
for parsing input and solving the puzzle requirements.
23+
"""
24+
25+
def part1(self, data: list[str]) -> int:
26+
"""Solve the first part of the daily puzzle.
27+
28+
Args:
29+
data: List of input strings to be processed
30+
31+
Returns
32+
-------
33+
int: Solution for part 1 of the puzzle
34+
"""
35+
return 0
36+
37+
def part2(self, data: list[str]) -> int:
38+
"""Solve the second part of the daily puzzle.
39+
40+
Args:
41+
data: List of input strings to be processed
42+
43+
Returns
44+
-------
45+
int: Solution for part 2 of the puzzle
46+
"""
47+
return 0
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
...#......
2+
.......#..
3+
#.........
4+
..........
5+
......#...
6+
.#........
7+
.........#
8+
..........
9+
.......#..
10+
#...#.....

_2023/tests/test_11.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from aoc.models.tester import TestSolutionUtility
2+
3+
def test_day11_part1():
4+
TestSolutionUtility.run_test(
5+
year=2023,
6+
day=11,
7+
is_raw=False,
8+
part_num=1,
9+
expected=9999999999999,
10+
)
11+
12+
def test_day11_part2():
13+
TestSolutionUtility.run_test(
14+
year=2023,
15+
day=11,
16+
is_raw=False,
17+
part_num=2,
18+
expected=9999999999999,
19+
)

aoc/models/file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def add_test_file(year: int, day: int) -> None:
226226
raise FileNotFoundError(error_msg)
227227

228228
# Read and format content
229-
content = sample_file.read_text().format(day=day)
229+
content = sample_file.read_text().format(year=year, day=day)
230230

231231
# Write the formatted content
232232
test_path.write_text(content)

templates/tests/sample.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1+
"""Test suite for Advent of Code daily challenge solution.
2+
3+
This module contains the test cases for the solution to the Advent of Code
4+
daily puzzle. It uses the TestSolutionUtility to run tests for both parts
5+
of the challenge.
6+
7+
The template provides a structure for defining tests for a specific day's
8+
solution, ensuring that the implementation meets the expected outputs for
9+
given test inputs.
10+
"""
111
from aoc.models.tester import TestSolutionUtility
212

313
def test_day{day:02d}_part1():
14+
"""Test the solution for Part 1 of the daily puzzle.
15+
16+
This test runs the solution for Part 1 of the puzzle against the
17+
provided test input and compares the result with the expected output.
18+
"""
419
TestSolutionUtility.run_test(
520
year={year},
621
day={day},
@@ -10,6 +25,11 @@ def test_day{day:02d}_part1():
1025
)
1126

1227
def test_day{day:02d}_part2():
28+
"""Test the solution for Part 2 of the daily puzzle.
29+
30+
This test runs the solution for Part 2 of the puzzle against the
31+
provided test input and compares the result with the expected output.
32+
"""
1333
TestSolutionUtility.run_test(
1434
year={year},
1535
day={day},

0 commit comments

Comments
 (0)