Skip to content

Commit

Permalink
Merge pull request #212 from Stegallo/2022-bis
Browse files Browse the repository at this point in the history
test day1
  • Loading branch information
Stegallo authored Nov 17, 2023
2 parents 22c2cbe + 914bdf5 commit 7372245
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/y_2022/test_2022_day1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from __future__ import annotations

from unittest.mock import mock_open, patch

from y_2022.day1 import Day

with patch("builtins.open", mock_open(read_data="0")):
day = Day()


def test__preprocess_input():
day._input_data = []
day._preprocess_input()
assert day._Day__input_data == []

day._input_data = [
["1000", "2000", "3000"],
["4000"],
["5000", "6000"],
["7000", "8000", "9000"],
["10000"],
]
day._preprocess_input()
assert day._Day__input_data == [
[1000, 2000, 3000],
[4000],
[5000, 6000],
[7000, 8000, 9000],
[10000],
]


def test_calculate_1():
day._Day__input_data = [
[1000, 2000, 3000],
[4000],
]
assert day._calculate_1() == 6000


def test_calculate_2():
day._Day__input_data = [
[1000, 2000, 3000],
[4000],
[5000, 6000],
[7000, 8000, 9000],
]
assert day._calculate_2() == 41000

0 comments on commit 7372245

Please sign in to comment.