diff --git a/2024/day1/first-input b/2024/day1/input-data similarity index 100% rename from 2024/day1/first-input rename to 2024/day1/input-data diff --git a/2024/day1/part1.py b/2024/day1/part1.py index 839e4ed..2a7dd99 100644 --- a/2024/day1/part1.py +++ b/2024/day1/part1.py @@ -15,14 +15,10 @@ def compute_distance(list1, list2) -> int: return sum([abs(item2 - item1) for item1, item2 in zip(list1, list2)]) -def compute(data_file: Path) -> int: - list1, list2 = get_ordered_lists(data_file) - return compute_distance(list1, list2) - - def main(): file = Path(__file__).parent / "input-data" - print(compute(file)) + list1, list2 = get_ordered_lists(file) + print(compute_distance(list1, list2)) if __name__ == "__main__": diff --git a/tests/2024/day1/test_first.py b/tests/2024/day1/test_first.py index 90c0408..e69de29 100644 --- a/tests/2024/day1/test_first.py +++ b/tests/2024/day1/test_first.py @@ -1,14 +0,0 @@ -from pathlib import Path - -from day1 import part1 - -TEST_FILE = Path(__file__).parent / "test-data" - - -def test_first(): - assert part1.compute(TEST_FILE) == 11 - - -def test_get_lists(): - assert part1.get_ordered_lists(TEST_FILE)[0] == [1, 2, 3, 3, 3, 4] - assert part1.get_ordered_lists(TEST_FILE)[1] == [3, 3, 3, 4, 5, 9] diff --git a/tests/2024/day1/test_part1.py b/tests/2024/day1/test_part1.py new file mode 100644 index 0000000..90c0408 --- /dev/null +++ b/tests/2024/day1/test_part1.py @@ -0,0 +1,14 @@ +from pathlib import Path + +from day1 import part1 + +TEST_FILE = Path(__file__).parent / "test-data" + + +def test_first(): + assert part1.compute(TEST_FILE) == 11 + + +def test_get_lists(): + assert part1.get_ordered_lists(TEST_FILE)[0] == [1, 2, 3, 3, 3, 4] + assert part1.get_ordered_lists(TEST_FILE)[1] == [3, 3, 3, 4, 5, 9]