mirror of
https://github.com/rjNemo/ai_advent_code_2024
synced 2026-06-06 02:26:44 +00:00
test: Add test input fixture for Day1 solution
This commit is contained in:
parent
f9f46eadde
commit
4c70af439e
1 changed files with 21 additions and 2 deletions
|
|
@ -2,11 +2,30 @@ defmodule AdventCode2024Test do
|
|||
use ExUnit.Case
|
||||
doctest AdventCode2024
|
||||
|
||||
@test_input "test/fixtures/day1/input.txt"
|
||||
|
||||
setup do
|
||||
# Ensure the fixtures directory exists
|
||||
File.mkdir_p!("test/fixtures/day1")
|
||||
|
||||
# Create test input file
|
||||
test_content = """
|
||||
1 2
|
||||
3 4
|
||||
5 6
|
||||
"""
|
||||
File.write!(@test_input, test_content)
|
||||
|
||||
on_exit(fn ->
|
||||
File.rm!(@test_input)
|
||||
end)
|
||||
end
|
||||
|
||||
test "delegates day1 solutions to Day1 module" do
|
||||
assert {:ok, result} = AdventCode2024.solve_day1()
|
||||
assert {:ok, result} = AdventCode2024.solve_day1(@test_input)
|
||||
assert is_integer(result)
|
||||
|
||||
assert {:ok, result} = AdventCode2024.solve_day1_part2()
|
||||
assert {:ok, result} = AdventCode2024.solve_day1_part2(@test_input)
|
||||
assert is_integer(result)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue