diff --git a/2021/README.md b/2021/README.md index 937e179..6d6285b 100644 --- a/2021/README.md +++ b/2021/README.md @@ -14,7 +14,7 @@ | S | M | T | W | T | F | S | | :-: | :-: | :-: | :-: | :-: | :-: | :-: | -| | | | 1 | 2 | 3 | 4 | +| | | | [1] | 2 | 3 | 4 | | 5 | 6 | 7 | 8 | 9 | 10 | 11 | | 12 | 13 | 14 | 15 | 16 | 17 | 18 | | 19 | 20 | 21 | 22 | 23 | 24 | 25 | @@ -38,3 +38,5 @@ A behaviour for a solution to a puzzle. Must define a `solve/2` callback. Case template defining an `assert_solution/2` helper. + +[1]: ./lib/advent_of_code/day01.ex diff --git a/2021/lib/advent_of_code/day01.ex b/2021/lib/advent_of_code/day01.ex new file mode 100644 index 0000000..ec57e31 --- /dev/null +++ b/2021/lib/advent_of_code/day01.ex @@ -0,0 +1,37 @@ +defmodule AdventOfCode.Day01 do + @moduledoc """ + Day 1 + """ +end + +defmodule AdventOfCode.Day01.Part1 do + @moduledoc """ + Day 1, Part 1 + """ + + alias AdventOfCode.PuzzleSolver + use PuzzleSolver + + import AdventOfCode.Day01, warn: false + + @impl PuzzleSolver + def solve(_input_stream) do + :ok |> to_string() + end +end + +defmodule AdventOfCode.Day01.Part2 do + @moduledoc """ + Day 1, Part 2 + """ + + alias AdventOfCode.PuzzleSolver + use PuzzleSolver + + import AdventOfCode.Day01, warn: false + + @impl PuzzleSolver + def solve(_input_stream) do + :ok |> to_string() + end +end \ No newline at end of file diff --git a/2021/test/advent_of_code/day01/part_1_test.exs b/2021/test/advent_of_code/day01/part_1_test.exs new file mode 100644 index 0000000..f9a9557 --- /dev/null +++ b/2021/test/advent_of_code/day01/part_1_test.exs @@ -0,0 +1,11 @@ +defmodule AdventOfCode.Day01.Part1Test do + use AdventOfCode.PuzzleCase, module: AdventOfCode.Day01.Part1 + + test "returns :ok" do + input = ~S""" + input + """ + + assert_solution(input, "ok") + end +end \ No newline at end of file diff --git a/2021/test/advent_of_code/day01/part_2_test.exs b/2021/test/advent_of_code/day01/part_2_test.exs new file mode 100644 index 0000000..13711f3 --- /dev/null +++ b/2021/test/advent_of_code/day01/part_2_test.exs @@ -0,0 +1,11 @@ +defmodule AdventOfCode.Day01.Part2Test do + use AdventOfCode.PuzzleCase, module: AdventOfCode.Day01.Part2 + + test "returns :ok" do + input = ~S""" + input + """ + + assert_solution(input, "ok") + end +end \ No newline at end of file