Skip to content

Commit

Permalink
day24: coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-ong committed Dec 28, 2023
1 parent 4955a6a commit 80e0c67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions day24/day24.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ def part2(hailstones: list[Hailstone]) -> int:
)

if not isinstance(rx, int):
raise ValueError("rx is non-int!")
raise AssertionError("rx is non-int!")
if not isinstance(ry, int):
raise ValueError("ry is non-int!")
raise AssertionError("ry is non-int!")
if not isinstance(rz, int):
raise ValueError("rz is non-int!")
raise AssertionError("rz is non-int!")
return rx + ry + rz


Expand Down
8 changes: 7 additions & 1 deletion day24/tests/test_day24.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from day24.day24 import INPUT_SMALL, get_intersection_2d, part1, within_2d
from day24.day24 import INPUT_SMALL, get_intersection_2d, part1, part2, within_2d
from day24.lib.classes import Hailstone, Vector2, Vector3
from day24.lib.parsers import parse_input

Expand All @@ -9,6 +9,12 @@ def test_part1() -> None:
assert part1(hailstones, valid_range) == 2


def test_part2() -> None:
file_path, valid_range = INPUT_SMALL
hailstones: list[Hailstone] = parse_input(file_path)
assert part2(hailstones) == 47


def test_get_intersection_2d() -> None:
hailstone_a = Hailstone(Vector3(20, 25, 34), Vector3(-2, -2, -4))
hailstone_b = Hailstone(Vector3(12, 31, 28), Vector3(-1, -2, -1))
Expand Down

0 comments on commit 80e0c67

Please sign in to comment.