69 lines
1 KiB
Markdown
69 lines
1 KiB
Markdown
# AOC 2022 - Template
|
|
|
|
```elixir
|
|
Mix.install([
|
|
{:req, "~> 0.3.3"}
|
|
])
|
|
```
|
|
|
|
## Puzzle description
|
|
|
|
[Day 1: Calorie Counting](https://adventofcode.com/2022/day/1).
|
|
|
|
## Input
|
|
|
|
```elixir
|
|
defmodule Load do
|
|
def input do
|
|
aoc_session = System.fetch_env!("LB_AOC_SESSION")
|
|
input_url = "https://adventofcode.com/2022/day/1/input"
|
|
Req.get!(input_url, headers: [cookie: "session=#{aoc_session}"]).body
|
|
end
|
|
end
|
|
```
|
|
|
|
## Solution
|
|
|
|
```elixir
|
|
defmodule Part1 do
|
|
def run(input) do
|
|
0
|
|
end
|
|
end
|
|
|
|
defmodule Part2 do
|
|
def run(input) do
|
|
0
|
|
end
|
|
end
|
|
|
|
ExUnit.start(autorun: false)
|
|
|
|
defmodule Test do
|
|
use ExUnit.Case, async: true
|
|
@example_input ~s()
|
|
@input Load.input()
|
|
|
|
test "it loads the input" do
|
|
assert String.length(@input) > 0
|
|
end
|
|
|
|
test "part 1 example" do
|
|
assert Part1.run(@example_input) === 0
|
|
end
|
|
|
|
test "part 1" do
|
|
assert Part1.run(@input) === 0
|
|
end
|
|
|
|
test "part 2 example" do
|
|
assert Part2.run(@example_input) === 0
|
|
end
|
|
|
|
test "part 2" do
|
|
assert Part2.run(@input) === 0
|
|
end
|
|
end
|
|
|
|
ExUnit.run()
|
|
```
|