test: Add test input fixture for Day1 solution

This commit is contained in:
Ruidy (aider) 2024-12-01 18:12:02 +01:00
parent f9f46eadde
commit 4c70af439e
No known key found for this signature in database
GPG key ID: E00F51288CB857CC

View file

@ -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