1
0
Fork 0
advent-of-code/2021/test/support/puzzle_case.ex

22 lines
604 B
Elixir
Raw Normal View History

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