Skip to content

Commit b48529c

Browse files
committed
fix: 2023 tests
1 parent ee77820 commit b48529c

File tree

12 files changed

+152
-33
lines changed

12 files changed

+152
-33
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.....
2-
.F-7.
2+
.S-7.
33
.|.|.
44
.L-J.
55
.....
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
.F----7F7F7F7F-7....
2-
.|F--7||||||||FJ....
3-
.||.FJ||||||||L7....
4-
FJL7L7LJLJ||LJ.L-7..
5-
L--J.L7...LJS7F-7L7.
6-
....F-J..F7FJ|L7L7L7
7-
....L7.F7||L7|.L7L7|
8-
.....|FJLJ|FJ|F7|.LJ
9-
....FJL-7.||.||||...
10-
....L---J.LJ.LJLJ...
1+
FF7FSF7F7F7F7F7F---7
2+
L|LJ||||||||||||F--J
3+
FL-7LJLJ||||||LJL-77
4+
F--JF--7||LJLJ7F7FJ-
5+
L---JF-JLJ.||-FJLJJ7
6+
|F|F-JF---7F7-L7L|7|
7+
|FFJF7L7F-JF7|JL---7
8+
7-L-JL7||F7|L7F-7F7|
9+
L.L7LFJ|||||FJL7||LJ
10+
L7JLJL-JLJLJL--JLJ.L

_2023/tests/test_02.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Test suite for Day 2: Cube Conundrum.
1+
"""Test suite for Day 2: Cube Conundrum
22
33
This module contains tests for the Day 2 solution, which handles analysis of
44
cube games where colored cubes are drawn from a bag. The tests verify:

_2023/tests/test_03.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
"""Test suite for Day 3: Gear Ratios.
1+
"""Test suite for Day 3: Gear Ratios
22
3-
This module contains tests for the Day 3 solution, which analyzes engine
3+
This module contains tests for the Day 3 solution, which analyzes engine
44
schematics for valid part numbers and gear ratios. The tests verify:
55
66
1. Part 1: Identification and summing of valid part numbers adjacent to symbols
7-
2. Part 2: Calculation of gear ratios from '*' symbols adjacent to exactly
7+
2. Part 2: Calculation of gear ratios from '*' symbols adjacent to exactly
88
two numbers
99
"""
1010

@@ -14,7 +14,7 @@
1414
def test_day03_part1() -> None:
1515
"""Test summing valid part numbers in the schematic.
1616
17-
Verifies that the solution correctly finds part numbers adjacent
17+
Verifies that the solution correctly finds part numbers adjacent
1818
to any symbol and sums all valid part numbers.
1919
"""
2020
TestSolutionUtility.run_test(
@@ -25,10 +25,11 @@ def test_day03_part1() -> None:
2525
expected=4361,
2626
)
2727

28+
2829
def test_day03_part2() -> None:
2930
"""Test calculation of gear ratios in the schematic.
3031
31-
Verifies that the solution finds '*' symbols adjacent to exactly two part
32+
Verifies that the solution finds '*' symbols adjacent to exactly two part
3233
numbers and sums their gear ratios.
3334
"""
3435
TestSolutionUtility.run_test(

_2023/tests/test_04.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Test suite for Day 4: Scratchcards.
1+
"""Test suite for Day 4: Scratchcards
22
33
This module contains tests for the Day 4 solution, which processes scratchcards by matching
44
winning and owned numbers to score points and track card copies. The tests verify:
@@ -24,6 +24,7 @@ def test_day04_part1() -> None:
2424
expected=13,
2525
)
2626

27+
2728
def test_day04_part2() -> None:
2829
"""Test calculating total scratchcards won through copying.
2930

_2023/tests/test_05.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1+
"""Test suite for Day 5: If You Give A Seed A Fertilizer
2+
3+
This module contains tests for the Day 5 solution, which maps seeds through multiple conversion
4+
stages to find the lowest location number. The tests verify:
5+
6+
1. Part 1: Processing individual seed numbers through all mapping stages
7+
2. Part 2: Processing seed number ranges to find the lowest location
8+
"""
9+
110
from aoc.models.tester import TestSolutionUtility
211

312

4-
def test_day05_part1():
13+
def test_day05_part1() -> None:
14+
"""Test finding the lowest location for individual seed numbers.
15+
16+
Verifies that the solution correctly maps each seed through all conversion stages (soil,
17+
fertilizer, water, light, temperature, humidity, location) and finds the minimum location.
18+
"""
519
TestSolutionUtility.run_test(
620
year=2023,
721
day=5,
@@ -11,7 +25,12 @@ def test_day05_part1():
1125
)
1226

1327

14-
def test_day05_part2():
28+
def test_day05_part2() -> None:
29+
"""Test finding the lowest location for seed number ranges.
30+
31+
Verifies that the solution correctly interprets seed numbers as range pairs (start, length)
32+
and finds the minimum location across all seeds in all ranges.
33+
"""
1534
TestSolutionUtility.run_test(
1635
year=2023,
1736
day=5,

_2023/tests/test_06.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1+
"""Test suite for Day 6: Wait For It
2+
3+
This module contains tests for the Day 6 solution, which calculates winning strategies for toy
4+
boat races based on button hold duration. The tests verify:
5+
6+
1. Part 1: Product of winning ways across multiple separate races
7+
2. Part 2: Number of winning ways for a single race with concatenated values
8+
"""
9+
110
from aoc.models.tester import TestSolutionUtility
211

312

4-
def test_day06_part1():
13+
def test_day06_part1() -> None:
14+
"""Test calculating the product of winning ways for multiple races.
15+
16+
Verifies that the solution counts winning hold durations for each race and multiplies them
17+
together, where boat speed equals hold time and distance equals speed times remaining time.
18+
"""
519
TestSolutionUtility.run_test(
620
year=2023,
721
day=6,
@@ -11,7 +25,12 @@ def test_day06_part1():
1125
)
1226

1327

14-
def test_day06_part2():
28+
def test_day06_part2() -> None:
29+
"""Test calculating winning ways for a single concatenated race.
30+
31+
Verifies that the solution joins all time and distance digits into single values and counts
32+
the number of button hold durations that beat the record distance.
33+
"""
1534
TestSolutionUtility.run_test(
1635
year=2023,
1736
day=6,

_2023/tests/test_07.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1+
"""Test suite for Day 7: Camel Cards
2+
3+
This module contains tests for the Day 7 solution, which ranks and scores poker-like hands to
4+
calculate total winnings. The tests verify:
5+
6+
1. Part 1: Ranking hands using standard poker hand types and card values
7+
2. Part 2: Ranking hands with 'J' cards acting as jokers for strongest hand formation
8+
"""
9+
110
from aoc.models.tester import TestSolutionUtility
211

312

4-
def test_day07_part1():
13+
def test_day07_part1() -> None:
14+
"""Test calculating total winnings using standard poker rankings.
15+
16+
Verifies that the solution correctly ranks hands by type and card values, then calculates
17+
total winnings as the sum of rank times bid for each hand.
18+
"""
519
TestSolutionUtility.run_test(
620
year=2023,
721
day=7,
@@ -11,7 +25,12 @@ def test_day07_part1():
1125
)
1226

1327

14-
def test_day07_part2():
28+
def test_day07_part2() -> None:
29+
"""Test calculating total winnings with joker rules enabled.
30+
31+
Verifies that the solution treats 'J' cards as jokers that strengthen hand types while
32+
being weakest for tiebreaking, then calculates total winnings.
33+
"""
1534
TestSolutionUtility.run_test(
1635
year=2023,
1736
day=7,

_2023/tests/test_08.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1+
"""Test suite for Day 8: Haunted Wasteland
2+
3+
This module contains tests for the Day 8 solution, which navigates a network of nodes using
4+
left/right instructions to reach destination nodes. The tests verify:
5+
6+
1. Part 1: Finding the number of steps from 'AAA' to 'ZZZ' following instructions
7+
2. Part 2: Finding steps for multiple simultaneous paths using LCM of cycle lengths
8+
"""
9+
110
from aoc.models.tester import TestSolutionUtility
211

312

4-
def test_day08_part1():
13+
def test_day08_part1() -> None:
14+
"""Test navigating from 'AAA' to 'ZZZ' through the network.
15+
16+
Verifies that the solution correctly follows left/right instructions through the node network
17+
and counts the number of steps required to reach the destination node 'ZZZ'.
18+
"""
519
TestSolutionUtility.run_test(
620
year=2023,
721
day=8,
@@ -11,7 +25,12 @@ def test_day08_part1():
1125
)
1226

1327

14-
def test_day08_part2():
28+
def test_day08_part2() -> None:
29+
"""Test simultaneous navigation for multiple starting positions.
30+
31+
Verifies that the solution finds cycle lengths for all paths starting at nodes ending in 'A'
32+
and calculates the LCM to determine when all paths reach nodes ending in 'Z' simultaneously.
33+
"""
1534
TestSolutionUtility.run_test(
1635
year=2023,
1736
day=8,

_2023/tests/test_09.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1+
"""Test suite for Day 9: Mirage Maintenance
2+
3+
This module contains tests for the Day 9 solution, which extrapolates sequences by computing
4+
successive differences until reaching all zeros. The tests verify:
5+
6+
1. Part 1: Extrapolating the next value forward for each sequence
7+
2. Part 2: Extrapolating the previous value backward for each sequence
8+
"""
9+
110
from aoc.models.tester import TestSolutionUtility
211

312

4-
def test_day09_part1():
13+
def test_day09_part1() -> None:
14+
"""Test forward extrapolation of sequence values.
15+
16+
Verifies that the solution computes difference rows until all zeros, then extrapolates the
17+
next value by summing the last values of each row.
18+
"""
519
TestSolutionUtility.run_test(
620
year=2023,
721
day=9,
@@ -11,7 +25,12 @@ def test_day09_part1():
1125
)
1226

1327

14-
def test_day09_part2():
28+
def test_day09_part2() -> None:
29+
"""Test backward extrapolation of sequence values.
30+
31+
Verifies that the solution extrapolates the previous value by working backwards through
32+
difference rows and prepending calculated values to find the first element.
33+
"""
1534
TestSolutionUtility.run_test(
1635
year=2023,
1736
day=9,

0 commit comments

Comments
 (0)