1
0
Fork 0
advent-of-code/2021/test/support/puzzle_case.ex
Sloane Perrault a691461882 Setup 2021 (#1)
* chore: scaffold project

* chore: stand up puzzle solver, puzzle case

* feat: solution runner

* feat: solution generator
2022-09-21 09:19:53 -04:00

21 lines
604 B
Elixir

defmodule AdventOfCode.PuzzleCase do
@moduledoc """
Defines tests for an `AdventOfCode.PuzzleSolver` module.
"""
use ExUnit.CaseTemplate
using module: module do
quote bind_quoted: [module: module] do
@module module
defp assert_solution(input, desired_output) when is_binary(input) do
{:ok, stream_pid} = StringIO.open(input)
stream_input = IO.stream(stream_pid, :line)
actual_output = AdventOfCode.PuzzleSolver.solve(@module, stream_input)
@module.solve(stream_input)
assert actual_output == desired_output
end
end
end
end