day 4 - part 2
This commit is contained in:
parent
93318458bf
commit
f9b2cbf69a
2 changed files with 108 additions and 0 deletions
33
tests/aoc_2024/day4/test_part2.py
Normal file
33
tests/aoc_2024/day4/test_part2.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
from pathlib import Path
|
||||
|
||||
from aoc_2024.day4 import part2
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
def test_find_all():
|
||||
data_str = """MMMSXXMASM
|
||||
MSAMXMSMSA
|
||||
AMXSXMAAMM
|
||||
MSAMASMSMX
|
||||
XMASAMXAMM
|
||||
XXAMMXXAMA
|
||||
SMSMSASXSS
|
||||
SAXAMASAAA
|
||||
MAMMMXMMMM
|
||||
MXMXAXMASX"""
|
||||
data = np.full((10, 10), "")
|
||||
i, j = 0, 0
|
||||
for character in data_str:
|
||||
if character != "\n":
|
||||
data[i, j] = character
|
||||
j += 1
|
||||
else:
|
||||
i += 1
|
||||
j = 0
|
||||
assert part2.find_x_mas(data) == 9
|
||||
|
||||
|
||||
def test_main():
|
||||
data_file = Path(__file__).parent / "test-data"
|
||||
assert part2.main(data_file) == 9
|
Loading…
Add table
Add a link
Reference in a new issue