mirror of
https://github.com/rjNemo/ai_advent_code_2024
synced 2026-06-06 02:26:44 +00:00
feat: Add test for part 2 README example in Day03
This commit is contained in:
parent
e1f4afe639
commit
bdb91371cd
1 changed files with 8 additions and 3 deletions
|
|
@ -8,7 +8,7 @@ defmodule AdventCode2024.Solutions.Day03Test do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "returns error for invalid file" do
|
test "returns error for invalid file" do
|
||||||
assert Day03.solve("nonexistent.txt") == {:error, :enoent}
|
assert Day03.solve("priv/nonexistent.txt") == {:error, :enoent}
|
||||||
end
|
end
|
||||||
|
|
||||||
test "handles single valid multiplication" do
|
test "handles single valid multiplication" do
|
||||||
|
|
@ -48,7 +48,7 @@ defmodule AdventCode2024.Solutions.Day03Test do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "returns error for invalid file" do
|
test "returns error for invalid file" do
|
||||||
assert Day03.solve_part2("nonexistent.txt") == {:error, :enoent}
|
assert Day03.solve_part2("priv/nonexistent.txt") == {:error, :enoent}
|
||||||
end
|
end
|
||||||
|
|
||||||
test "handles single multiplication with do/don't controls" do
|
test "handles single multiplication with do/don't controls" do
|
||||||
|
|
@ -73,7 +73,12 @@ defmodule AdventCode2024.Solutions.Day03Test do
|
||||||
|
|
||||||
test "ignores invalid control instructions" do
|
test "ignores invalid control instructions" do
|
||||||
input = "mul(2,4)dont()mul(5,5)doo()mul(3,3)"
|
input = "mul(2,4)dont()mul(5,5)doo()mul(3,3)"
|
||||||
assert Day03.solve_part2(input) == {:ok, 38}
|
assert Day03.solve_part2(input) == {:ok, 42}
|
||||||
|
end
|
||||||
|
|
||||||
|
test "solves README example for part 2" do
|
||||||
|
input = "xmul(2,4)&mul[3,7]!^don't()_mul(5,5)+mul(32,64](mul(11,8)undo()?mul(8,5))"
|
||||||
|
assert Day03.solve_part2(input) == {:ok, 48}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue